public function runListIssuetypes(framework\Request $request) { $issuetypes = entities\Issuetype::getAll(); $return_array = array(); foreach ($issuetypes as $issuetype) { $return_array[] = $issuetype->getName(); } $this->issuetypes = $return_array; }
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope) { $scheme = new IssuetypeScheme(); $scheme->setScope($scope->getID()); $scheme->setName("Default issuetype scheme"); $scheme->setDescription("This is the default issuetype scheme. It is used by all projects with no specific issuetype scheme selected. This scheme cannot be edited or removed."); $scheme->save(); framework\Settings::saveSetting(framework\Settings::SETTING_DEFAULT_ISSUETYPESCHEME, $scheme->getID(), 'core', $scope->getID()); foreach (Issuetype::getAll() as $issuetype) { $scheme->setIssuetypeEnabled($issuetype); if ($issuetype->getIcon() == 'developer_report') { $scheme->setIssuetypeRedirectedAfterReporting($issuetype, false); } if (in_array($issuetype->getIcon(), array('task', 'developer_report', 'idea'))) { $scheme->setIssuetypeReportable($issuetype, false); } } return $scheme; }
/** * Returns an array of regular expressions that should be used for matching * the issue numbers and workflow transitions in a VCS commit. * * Each element of an array is a single regular expression that will be * applied against the incoming commit message. Each regular expression * should have two named patterns - one denoting the issue number (should * include prefix if used in project), and one denoting workflow * transitions. * * Simple example would be: * * '#fixes issue #(?P<issues>([A-Z0-9]+\-)?\d+) (?P<transitions> \(.*?\))?#i' * * @return array */ public static function getIssueRegex() { // Try getting the regexes from cache first. if (!($regex = framework\Context::getCache()->get(framework\Cache::KEY_TEXTPARSER_ISSUE_REGEX))) { // List of keywords that are expected to prefix the issue number in a // commit message (these are _not_ project prefixes). $issue_strings = array('bug', 'issue', 'ticket', 'fix', 'fixes', 'fixed', 'fixing', 'applies to', 'closes', 'references', 'ref', 'addresses', 're', 'see', 'according to', 'also see', 'story'); // Add the issue types as prefixes as well. foreach (\thebuggenie\core\entities\Issuetype::getAll() as $issuetype) { $issue_strings[] = $issuetype->getName(); } // Construct the OR'ed (|) regex out of issue prefixes. $issue_string = join('|', $issue_strings); $issue_string = html_entity_decode($issue_string, ENT_QUOTES); $issue_string = str_replace(array(' ', "'"), array('\\s{1,1}', "\\'"), $issue_string); // Store all regular expressions for mathces in an array. $regex = array(); // This regex will match messages that contain template like "KEYWORD // (#)ISSUE_NUMBER (TRANSITIONS)" (parenthesis means optional). For // example: // "Resolves issue #2 (Resolve issue)" $regex[] = '#( |^)(?<!\\!)((' . $issue_string . ')\\s\\#?(?P<issues>([A-Z0-9]+\\-)?\\d+))( \\((?P<transitions>.*?)\\))?#i'; // This regex will match messages that contain template at the beginning // of message in format "ISSUE_NUMBER: (TRANSITIONS)". $regex[] = '#^(?<!\\!)((?P<issues>([A-Z0-9]+\\-)?\\d+)):( \\((?P<transitions>.*?)\\))?#i'; // Add the constructed regexes to cache. framework\Context::getCache()->add(framework\Cache::KEY_TEXTPARSER_ISSUE_REGEX, $regex); } // Return the regular expressions. return $regex; }
/** * Populates the internal array with unassigned user stories for the scrum page */ protected function _populateUnassignedStories() { if ($this->_unassignedstories === null) { $this->_unassignedstories = array(); $issuetypes = array(); foreach (Issuetype::getAll() as $issuetype) { if ($issuetype->getIcon() == 'developer_report') { $issuetypes[] = $issuetype->getID(); } } if (count($issuetypes) > 0) { if ($res = tables\Issues::getTable()->getByProjectIDandNoMilestoneandTypesAndState($this->getID(), $issuetypes, Issue::STATE_OPEN)) { while ($row = $res->getNextRow()) { $this->_unassignedstories[$row->get(tables\Issues::ID)] = new \thebuggenie\core\entities\Issue($row->get(tables\Issues::ID)); } } } } }
public static function getAvailableViews($target_type) { $i18n = framework\Context::getI18n(); $searches = array('info' => array(), 'searches' => array()); switch ($target_type) { case self::TYPE_USER: $searches['info'][self::VIEW_LOGGED_ACTIONS] = array(0 => array('title' => $i18n->__("What you've done recently"), 'description' => $i18n->__('A widget that shows your most recent actions, such as issue edits, wiki edits and more'))); if (framework\Context::getUser()->canViewComments()) { $searches['info'][self::VIEW_RECENT_COMMENTS] = array(0 => array('title' => $i18n->__('Recent comments'), 'description' => $i18n->__('Shows a list of your most recent comments'))); } $searches['searches'][self::VIEW_PREDEFINED_SEARCH] = array(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_REPORTED_ISSUES => array('title' => $i18n->__('Issues reported by me'), 'description' => $i18n->__('Shows a list of all issues you have reported, across all projects')), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_ASSIGNED_OPEN_ISSUES => array('title' => $i18n->__('Open issues assigned to me'), 'description' => $i18n->__('Shows a list of all issues assigned to you')), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_MY_OWNED_OPEN_ISSUES => array('title' => $i18n->__('Open issues owned by me'), 'description' => $i18n->__('Shows a list of all issues owned by you')), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_TEAM_ASSIGNED_OPEN_ISSUES => array('title' => $i18n->__('Open issues assigned to my teams'), 'description' => $i18n->__('Shows all issues assigned to any of your teams'))); $searches['info'][self::VIEW_PROJECTS] = array(0 => array('title' => $i18n->__("Your projects"), 'description' => $i18n->__('A widget that shows projects you are involved in'))); $searches['info'][self::VIEW_MILESTONES] = array(0 => array('title' => $i18n->__("Upcoming milestones / sprints"), 'description' => $i18n->__('A widget that shows all upcoming milestones or sprints for any projects you are involved in'))); break; case self::TYPE_PROJECT: $searches['statistics'] = array(); $issuetype_icons = array(); foreach (Issuetype::getAll() as $id => $issuetype) { $issuetype_icons[$id] = array('title' => $i18n->__('Recent issues: %issuetype', array('%issuetype' => $issuetype->getName())), 'description' => $i18n->__('Show recent issues of type %issuetype', array('%issuetype' => $issuetype->getName()))); } $searches['info'][self::VIEW_PROJECT_INFO] = array(0 => array('title' => $i18n->__('About this project'), 'description' => $i18n->__('Basic project information widget, showing project name, important people and links'))); $searches['info'][self::VIEW_PROJECT_TEAM] = array(0 => array('title' => $i18n->__('Project team'), 'description' => $i18n->__('A widget with information about project developers and the project team and their respective project roles'))); $searches['info'][self::VIEW_PROJECT_CLIENT] = array(0 => array('title' => $i18n->__('Project client'), 'description' => $i18n->__('Shows information about the associated project client (if any)'))); $searches['info'][self::VIEW_PROJECT_SUBPROJECTS] = array(0 => array('title' => $i18n->__('Subprojects'), 'description' => $i18n->__('Lists all subprojects of this project, with quick links to report an issue, open the project wiki and more'))); $searches['info'][self::VIEW_PROJECT_RECENT_ACTIVITIES] = array(0 => array('title' => $i18n->__('Recent activities'), 'description' => $i18n->__('Displays project timeline'))); $searches['info'][self::VIEW_PROJECT_UPCOMING] = array(0 => array('title' => $i18n->__('Upcoming milestones and deadlines'), 'description' => $i18n->__('A widget showing a list of upcoming milestones and deadlines for the next three weeks'))); $searches['info'][self::VIEW_PROJECT_DOWNLOADS] = array(0 => array('title' => $i18n->__('Latest downloads'), 'description' => $i18n->__('Lists recent downloads released in the release center'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_LAST15] = array(0 => array('title' => $i18n->__('Graph of closed vs open issues'), 'description' => $i18n->__('Shows a line graph comparing closed vs open issues for the past 15 days'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_PRIORITY] = array(0 => array('title' => $i18n->__('Statistics by priority'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by priority'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_SEVERITY] = array(0 => array('title' => $i18n->__('Statistics by severity'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by severity'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_CATEGORY] = array(0 => array('title' => $i18n->__('Statistics by category'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by category'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_STATUS] = array(0 => array('title' => $i18n->__('Statistics by status'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by status'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_RESOLUTION] = array(0 => array('title' => $i18n->__('Statistics by resolution'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by resolution'))); $searches['statistics'][self::VIEW_PROJECT_STATISTICS_WORKFLOW_STEP] = array(0 => array('title' => $i18n->__('Statistics by workflow step'), 'description' => $i18n->__('Displays a bar graph of open and closed issues grouped by current workflow step'))); $searches['searches'][self::VIEW_PROJECT_RECENT_ISSUES] = $issuetype_icons; break; } return $searches; }
public function getAvailableValues() { switch ($this->getFilterKey()) { case 'issuetype': return framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getIssuetypeScheme()->getIssuetypes() : Issuetype::getAll(); case 'status': return Status::getAll(); case 'category': return Category::getAll(); case 'priority': return Priority::getAll(); case 'severity': return Severity::getAll(); case 'reproducability': return Reproducability::getAll(); case 'resolution': return Resolution::getAll(); case 'project_id': return \thebuggenie\core\entities\Project::getAll(); case 'build': return $this->_getAvailableBuildChoices(); case 'component': return $this->_getAvailableComponentChoices(); case 'edition': return $this->_getAvailableEditionChoices(); case 'milestone': return $this->_getAvailableMilestoneChoices(); case 'subprojects': $filters = array(); $projects = Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject()); foreach ($projects as $project) { if ($project->getID() == framework\Context::getCurrentProject()->getID()) { continue; } $filters[$project->getID()] = $project; } return $filters; case 'owner_user': case 'assignee_user': case 'posted_by': return $this->_getAvailableUserChoices(); case 'owner_team': case 'assignee_team': return $this->_getAvailableTeamChoices(); default: $customdatatype = CustomDatatype::getByKey($this->getFilterKey()); if ($customdatatype instanceof \thebuggenie\core\entities\CustomDatatype && $customdatatype->hasCustomOptions()) { return $customdatatype->getOptions(); } else { switch ($this->getFilterType()) { case CustomDatatype::COMPONENTS_CHOICE: return $this->_getAvailableComponentChoices(); case CustomDatatype::RELEASES_CHOICE: return $this->_getAvailableBuildChoices(); case CustomDatatype::EDITIONS_CHOICE: return $this->_getAvailableEditionChoices(); case CustomDatatype::MILESTONE_CHOICE: return $this->_getAvailableMilestoneChoices(); case CustomDatatype::USER_CHOICE: return $this->_getAvailableUserChoices(); case CustomDatatype::TEAM_CHOICE: return $this->_getAvailableTeamChoices(); case CustomDatatype::CLIENT_CHOICE: return $this->_getAvailableClientChoices(); case CustomDatatype::STATUS_CHOICE: return Status::getAll(); default: return array(); } } } }
<table class="cleantable"> <thead> <tr> <th><?php echo __('Name'); ?> </th> <th><?php echo __('ID'); ?> </th> </tr> </thead> <tbody> <?php foreach (\thebuggenie\core\entities\Issuetype::getAll() as $item) { ?> <tr><td><?php echo $item->getName(); ?> </td><td><?php echo $item->getID(); ?> </td></tr> <?php } ?> </tbody> </table> </div> <div class="csv_data_box">
public function runConfigureWorkflowScheme(framework\Request $request) { $this->workflow_scheme = null; $this->mode = $request->getParameter('mode', 'list'); try { $this->workflow_scheme = entities\WorkflowScheme::getB2DBTable()->selectById($request['scheme_id']); $this->issuetypes = entities\Issuetype::getAll(); if (framework\Context::getScope()->isCustomWorkflowsEnabled() && $this->mode == 'copy_scheme') { if ($new_name = $request['new_name']) { $new_scheme = new entities\WorkflowScheme(); $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->getComponentHTML('configuration/workflowscheme', array('scheme' => $new_scheme)))); } else { $this->error = $this->getI18n()->__('Please enter a valid name'); } } elseif (framework\Context::getScope()->isCustomWorkflowsEnabled() && $this->mode == 'delete_scheme') { $this->workflow_scheme->delete(); return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('The workflow scheme was deleted'))); } elseif (framework\Context::getScope()->isCustomWorkflowsEnabled() && $request->isPost()) { foreach ($request->getParameter('workflow_id', array()) as $issuetype_id => $workflow_id) { $issuetype = entities\Issuetype::getB2DBTable()->selectById($issuetype_id); if ($workflow_id) { $workflow = entities\Workflow::getB2DBTable()->selectById($workflow_id); $this->workflow_scheme->associateIssuetypeWithWorkflow($issuetype, $workflow); } else { $this->workflow_scheme->unassociateIssuetype($issuetype); } } return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('Workflow associations were updated'))); } } 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 scheme does not exist'); } } }
public function componentFilter() { $pkey = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getID() : null; $i18n = framework\Context::getI18n(); $this->selected_operator = isset($this->selected_operator) ? $this->selected_operator : '='; $this->key = isset($this->key) ? $this->key : null; $this->filter = isset($this->filter) ? $this->filter : null; if (in_array($this->filter, array('posted', 'last_updated'))) { $this->selected_value = $this->selected_value ? $this->selected_value : NOW; } else { $this->selected_value = isset($this->selected_value) ? $this->selected_value : 0; } $this->filter_info = isset($this->filter_info) ? $this->filter_info : null; $filters = array(); $filters['status'] = array('description' => $i18n->__('Status'), 'options' => entities\Status::getAll()); $filters['category'] = array('description' => $i18n->__('Category'), 'options' => entities\Category::getAll()); $filters['priority'] = array('description' => $i18n->__('Priority'), 'options' => entities\Priority::getAll()); $filters['severity'] = array('description' => $i18n->__('Severity'), 'options' => entities\Severity::getAll()); $filters['reproducability'] = array('description' => $i18n->__('Reproducability'), 'options' => entities\Reproducability::getAll()); $filters['resolution'] = array('description' => $i18n->__('Resolution'), 'options' => entities\Resolution::getAll()); $filters['issuetype'] = array('description' => $i18n->__('Issue type'), 'options' => entities\Issuetype::getAll()); $filters['component'] = array('description' => $i18n->__('Component'), 'options' => array()); $filters['build'] = array('description' => $i18n->__('Build'), 'options' => array()); $filters['edition'] = array('description' => $i18n->__('Edition'), 'options' => array()); $filters['milestone'] = array('description' => $i18n->__('Milestone'), 'options' => array()); if (framework\Context::isProjectContext()) { $filters['subprojects'] = array('description' => $i18n->__('Include subproject(s)'), 'options' => array('all' => $this->getI18n()->__('All subprojects'), 'none' => $this->getI18n()->__("Don't include subprojects (default, unless specified otherwise)"))); $projects = entities\Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject()); foreach ($projects as $project) { if ($project->getID() == framework\Context::getCurrentProject()->getID()) { continue; } $filters['subprojects']['options'][$project->getID()] = "{$project->getName()} ({$project->getKey()})"; } } else { $projects = array(); foreach (entities\Project::getAllRootProjects() as $project) { entities\Project::getSubprojectsArray($project, $projects); } } if (count($projects) > 0) { foreach ($projects as $project) { foreach ($project->getComponents() as $component) { $filters['component']['options'][] = $component; } foreach ($project->getBuilds() as $build) { $filters['build']['options'][] = $build; } foreach ($project->getEditions() as $edition) { $filters['edition']['options'][] = $edition; } foreach ($project->getMilestones() as $milestone) { $filters['milestone']['options'][] = $milestone; } } } $filters['posted_by'] = array('description' => $i18n->__('Posted by')); $filters['assignee_user'] = array('description' => $i18n->__('Assigned to user')); $filters['assignee_team'] = array('description' => $i18n->__('Assigned to team')); $filters['owner_user'] = array('description' => $i18n->__('Owned by user')); $filters['owner_team'] = array('description' => $i18n->__('Owned by team')); $filters['posted'] = array('description' => $i18n->__('Date reported')); $filters['last_updated'] = array('description' => $i18n->__('Date last updated')); $this->filters = $filters; }