"><?php 
        echo $severity->getName();
        ?>
</option>
									<?php 
    }
    ?>
								</select>
								<a href="javascript:void(0);" class="img" onclick="$('severity_link').show();$('severity_additional_div').hide();$('severity_id_additional').setValue(0);"><?php 
    echo image_tag('undo.png', array('style' => 'float: none; margin-left: 5px;'));
    ?>
</a>
							</div>
						</li>
						<?php 
    foreach (TBGCustomDatatype::getAll() as $customdatatype) {
        ?>
							<li id="<?php 
        echo $customdatatype->getKey();
        ?>
_additional" style="display: none;">
								<?php 
        echo image_tag('icon_customdatatype.png');
        ?>
								<div id="<?php 
        echo $customdatatype->getKey();
        ?>
_link"<?php 
        if ($selected_customdatatype[$customdatatype->getKey()] !== null) {
            ?>
 style="display: none;"<?php 
 /**
  * Configure issue fields
  *
  * @param TBGRequest $request The request object
  */
 public function runConfigureIssuefields(TBGRequest $request)
 {
     $i18n = TBGContext::getI18n();
     $builtin_types = array();
     $builtin_types['status'] = array('description' => $i18n->__('Status types'), 'key' => 'status');
     $builtin_types['resolution'] = array('description' => $i18n->__('Resolution types'), 'key' => 'resolution');
     $builtin_types['priority'] = array('description' => $i18n->__('Priority levels'), 'key' => 'priority');
     $builtin_types['severity'] = array('description' => $i18n->__('Severity levels'), 'key' => 'severity');
     $builtin_types['category'] = array('description' => $i18n->__('Categories'), 'key' => 'category');
     $builtin_types['reproducability'] = array('description' => $i18n->__('Reproducability'), 'key' => 'reproducability');
     // FIXME: editing of project roles should move to Users/Teams/... page?
     $builtin_types['projectrole'] = array('description' => $i18n->__('Project role'), 'key' => 'projectrole');
     $this->builtin_types = $builtin_types;
     $this->custom_types = TBGCustomDatatype::getAll();
 }
 public static function getAvailableFields($builtin_only = false)
 {
     $builtin_types = array('description', 'reproduction_steps', 'status', 'category', 'resolution', 'priority', 'reproducability', 'percent_complete', 'severity', 'owner', 'assignee', 'edition', 'build', 'component', 'estimated_time', 'spent_time', 'milestone', 'user_pain', 'votes');
     if ($builtin_only) {
         return $builtin_types;
     }
     $customtypes = TBGCustomDatatype::getAll();
     $types = array_merge($builtin_types, array_keys($customtypes));
     return $types;
 }
Exemple #4
0
 /**
  * Configure issue fields
  *
  * @param TBGRequest $request The request object
  */
 public function runConfigureIssuefields(TBGRequest $request)
 {
     $i18n = TBGContext::getI18n();
     $builtin_types = array();
     $builtin_types[TBGDatatype::STATUS] = array('description' => $i18n->__('Status types'), 'key' => TBGDatatype::STATUS);
     $builtin_types[TBGDatatype::RESOLUTION] = array('description' => $i18n->__('Resolution types'), 'key' => TBGDatatype::RESOLUTION);
     $builtin_types[TBGDatatype::PRIORITY] = array('description' => $i18n->__('Priority levels'), 'key' => TBGDatatype::PRIORITY);
     $builtin_types[TBGDatatype::SEVERITY] = array('description' => $i18n->__('Severity levels'), 'key' => TBGDatatype::SEVERITY);
     $builtin_types[TBGDatatype::CATEGORY] = array('description' => $i18n->__('Categories'), 'key' => TBGDatatype::CATEGORY);
     $builtin_types[TBGDatatype::REPRODUCABILITY] = array('description' => $i18n->__('Reproducability'), 'key' => TBGDatatype::REPRODUCABILITY);
     $builtin_types[TBGDatatype::ACTIVITYTYPE] = array('description' => $i18n->__('Activity types'), 'key' => TBGDatatype::ACTIVITYTYPE);
     $this->builtin_types = $builtin_types;
     $this->custom_types = TBGCustomDatatype::getAll();
 }
 protected function _setupReportIssueProperties()
 {
     $this->selected_issuetype = $this->selected_issuetype ?: null;
     $this->selected_edition = $this->selected_edition ?: null;
     $this->selected_build = $this->selected_build ?: null;
     $this->selected_milestone = $this->selected_milestone ?: null;
     $this->parent_issue = $this->parent_issue ?: null;
     $this->selected_component = $this->selected_component ?: null;
     $this->selected_category = $this->selected_category ?: null;
     $this->selected_status = $this->selected_status ?: null;
     $this->selected_resolution = $this->selected_resolution ?: null;
     $this->selected_priority = $this->selected_priority ?: null;
     $this->selected_reproducability = $this->selected_reproducability ?: null;
     $this->selected_severity = $this->selected_severity ?: null;
     $this->selected_estimated_time = $this->selected_estimated_time ?: null;
     $this->selected_spent_time = $this->selected_spent_time ?: null;
     $this->selected_percent_complete = $this->selected_percent_complete ?: null;
     $this->selected_pain_bug_type = $this->selected_pain_bug_type ?: null;
     $this->selected_pain_likelihood = $this->selected_pain_likelihood ?: null;
     $this->selected_pain_effect = $this->selected_pain_effect ?: null;
     $selected_customdatatype = $this->selected_customdatatype ?: array();
     foreach (TBGCustomDatatype::getAll() as $customdatatype) {
         $selected_customdatatype[$customdatatype->getKey()] = isset($selected_customdatatype[$customdatatype->getKey()]) ? $selected_customdatatype[$customdatatype->getKey()] : null;
     }
     $this->selected_customdatatype = $selected_customdatatype;
     $this->issuetype_id = $this->issuetype_id ?: null;
     $this->issue = $this->issue ?: null;
     $this->categories = TBGCategory::getAll();
     $this->severities = TBGSeverity::getAll();
     $this->priorities = TBGPriority::getAll();
     $this->reproducabilities = TBGReproducability::getAll();
     $this->resolutions = TBGResolution::getAll();
     $this->statuses = TBGStatus::getAll();
     $this->milestones = TBGContext::getCurrentProject()->getMilestonesForIssues();
 }
Exemple #6
0
 protected function _postIssue()
 {
     $fields_array = $this->selected_project->getReportableFieldsArray($this->issuetype_id);
     $issue = new TBGIssue();
     $issue->setTitle($this->title);
     $issue->setIssuetype($this->issuetype_id);
     $issue->setProject($this->selected_project);
     if (isset($fields_array['description'])) {
         $issue->setDescription($this->selected_description);
     }
     if (isset($fields_array['description_syntax'])) {
         $issue->setDescriptionSyntax($this->selected_description_syntax);
     }
     if (isset($fields_array['reproduction_steps'])) {
         $issue->setReproductionSteps($this->selected_reproduction_steps);
     }
     if (isset($fields_array['reproduction_steps_syntax'])) {
         $issue->setReproductionStepsSyntax($this->selected_reproduction_steps_syntax);
     }
     if (isset($fields_array['category']) && $this->selected_category instanceof TBGDatatype) {
         $issue->setCategory($this->selected_category->getID());
     }
     if (isset($fields_array['status']) && $this->selected_status instanceof TBGDatatype) {
         $issue->setStatus($this->selected_status->getID());
     }
     if (isset($fields_array['reproducability']) && $this->selected_reproducability instanceof TBGDatatype) {
         $issue->setReproducability($this->selected_reproducability->getID());
     }
     if (isset($fields_array['resolution']) && $this->selected_resolution instanceof TBGDatatype) {
         $issue->setResolution($this->selected_resolution->getID());
     }
     if (isset($fields_array['severity']) && $this->selected_severity instanceof TBGDatatype) {
         $issue->setSeverity($this->selected_severity->getID());
     }
     if (isset($fields_array['priority']) && $this->selected_priority instanceof TBGDatatype) {
         $issue->setPriority($this->selected_priority->getID());
     }
     if (isset($fields_array['estimated_time'])) {
         $issue->setEstimatedTime($this->selected_estimated_time);
     }
     if (isset($fields_array['spent_time'])) {
         $issue->setSpentTime($this->selected_spent_time);
     }
     if (isset($fields_array['milestone']) || isset($this->selected_milestone)) {
         $issue->setMilestone($this->selected_milestone);
     }
     if (isset($fields_array['percent_complete'])) {
         $issue->setPercentCompleted($this->selected_percent_complete);
     }
     if (isset($fields_array['pain_bug_type'])) {
         $issue->setPainBugType($this->selected_pain_bug_type);
     }
     if (isset($fields_array['pain_likelihood'])) {
         $issue->setPainLikelihood($this->selected_pain_likelihood);
     }
     if (isset($fields_array['pain_effect'])) {
         $issue->setPainEffect($this->selected_pain_effect);
     }
     foreach (TBGCustomDatatype::getAll() as $customdatatype) {
         if (!isset($fields_array[$customdatatype->getKey()])) {
             continue;
         }
         if ($customdatatype->hasCustomOptions()) {
             if (isset($fields_array[$customdatatype->getKey()]) && $this->selected_customdatatype[$customdatatype->getKey()] instanceof TBGCustomDatatypeOption) {
                 $selected_option = $this->selected_customdatatype[$customdatatype->getKey()];
                 $issue->setCustomField($customdatatype->getKey(), $selected_option->getID());
             }
         } else {
             $issue->setCustomField($customdatatype->getKey(), $this->selected_customdatatype[$customdatatype->getKey()]);
         }
     }
     // FIXME: If we set the issue assignee during report issue, this needs to be set INSTEAD of this
     if ($this->selected_project->canAutoassign()) {
         if (isset($fields_array['component']) && $this->selected_component instanceof TBGComponent && $this->selected_component->hasLeader()) {
             $issue->setAssignee($this->selected_component->getLeader());
         } elseif (isset($fields_array['edition']) && $this->selected_edition instanceof TBGEdition && $this->selected_edition->hasLeader()) {
             $issue->setAssignee($this->selected_edition->getLeader());
         } elseif ($this->selected_project->hasLeader()) {
             $issue->setAssignee($this->selected_project->getLeader());
         }
     }
     $issue->save();
     if (isset($this->parent_issue)) {
         $issue->addParentIssue($this->parent_issue);
     }
     if (isset($fields_array['edition']) && $this->selected_edition instanceof TBGEdition) {
         $issue->addAffectedEdition($this->selected_edition);
     }
     if (isset($fields_array['build']) && $this->selected_build instanceof TBGBuild) {
         $issue->addAffectedBuild($this->selected_build);
     }
     if (isset($fields_array['component']) && $this->selected_component instanceof TBGComponent) {
         $issue->addAffectedComponent($this->selected_component);
     }
     return $issue;
 }
 protected static function _cacheAvailablePermissions()
 {
     if (self::$_available_permissions === null) {
         $i18n = self::getI18n();
         self::$_available_permissions = array('user' => array(), 'general' => array(), 'project' => array());
         self::$_available_permissions['user']['canseeallissues'] = array('description' => $i18n->__('Can see issues reported by other users'), 'mode' => 'permissive');
         self::$_available_permissions['user']['canseegroupissues'] = array('description' => $i18n->__('Can see issues reported by users in the same group'), 'mode' => 'permissive');
         self::$_available_permissions['configuration']['cansaveconfig'] = array('description' => $i18n->__('Can access the configuration page and edit all configuration'), 'details' => array());
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Settings" configuration page'), 'target_id' => 12));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Settings" configuration page'), 'target_id' => 12));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Permissions" configuration page'), 'target_id' => 5));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Permissions" configuration page'), 'target_id' => 5));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Uploads" configuration page'), 'target_id' => 3));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Uploads" configuration page'), 'target_id' => 3));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Scopes" configuration page'), 'target_id' => 14));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Scopes" configuration page'), 'target_id' => 14));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Import" configuration page'), 'target_id' => 16));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Import" configuration page'), 'target_id' => 16));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Projects" configuration page'), 'target_id' => 10));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Projects" configuration page'), 'target_id' => 10));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Issue types" configuration page'), 'target_id' => 6));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Issue types" configuration page'), 'target_id' => 6));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Issue fields" configuration page'), 'target_id' => 4));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Issue fields" configuration page'), 'target_id' => 4));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Users, teams and groups" configuration page'), 'target_id' => 2));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Users, teams and groups" configuration page'), 'target_id' => 2));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Modules" and any module configuration page'), 'target_id' => 15));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Modules" configuration page and any modules'), 'target_id' => 15));
         self::$_available_permissions['general']['canfindissuesandsavesearches'] = array('description' => $i18n->__('Can search for issues and create saved searches'), 'details' => array());
         self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['canfindissues'] = array('description' => $i18n->__('Can search for issues'));
         //self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['cancreatesavedsearches'] = array('description' => $i18n->__('Can create saved searches'));
         self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['cancreatepublicsearches'] = array('description' => $i18n->__('Can create saved searches that are public'));
         self::$_available_permissions['general']['caneditmainmenu'] = array('description' => $i18n->__('Can edit main menu'));
         self::$_available_permissions['pages']['page_home_access'] = array('description' => $i18n->__('Can access the frontpage'));
         self::$_available_permissions['pages']['page_dashboard_access'] = array('description' => $i18n->__('Can access the user dashboard'));
         self::$_available_permissions['pages']['page_search_access'] = array('description' => $i18n->__('Can access the search page'));
         self::$_available_permissions['pages']['page_about_access'] = array('description' => $i18n->__('Can access the "About" page'));
         self::$_available_permissions['pages']['page_account_access'] = array('description' => $i18n->__('Can access the "My account" page'));
         self::$_available_permissions['pages']['page_teamlist_access'] = array('description' => $i18n->__('Can see list of teams in header menu'));
         self::$_available_permissions['pages']['page_clientlist_access'] = array('description' => $i18n->__('Can access all clients'));
         self::$_available_permissions['project_pages']['page_project_allpages_access'] = array('description' => $i18n->__('Can access all project pages'), 'details' => array());
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_dashboard_access'] = array('description' => $i18n->__('Can access the project dashboard'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_planning_access'] = array('description' => $i18n->__('Can access the project planning page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_scrum_access'] = array('description' => $i18n->__('Can access the project scrum page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_issues_access'] = array('description' => $i18n->__('Can access the project issues search page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_roadmap_access'] = array('description' => $i18n->__('Can access the project roadmap page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_team_access'] = array('description' => $i18n->__('Can access the project team page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_statistics_access'] = array('description' => $i18n->__('Can access the project statistics page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_timeline_access'] = array('description' => $i18n->__('Can access the project timeline page'));
         self::$_available_permissions['project']['canseeproject'] = array('description' => $i18n->__('Can see that project exists'));
         self::$_available_permissions['project']['canseeprojecthierarchy'] = array('description' => $i18n->__('Can see complete project hierarchy'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojecteditions'] = array('description' => $i18n->__('Can see all editions'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectcomponents'] = array('description' => $i18n->__('Can see all components'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectbuilds'] = array('description' => $i18n->__('Can see all release'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectmilestones'] = array('description' => $i18n->__('Can see all milestones'));
         self::$_available_permissions['project']['candoscrumplanning'] = array('description' => $i18n->__('Can manage stories, tasks, sprints and backlog on the sprint planning page'), 'details' => array());
         self::$_available_permissions['project']['candoscrumplanning']['details']['canaddscrumuserstories'] = array('description' => $i18n->__('Can add new user stories to the backlog on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['candoscrumplanning_backlog'] = array('description' => $i18n->__('Can manage the backlog on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['canaddscrumsprints'] = array('description' => $i18n->__('Can add sprints on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['canassignscrumuserstoriestosprints'] = array('description' => $i18n->__('Can add stories to sprints on the sprint planning page'));
         self::$_available_permissions['project']['canmanageproject'] = array('description' => $i18n->__('Can manage project'));
         self::$_available_permissions['project']['canmanageproject']['details']['canmanageprojectreleases'] = array('description' => $i18n->__('Can manage project releases and components'));
         self::$_available_permissions['project']['canmanageproject']['details']['caneditprojectdetails'] = array('description' => $i18n->__('Can edit project details and settings'));
         self::$_available_permissions['edition']['canseeedition'] = array('description' => $i18n->__('Can see this edition'));
         self::$_available_permissions['component']['canseecomponent'] = array('description' => $i18n->__('Can see this component'));
         self::$_available_permissions['build']['canseebuild'] = array('description' => $i18n->__('Can see this release'));
         self::$_available_permissions['milestone']['canseemilestone'] = array('description' => $i18n->__('Can see this milestone'));
         self::$_available_permissions['issues']['canvoteforissues'] = array('description' => $i18n->__('Can vote for issues'));
         self::$_available_permissions['issues']['canlockandeditlockedissues'] = array('description' => $i18n->__('Can lock and edit locked issues'));
         self::$_available_permissions['issues']['cancreateandeditissues'] = array('description' => $i18n->__('Can create issues, edit basic information on issues reported by the user and close/re-open them'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['cancreateissues'] = array('description' => $i18n->__('Can create new issues'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown'] = array('description' => $i18n->__('Can edit title and description on issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuetitleown'] = array('description' => $i18n->__('Can edit issue title on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuedescriptionown'] = array('description' => $i18n->__('Can edit issue description on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuereproduction_stepsown'] = array('description' => $i18n->__('Can edit steps to reproduce on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown'] = array('description' => $i18n->__('Can close and reopen issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown']['details']['cancloseissuesown'] = array('description' => $i18n->__('Can close issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown']['details']['canreopenissuesown'] = array('description' => $i18n->__('Can re-open issues reported by the user'));
         self::$_available_permissions['issues']['caneditissue'] = array('description' => $i18n->__('Can delete, close, reopen and update any issue details and progress'), 'details' => array());
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic'] = array('description' => $i18n->__('Can edit title and description on any issues'), 'details' => array());
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuetitle'] = array('description' => $i18n->__('Can edit any issue title'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuedescription'] = array('description' => $i18n->__('Can edit any issue description'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuereproduction_steps'] = array('description' => $i18n->__('Can edit any issue steps to reproduce'));
         self::$_available_permissions['issues']['caneditissue']['details']['candeleteissues'] = array('description' => $i18n->__('Can delete issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues'] = array('description' => $i18n->__('Can close any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues']['details']['cancloseissues'] = array('description' => $i18n->__('Can close any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues']['details']['canreopenissues'] = array('description' => $i18n->__('Can re-open any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueposted_by'] = array('description' => $i18n->__('Can edit issue posted by'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueowned_by'] = array('description' => $i18n->__('Can edit issue owned by'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueassigned_to'] = array('description' => $i18n->__('Can edit issue assigned_to'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuestatus'] = array('description' => $i18n->__('Can edit issue status'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuecategory'] = array('description' => $i18n->__('Can edit issue category'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuepriority'] = array('description' => $i18n->__('Can edit issue priority'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueseverity'] = array('description' => $i18n->__('Can edit issue severity'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuereproducability'] = array('description' => $i18n->__('Can edit issue reproducability'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueresolution'] = array('description' => $i18n->__('Can edit issue resolution'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueestimated_time'] = array('description' => $i18n->__('Can estimate issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuespent_time'] = array('description' => $i18n->__('Can spend time working on issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuepercent_complete'] = array('description' => $i18n->__('Can edit issue percent complete'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuemilestone'] = array('description' => $i18n->__('Can set issue milestone'));
         self::$_available_permissions['issues']['caneditissuecustomfieldsown'] = array('description' => $i18n->__('Can change custom field values for issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['caneditissuecustomfields'] = array('description' => $i18n->__('Can change custom field values for any issues'), 'details' => array());
         foreach (TBGCustomDatatype::getAll() as $cdf) {
             self::$_available_permissions['issues']['caneditissuecustomfieldsown']['details']['caneditissuecustomfields' . $cdf->getKey() . 'own'] = array('description' => $i18n->__('Can change custom field "%field_name%" for issues reported by the user', array('%field_name%' => $cdf->getDescription())));
             self::$_available_permissions['issues']['caneditissuecustomfields']['details']['caneditissuecustomfields' . $cdf->getKey()] = array('description' => $i18n->__('Can change custom field "%field_name%" for any issues', array('%field_name%' => $cdf->getDescription())));
         }
         self::$_available_permissions['issues']['canaddextrainformationtoissues'] = array('description' => $i18n->__('Can add/remove extra information (edition, component, release, links and files) to issues'), 'details' => array());
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddbuildsown'] = array('description' => $i18n->__('Can add releases / versions to list of affected versions for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddbuilds'] = array('description' => $i18n->__('Can add releases / versions to list of affected versions for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddcomponentsown'] = array('description' => $i18n->__('Can add components to list of affected components for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddcomponents'] = array('description' => $i18n->__('Can add components to list of affected components for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddeditionsown'] = array('description' => $i18n->__('Can add editions to list of affected editions for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddeditions'] = array('description' => $i18n->__('Can add editions to list of affected editions for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddlinkstoissuesown'] = array('description' => $i18n->__('Can add links to issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddlinkstoissues'] = array('description' => $i18n->__('Can add links to any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddfilestoissuesown'] = array('description' => $i18n->__('Can add files to and remove own files from issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddfilestoissues'] = array('description' => $i18n->__('Can add files to and remove own files from any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canremovefilesfromissuesown'] = array('description' => $i18n->__('Can remove any attachments from issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canremovefilesfromissues'] = array('description' => $i18n->__('Can remove any attachments from any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddrelatedissues'] = array('description' => $i18n->__('Can add related issues to other issues'));
         self::$_available_permissions['issues']['canpostandeditcomments'] = array('description' => $i18n->__('Can see public comments, post new, edit own and delete own comments'), 'details' => array());
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['canviewcomments'] = array('description' => $i18n->__('Can see public comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['canpostcomments'] = array('description' => $i18n->__('Can post comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['caneditcommentsown'] = array('description' => $i18n->__('Can edit own comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['candeletecommentsown'] = array('description' => $i18n->__('Can delete own comments'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments'] = array('description' => $i18n->__('Can see all comments (including non-public), post new, edit and delete all comments'), 'details' => array());
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['canseenonpubliccomments'] = array('description' => $i18n->__('Can see all comments including hidden'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['caneditcomments'] = array('description' => $i18n->__('Can edit all comments'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['candeletecomments'] = array('description' => $i18n->__('Can delete any comments'));
         self::$_available_permissions['pages']['page_account_access']['details']['canchangepassword'] = array('description' => $i18n->__('Can change own password'), 'mode' => 'permissive');
         //self::trigger('core', 'cachepermissions', array('permissions' => &self::$_available_permissions));
     }
 }
 public function componentIssueTypeSchemeOptions()
 {
     $this->issuetype = TBGContext::factory()->TBGIssuetype($this->id);
     $this->scheme = TBGContext::factory()->TBGIssuetypeScheme($this->scheme_id);
     $this->builtinfields = TBGDatatype::getAvailableFields(true);
     $this->customtypes = TBGCustomDatatype::getAll();
     $this->visiblefields = $this->scheme->getVisibleFieldsForIssuetype($this->issuetype);
 }
 protected function setupVariables()
 {
     $i18n = TBGContext::getI18n();
     $this->statuses = TBGStatus::getAll();
     $this->issuetypes = $this->issue->getProject()->getIssuetypeScheme()->getIssuetypes();
     $fields_list = array();
     $fields_list['category'] = array('title' => $i18n->__('Category'), 'visible' => $this->issue->isCategoryVisible(), 'changed' => $this->issue->isCategoryChanged(), 'merged' => $this->issue->isCategoryMerged(), 'name' => $this->issue->getCategory() instanceof TBGCategory ? $this->issue->getCategory()->getName() : '', 'name_visible' => (bool) ($this->issue->getCategory() instanceof TBGCategory), 'noname_visible' => (bool) (!$this->issue->getCategory() instanceof TBGCategory), 'icon' => false, 'change_tip' => $i18n->__('Click to change category'), 'change_header' => $i18n->__('Change category'), 'clear' => $i18n->__('Clear the category'), 'select' => $i18n->__('%clear_the_category% or click to select a new category', array('%clear_the_category%' => '')));
     if ($this->issue->isEditable() && $this->issue->canEditCategory()) {
         $fields_list['category']['choices'] = TBGCategory::getAll();
     }
     $fields_list['resolution'] = array('title' => $i18n->__('Resolution'), 'visible' => $this->issue->isResolutionVisible(), 'changed' => $this->issue->isResolutionChanged(), 'merged' => $this->issue->isResolutionMerged(), 'name' => $this->issue->getResolution() instanceof TBGResolution ? $this->issue->getResolution()->getName() : '', 'name_visible' => (bool) ($this->issue->getResolution() instanceof TBGResolution), 'noname_visible' => (bool) (!$this->issue->getResolution() instanceof TBGResolution), 'icon' => false, 'change_tip' => $i18n->__('Click to change resolution'), 'change_header' => $i18n->__('Change resolution'), 'clear' => $i18n->__('Clear the resolution'), 'select' => $i18n->__('%clear_the_resolution% or click to select a new resolution', array('%clear_the_resolution%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditResolution()) {
         $fields_list['resolution']['choices'] = TBGResolution::getAll();
     }
     $fields_list['priority'] = array('title' => $i18n->__('Priority'), 'visible' => $this->issue->isPriorityVisible(), 'changed' => $this->issue->isPriorityChanged(), 'merged' => $this->issue->isPriorityMerged(), 'name' => $this->issue->getPriority() instanceof TBGPriority ? $this->issue->getPriority()->getName() : '', 'name_visible' => (bool) ($this->issue->getPriority() instanceof TBGPriority), 'noname_visible' => (bool) (!$this->issue->getPriority() instanceof TBGPriority), 'icon' => false, 'change_tip' => $i18n->__('Click to change priority'), 'change_header' => $i18n->__('Change priority'), 'clear' => $i18n->__('Clear the priority'), 'select' => $i18n->__('%clear_the_priority% or click to select a new priority', array('%clear_the_priority%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditPriority()) {
         $fields_list['priority']['choices'] = TBGPriority::getAll();
     }
     $fields_list['reproducability'] = array('title' => $i18n->__('Reproducability'), 'visible' => $this->issue->isReproducabilityVisible(), 'changed' => $this->issue->isReproducabilityChanged(), 'merged' => $this->issue->isReproducabilityMerged(), 'name' => $this->issue->getReproducability() instanceof TBGReproducability ? $this->issue->getReproducability()->getName() : '', 'name_visible' => (bool) ($this->issue->getReproducability() instanceof TBGReproducability), 'noname_visible' => (bool) (!$this->issue->getReproducability() instanceof TBGReproducability), 'icon' => false, 'change_tip' => $i18n->__('Click to change reproducability'), 'change_header' => $i18n->__('Change reproducability'), 'clear' => $i18n->__('Clear the reproducability'), 'select' => $i18n->__('%clear_the_reproducability% or click to select a new reproducability', array('%clear_the_reproducability%' => '')));
     if ($this->issue->isEditable() && $this->issue->canEditReproducability()) {
         $fields_list['reproducability']['choices'] = TBGReproducability::getAll();
     }
     $fields_list['severity'] = array('title' => $i18n->__('Severity'), 'visible' => $this->issue->isSeverityVisible(), 'changed' => $this->issue->isSeverityChanged(), 'merged' => $this->issue->isSeverityMerged(), 'name' => $this->issue->getSeverity() instanceof TBGSeverity ? $this->issue->getSeverity()->getName() : '', 'name_visible' => (bool) ($this->issue->getSeverity() instanceof TBGSeverity), 'noname_visible' => (bool) (!$this->issue->getSeverity() instanceof TBGSeverity), 'icon' => false, 'change_tip' => $i18n->__('Click to change severity'), 'change_header' => $i18n->__('Change severity'), 'clear' => $i18n->__('Clear the severity'), 'select' => $i18n->__('%clear_the_severity% or click to select a new severity', array('%clear_the_severity%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditSeverity()) {
         $fields_list['severity']['choices'] = TBGSeverity::getAll();
     }
     $fields_list['milestone'] = array('title' => $i18n->__('Targetted for'), 'visible' => $this->issue->isMilestoneVisible(), 'changed' => $this->issue->isMilestoneChanged(), 'merged' => $this->issue->isMilestoneMerged(), 'name' => $this->issue->getMilestone() instanceof TBGMilestone ? $this->issue->getMilestone()->getName() : '', 'name_visible' => (bool) ($this->issue->getMilestone() instanceof TBGMilestone), 'noname_visible' => (bool) (!$this->issue->getMilestone() instanceof TBGMilestone), 'icon' => true, 'icon_name' => 'icon_milestones.png', 'change_tip' => $i18n->__('Click to change which milestone this issue is targetted for'), 'change_header' => $i18n->__('Set issue target / milestone'), 'clear' => $i18n->__('Set as not targetted'), 'select' => $i18n->__('%set_as_not_targetted% or click to set a new target milestone', array('%set_as_not_targetted%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditMilestone()) {
         $fields_list['milestone']['choices'] = $this->issue->getProject()->getAllMilestones();
     }
     $customfields_list = array();
     foreach (TBGCustomDatatype::getAll() as $key => $customdatatype) {
         $changed_methodname = "isCustomfield{$key}Changed";
         $merged_methodname = "isCustomfield{$key}Merged";
         $customfields_list[$key] = array('type' => $customdatatype->getType(), 'title' => $i18n->__($customdatatype->getDescription()), 'visible' => $this->issue->isFieldVisible($key), 'changed' => $this->issue->{$changed_methodname}(), 'merged' => $this->issue->{$merged_methodname}(), 'change_tip' => $i18n->__($customdatatype->getInstructions()), 'change_header' => $i18n->__($customdatatype->getDescription()), 'clear' => $i18n->__('Clear this field'), 'select' => $i18n->__('%clear_this_field% or click to set a new value', array('%clear_this_field%' => '')));
         if ($customdatatype->hasCustomOptions()) {
             $customfields_list[$key]['name'] = $this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption ? $this->issue->getCustomField($key)->getName() : '';
             $customfields_list[$key]['name_visible'] = (bool) ($this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption);
             $customfields_list[$key]['noname_visible'] = (bool) (!$this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption);
             $customfields_list[$key]['choices'] = $customdatatype->getOptions();
         } else {
             $customfields_list[$key]['name'] = $this->issue->getCustomField($key);
             $customfields_list[$key]['name_visible'] = (bool) ($this->issue->getCustomField($key) != '');
             $customfields_list[$key]['noname_visible'] = (bool) ($this->issue->getCustomField($key) == '');
         }
     }
     $this->fields_list = $fields_list;
     $this->customfields_list = $customfields_list;
     if (isset($this->transition) && $this->transition->hasAction(TBGWorkflowTransitionAction::ACTION_ASSIGN_ISSUE)) {
         $available_assignees = array();
         foreach (TBGContext::getUser()->getTeams() as $team) {
             foreach ($team->getMembers() as $user) {
                 $available_assignees[$user->getID()] = $user->getNameWithUsername();
             }
         }
         foreach (TBGContext::getUser()->getFriends() as $user) {
             $available_assignees[$user->getID()] = $user->getNameWithUsername();
         }
         $this->available_assignees = $available_assignees;
     }
 }
Exemple #10
0
 protected function _saveCustomFieldValues()
 {
     foreach (TBGCustomDatatype::getAll() as $key => $customdatatype) {
         switch ($customdatatype->getType()) {
             case TBGCustomDatatype::INPUT_TEXT:
             case TBGCustomDatatype::INPUT_TEXTAREA_SMALL:
             case TBGCustomDatatype::INPUT_TEXTAREA_MAIN:
             case TBGCustomDatatype::DATE_PICKER:
                 $option_id = $this->getCustomField($key);
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldValue($option_id, $customdatatype->getID(), $this->getID());
                 break;
             case TBGCustomDatatype::EDITIONS_CHOICE:
             case TBGCustomDatatype::COMPONENTS_CHOICE:
             case TBGCustomDatatype::RELEASES_CHOICE:
             case TBGCustomDatatype::MILESTONE_CHOICE:
             case TBGCustomDatatype::STATUS_CHOICE:
             case TBGCustomDatatype::USER_CHOICE:
             case TBGCustomDatatype::TEAM_CHOICE:
                 $option_object = null;
                 try {
                     switch ($customdatatype->getType()) {
                         case TBGCustomDatatype::EDITIONS_CHOICE:
                             $option_object = TBGEditionsTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::COMPONENTS_CHOICE:
                             $option_object = TBGComponentsTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::RELEASES_CHOICE:
                             $option_object = TBGBuildsTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::MILESTONE_CHOICE:
                             $option_object = TBGMilestonesTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::STATUS_CHOICE:
                             $option_object = TBGListTypesTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::USER_CHOICE:
                             $option_object = TBGUsersTable::getTable()->selectById($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::TEAM_CHOICE:
                             $option_object = TBGTeamsTable::getTable()->selectById($this->getCustomField($key));
                             break;
                     }
                 } catch (Exception $e) {
                 }
                 $option_id = is_object($option_object) ? $option_object->getID() : null;
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldOption($option_id, $customdatatype->getID(), $this->getID());
                 break;
             default:
                 $option_id = $this->getCustomField($key) instanceof TBGCustomDatatypeOption ? $this->getCustomField($key)->getID() : null;
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldOption($option_id, $customdatatype->getID(), $this->getID());
                 break;
         }
     }
 }
 protected function _saveCustomFieldValues()
 {
     foreach (TBGCustomDatatype::getAll() as $key => $customdatatype) {
         switch ($customdatatype->getType()) {
             case TBGCustomDatatype::INPUT_TEXT:
             case TBGCustomDatatype::INPUT_TEXTAREA_SMALL:
             case TBGCustomDatatype::INPUT_TEXTAREA_MAIN:
                 $option_id = $this->getCustomField($key);
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldValue($option_id, $customdatatype->getID(), $this->getID());
                 break;
             case TBGCustomDatatype::EDITIONS_CHOICE:
             case TBGCustomDatatype::COMPONENTS_CHOICE:
             case TBGCustomDatatype::RELEASES_CHOICE:
             case TBGCustomDatatype::STATUS_CHOICE:
                 $option_object = null;
                 try {
                     switch ($customdatatype->getType()) {
                         case TBGCustomDatatype::EDITIONS_CHOICE:
                             $option_object = TBGContext::factory()->TBGEdition($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::COMPONENTS_CHOICE:
                             $option_object = TBGContext::factory()->TBGComponent($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::RELEASES_CHOICE:
                             $option_object = TBGContext::factory()->TBGBuild($this->getCustomField($key));
                             break;
                         case TBGCustomDatatype::STATUS_CHOICE:
                             $option_object = TBGContext::factory()->TBGStatus($this->getCustomField($key));
                             break;
                     }
                 } catch (Exception $e) {
                 }
                 $option_id = is_object($option_object) ? $option_object->getID() : null;
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldValue($option_id, $customdatatype->getID(), $this->getID());
                 break;
             default:
                 $option_id = $this->getCustomField($key) instanceof TBGCustomDatatypeOption ? $this->getCustomField($key)->getID() : null;
                 TBGIssueCustomFieldsTable::getTable()->saveIssueCustomFieldValue($option_id, $customdatatype->getID(), $this->getID());
                 break;
         }
     }
 }