diff --git a/src/IDF/Form/IssueCreate.php b/src/IDF/Form/IssueCreate.php index 3c38e7b..514be54 100644 --- a/src/IDF/Form/IssueCreate.php +++ b/src/IDF/Form/IssueCreate.php @@ -108,14 +108,39 @@ class IDF_Form_IssueCreate extends Pluf_Form 'size' => 15, ), )); + + /* + * get predefined tags for issues from current project + * + * first Type:<...> and Priority:<...> will be used + * + */ + $predefined = preg_split("/[\r\n]+/", $extra['project']->getConf()->getVal( + 'labels_issue_predefined' + )); + $predefined_type = 'Type:Defect'; + foreach ($predefined as $tag) { + if (strpos($tag, 'Type:') === 0) { + $predefined_type = $tag; + break; + } + } + $predefined_priority = 'Priority:Medium'; + foreach ($predefined as $tag) { + if (strpos($tag, 'Priority:') === 0) { + $predefined_priority = $tag; + break; + } + } + for ($i=1;$i<7;$i++) { $initial = ''; switch ($i) { case 1: - $initial = 'Type:Defect'; + $initial = $predefined_type; break; case 2: - $initial = 'Priority:Medium'; + $initial = $predefined_priority; break; } $this->fields['label'.$i] = new Pluf_Form_Field_Varchar( diff --git a/src/IDF/Form/IssueTrackingConf.php b/src/IDF/Form/IssueTrackingConf.php index 0aa4f59..cb0d17b 100644 --- a/src/IDF/Form/IssueTrackingConf.php +++ b/src/IDF/Form/IssueTrackingConf.php @@ -105,6 +105,7 @@ Maintainability = Hinders future changes'; array('required' => true, 'label' => __('Predefined issue labels'), 'initial' => self::init_predefined, + 'help_text' => __('The first "Type:" and "Priority:" entries found in this list are automatically chosen as defaults for new issues.'), 'widget_attrs' => array('rows' => 7, 'cols' => 75), 'widget' => 'Pluf_Form_Widget_TextareaInput', diff --git a/src/IDF/templates/idf/admin/issue-tracking.html b/src/IDF/templates/idf/admin/issue-tracking.html index fb5766c..057b3c7 100644 --- a/src/IDF/templates/idf/admin/issue-tracking.html +++ b/src/IDF/templates/idf/admin/issue-tracking.html @@ -24,7 +24,8 @@ {$form.f.labels_issue_predefined.labelTag}:
{if $form.f.labels_issue_predefined.errors}{$form.f.labels_issue_predefined.fieldErrors}{/if} -{$form.f.labels_issue_predefined|unsafe} +{$form.f.labels_issue_predefined|unsafe}
+{$form.f.labels_issue_predefined.help_text}