Merge branch 'feature.issue-links' into develop
This commit is contained in:
commit
00b576c5a3
9
Makefile
9
Makefile
@ -37,6 +37,10 @@ help:
|
|||||||
@printf "\tpo-push - Send the all PO files to the transifex server.\n"
|
@printf "\tpo-push - Send the all PO files to the transifex server.\n"
|
||||||
@printf "\tpo-pull - Get all PO files from the transifex server.\n"
|
@printf "\tpo-pull - Get all PO files from the transifex server.\n"
|
||||||
@printf "\tpo-stats - Show translation statistics of all PO files.\n"
|
@printf "\tpo-stats - Show translation statistics of all PO files.\n"
|
||||||
|
@printf "\nMisc Rules :\n";
|
||||||
|
@printf "\tdb-install - Install the database schema.\n"
|
||||||
|
@printf "\tdb-update - Update the database schema.\n"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Internationalization rule, POT & PO file manipulation
|
# Internationalization rule, POT & PO file manipulation
|
||||||
@ -139,3 +143,8 @@ po-stats:
|
|||||||
> indefero-$(@:-zipfile=)-`git log $(@:-zipfile=) -n 1 \
|
> indefero-$(@:-zipfile=)-`git log $(@:-zipfile=) -n 1 \
|
||||||
--pretty=format:%h`.zip
|
--pretty=format:%h`.zip
|
||||||
|
|
||||||
|
db-install:
|
||||||
|
@cd src && php $(PLUF_PATH)/migrate.php --conf=IDF/conf/idf.php -a -d -i
|
||||||
|
|
||||||
|
db-update:
|
||||||
|
@cd src && php $(PLUF_PATH)/migrate.php --conf=IDF/conf/idf.php -a -d
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
# InDefero 1.2 - xxx xxx xx xx:xx 2011 UTC
|
# InDefero 1.2 - xxx xxx xx xx:xx 2011 UTC
|
||||||
|
|
||||||
|
ATTENTION: You need Pluf [324ae60b](http://projects.ceondo.com/p/pluf/source/commit/324ae60b)
|
||||||
|
or newer to properly run this version of Indefero!
|
||||||
|
|
||||||
## New Features
|
## New Features
|
||||||
|
|
||||||
|
- Indefero's issue tracker can now bi-directionally link issues with variable, configurable
|
||||||
|
terms, such as "is related to", "is blocked by" or "is duplicated by" (issue 638)
|
||||||
- Mercurial source views now show parent revisions (if any) and detailed change information
|
- Mercurial source views now show parent revisions (if any) and detailed change information
|
||||||
- File download URLs now contain the file name rather than the upload id; old links still work though (issues 559 and 686)
|
- File download URLs now contain the file name rather than the upload id; old links still work though (issues 559 and 686)
|
||||||
- Display monotone file and directory attributes in the tree and file view
|
- Display monotone file and directory attributes in the tree and file view
|
||||||
|
@ -319,6 +319,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed,
|
'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed,
|
||||||
'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined,
|
'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined,
|
||||||
'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max,
|
'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max,
|
||||||
|
'issue_relations' => IDF_Form_IssueTrackingConf::init_relations,
|
||||||
'webhook_url' => '',
|
'webhook_url' => '',
|
||||||
'downloads_access_rights' => 'all',
|
'downloads_access_rights' => 'all',
|
||||||
'review_access_rights' => 'all',
|
'review_access_rights' => 'all',
|
||||||
|
@ -36,6 +36,7 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
public $user = null;
|
public $user = null;
|
||||||
public $project = null;
|
public $project = null;
|
||||||
public $show_full = false;
|
public $show_full = false;
|
||||||
|
public $relation_types = null;
|
||||||
|
|
||||||
public function initFields($extra=array())
|
public function initFields($extra=array())
|
||||||
{
|
{
|
||||||
@ -45,9 +46,12 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
or $this->user->hasPerm('IDF.project-member', $this->project)) {
|
or $this->user->hasPerm('IDF.project-member', $this->project)) {
|
||||||
$this->show_full = true;
|
$this->show_full = true;
|
||||||
}
|
}
|
||||||
|
$this->relation_types = $this->project->getRelationsFromConfig();
|
||||||
|
|
||||||
$contentTemplate = $this->project->getConf()->getVal(
|
$contentTemplate = $this->project->getConf()->getVal(
|
||||||
'labels_issue_template', IDF_Form_IssueTrackingConf::init_template
|
'labels_issue_template', IDF_Form_IssueTrackingConf::init_template
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->fields['summary'] = new Pluf_Form_Field_Varchar(
|
$this->fields['summary'] = new Pluf_Form_Field_Varchar(
|
||||||
array('required' => true,
|
array('required' => true,
|
||||||
'label' => __('Summary'),
|
'label' => __('Summary'),
|
||||||
@ -109,6 +113,20 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->fields['relation_type0'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => __('This issue'),
|
||||||
|
'initial' => current($this->relation_types),
|
||||||
|
'widget_attrs' => array('size' => 15),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->fields['relation_issue0'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => null,
|
||||||
|
'initial' => '',
|
||||||
|
'widget_attrs' => array('size' => 10),
|
||||||
|
));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get predefined tags for issues from current project
|
* get predefined tags for issues from current project
|
||||||
*
|
*
|
||||||
@ -235,6 +253,63 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
return $this->cleaned_data['status'];
|
return $this->cleaned_data['status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this method is not called from Pluf_Form directly, but shared for
|
||||||
|
// among all similar fields
|
||||||
|
function clean_relation_type($value)
|
||||||
|
{
|
||||||
|
$relation_type = trim($value);
|
||||||
|
if (empty($relation_type))
|
||||||
|
return '';
|
||||||
|
|
||||||
|
$found = false;
|
||||||
|
foreach ($this->relation_types as $type) {
|
||||||
|
if ($type == $relation_type) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
throw new Pluf_Form_Invalid(__('You provided an invalid relation type.'));
|
||||||
|
}
|
||||||
|
return $relation_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean_relation_type0()
|
||||||
|
{
|
||||||
|
return $this->clean_relation_type($this->cleaned_data['relation_type0']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// this method is not called from Pluf_Form directly, but shared for
|
||||||
|
// among all similar fields
|
||||||
|
function clean_relation_issue($value)
|
||||||
|
{
|
||||||
|
$issues = trim($value);
|
||||||
|
if (empty($issues))
|
||||||
|
return '';
|
||||||
|
|
||||||
|
$issue_ids = preg_split('/\s*,\s*/', $issues, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
foreach ($issue_ids as $issue_id) {
|
||||||
|
if (!ctype_digit($issue_id) || (int)$issue_id < 1) {
|
||||||
|
throw new Pluf_Form_Invalid(sprintf(
|
||||||
|
__('The value "%s" is not a valid issue id.'), $issue_id
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$issue = new IDF_Issue($issue_id);
|
||||||
|
if ($issue->id != $issue_id || $issue->project != $this->project->id) {
|
||||||
|
throw new Pluf_Form_Invalid(sprintf(
|
||||||
|
__('The issue "%s" does not exist.'), $issue_id
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(', ', $issue_ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean_relation_issue0()
|
||||||
|
{
|
||||||
|
return $this->clean_relation_issue($this->cleaned_data['relation_issue0']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean the attachments post failure.
|
* Clean the attachments post failure.
|
||||||
*/
|
*/
|
||||||
@ -298,6 +373,30 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$issue->setAssoc($tag);
|
$issue->setAssoc($tag);
|
||||||
}
|
}
|
||||||
|
// add relations (if any)
|
||||||
|
if (!empty($this->cleaned_data['relation_type0'])) {
|
||||||
|
$verb = $this->cleaned_data['relation_type0'];
|
||||||
|
$other_verb = $this->relation_types[$verb];
|
||||||
|
$related_issues = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue0'], -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
|
foreach ($related_issues as $related_issue_id) {
|
||||||
|
$related_issue = new IDF_Issue($related_issue_id);
|
||||||
|
$rel = new IDF_IssueRelation();
|
||||||
|
$rel->issue = $issue;
|
||||||
|
$rel->verb = $verb;
|
||||||
|
$rel->other_issue = $related_issue;
|
||||||
|
$rel->submitter = $this->user;
|
||||||
|
$rel->create();
|
||||||
|
|
||||||
|
$other_rel = new IDF_IssueRelation();
|
||||||
|
$other_rel->issue = $related_issue;
|
||||||
|
$other_rel->verb = $other_verb;
|
||||||
|
$other_rel->other_issue = $issue;
|
||||||
|
$other_rel->submitter = $this->user;
|
||||||
|
$other_rel->create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add the first comment
|
// add the first comment
|
||||||
$comment = new IDF_IssueComment();
|
$comment = new IDF_IssueComment();
|
||||||
$comment->issue = $issue;
|
$comment->issue = $issue;
|
||||||
|
@ -72,6 +72,23 @@ Performance = Performance issue
|
|||||||
Usability = Affects program usability
|
Usability = Affects program usability
|
||||||
Maintainability = Hinders future changes';
|
Maintainability = Hinders future changes';
|
||||||
const init_one_max = 'Type, Priority, Milestone';
|
const init_one_max = 'Type, Priority, Milestone';
|
||||||
|
// ATTENTION: if you change something here, change the values below as well!
|
||||||
|
const init_relations = 'is related to
|
||||||
|
blocks, is blocked by
|
||||||
|
duplicates, is duplicated by';
|
||||||
|
|
||||||
|
// These are actually all noop's, but we have no other chance to
|
||||||
|
// tell IDF's translation mechanism to mark the strings as translatable
|
||||||
|
// FIXME: IDF should get a internal translation system for strings like
|
||||||
|
// that, that can also be easily expanded by users
|
||||||
|
private function noop()
|
||||||
|
{
|
||||||
|
__('is related to');
|
||||||
|
__('blocks');
|
||||||
|
__('is blocked by');
|
||||||
|
__('duplicates');
|
||||||
|
__('is duplicated by');
|
||||||
|
}
|
||||||
|
|
||||||
public function initFields($extra=array())
|
public function initFields($extra=array())
|
||||||
{
|
{
|
||||||
@ -118,6 +135,15 @@ Maintainability = Hinders future changes';
|
|||||||
'widget_attrs' => array('size' => 60),
|
'widget_attrs' => array('size' => 60),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->fields['issue_relations'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => true,
|
||||||
|
'label' => __('Issue relations'),
|
||||||
|
'initial' => self::init_relations,
|
||||||
|
'help_text' => __('You can define bidirectional relations like "is related to" or "blocks, is blocked by".'),
|
||||||
|
'widget_attrs' => array('rows' => 7,
|
||||||
|
'cols' => 75),
|
||||||
|
'widget' => 'Pluf_Form_Widget_TextareaInput',
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
or $this->user->hasPerm('IDF.project-member', $this->project)) {
|
or $this->user->hasPerm('IDF.project-member', $this->project)) {
|
||||||
$this->show_full = true;
|
$this->show_full = true;
|
||||||
}
|
}
|
||||||
|
$this->relation_types = $this->project->getRelationsFromConfig();
|
||||||
if ($this->show_full) {
|
if ($this->show_full) {
|
||||||
$this->fields['summary'] = new Pluf_Form_Field_Varchar(
|
$this->fields['summary'] = new Pluf_Form_Field_Varchar(
|
||||||
array('required' => true,
|
array('required' => true,
|
||||||
@ -102,6 +103,52 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
'size' => 15,
|
'size' => 15,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$idx = 0;
|
||||||
|
// note: clean_relation_type0 and clean_relation_issue0 already
|
||||||
|
// exist in the base class
|
||||||
|
$this->fields['relation_type'.$idx] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => __('This issue'),
|
||||||
|
'initial' => current($this->relation_types),
|
||||||
|
'widget_attrs' => array('size' => 15),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->fields['relation_issue'.$idx] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => null,
|
||||||
|
'initial' => '',
|
||||||
|
'widget_attrs' => array('size' => 10),
|
||||||
|
));
|
||||||
|
|
||||||
|
++$idx;
|
||||||
|
$relatedIssues = $this->issue->getGroupedRelatedIssues(array(), true);
|
||||||
|
foreach ($relatedIssues as $verb => $ids) {
|
||||||
|
$this->fields['relation_type'.$idx] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => __('This issue'),
|
||||||
|
'initial' => $verb,
|
||||||
|
'widget_attrs' => array('size' => 15),
|
||||||
|
));
|
||||||
|
$m = 'clean_relation_type'.$idx;
|
||||||
|
$this->$m = create_function('$form', '
|
||||||
|
return $form->clean_relation_type($form->cleaned_data["relation_type'.$idx.'"]);
|
||||||
|
');
|
||||||
|
|
||||||
|
$this->fields['relation_issue'.$idx] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => null,
|
||||||
|
'initial' => implode(', ', $ids),
|
||||||
|
'widget_attrs' => array('size' => 10),
|
||||||
|
));
|
||||||
|
$m = 'clean_relation_issue'.$idx;
|
||||||
|
$this->$m = create_function('$form', '
|
||||||
|
return $form->clean_relation_issue($form->cleaned_data["relation_issue'.$idx.'"]);
|
||||||
|
');
|
||||||
|
|
||||||
|
++$idx;
|
||||||
|
}
|
||||||
|
|
||||||
$tags = $this->issue->get_tags_list();
|
$tags = $this->issue->get_tags_list();
|
||||||
for ($i=1;$i<7;$i++) {
|
for ($i=1;$i<7;$i++) {
|
||||||
$initial = '';
|
$initial = '';
|
||||||
@ -155,6 +202,51 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
public function clean()
|
public function clean()
|
||||||
{
|
{
|
||||||
$this->cleaned_data = parent::clean();
|
$this->cleaned_data = parent::clean();
|
||||||
|
|
||||||
|
// normalize the user's input by removing dublettes and by combining
|
||||||
|
// ids from identical verbs in different input fields into one array
|
||||||
|
$normRelatedIssues = array();
|
||||||
|
for ($idx = 0; isset($this->cleaned_data['relation_type'.$idx]); ++$idx) {
|
||||||
|
$verb = $this->cleaned_data['relation_type'.$idx];
|
||||||
|
if (empty($verb))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$ids = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue'.$idx],
|
||||||
|
-1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
if (count($ids) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!array_key_exists($verb, $normRelatedIssues))
|
||||||
|
$normRelatedIssues[$verb] = array();
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
if (!in_array($id, $normRelatedIssues[$verb]))
|
||||||
|
$normRelatedIssues[$verb][] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// now look at any added / removed ids
|
||||||
|
$added = $removed = array();
|
||||||
|
$relatedIssues = $this->issue->getGroupedRelatedIssues(array(), true);
|
||||||
|
$added = array_diff_key($normRelatedIssues, $relatedIssues);
|
||||||
|
$removed = array_diff_key($relatedIssues, $normRelatedIssues);
|
||||||
|
|
||||||
|
$keysToLookAt = array_keys(
|
||||||
|
array_intersect_key($relatedIssues, $normRelatedIssues)
|
||||||
|
);
|
||||||
|
foreach ($keysToLookAt as $key) {
|
||||||
|
$a = array_diff($normRelatedIssues[$key], $relatedIssues[$key]);
|
||||||
|
if (count($a) > 0)
|
||||||
|
$added[$key] = $a;
|
||||||
|
$r = array_diff($relatedIssues[$key], $normRelatedIssues[$key]);
|
||||||
|
if (count($r) > 0)
|
||||||
|
$removed[$key] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache the added / removed data, so we do not have to
|
||||||
|
// calculate that again
|
||||||
|
$this->cleaned_data['_added_issue_relations'] = $added;
|
||||||
|
$this->cleaned_data['_removed_issue_relations'] = $removed;
|
||||||
|
|
||||||
// As soon as we know that at least one change was done, we
|
// As soon as we know that at least one change was done, we
|
||||||
// return the cleaned data and do not go further.
|
// return the cleaned data and do not go further.
|
||||||
if (strlen(trim($this->cleaned_data['content']))) {
|
if (strlen(trim($this->cleaned_data['content']))) {
|
||||||
@ -214,6 +306,11 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
return $this->cleaned_data;
|
return $this->cleaned_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($this->cleaned_data['_added_issue_relations']) != 0 ||
|
||||||
|
count($this->cleaned_data['_removed_issue_relations']) != 0) {
|
||||||
|
return $this->cleaned_data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// no changes!
|
// no changes!
|
||||||
throw new Pluf_Form_Invalid(__('No changes were entered.'));
|
throw new Pluf_Form_Invalid(__('No changes were entered.'));
|
||||||
@ -255,20 +352,22 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (!Pluf_Model_InArray($tag, $oldtags)) {
|
if (!Pluf_Model_InArray($tag, $oldtags)) {
|
||||||
if (!isset($changes['lb'])) $changes['lb'] = array();
|
if (!isset($changes['lb'])) $changes['lb'] = array();
|
||||||
|
if (!isset($changes['lb']['add'])) $changes['lb']['add'] = array();
|
||||||
if ($tag->class != 'Other') {
|
if ($tag->class != 'Other') {
|
||||||
$changes['lb'][] = (string) $tag; //new tag
|
$changes['lb']['add'][] = (string) $tag; //new tag
|
||||||
} else {
|
} else {
|
||||||
$changes['lb'][] = (string) $tag->name;
|
$changes['lb']['add'][] = (string) $tag->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($oldtags as $tag) {
|
foreach ($oldtags as $tag) {
|
||||||
if (!Pluf_Model_InArray($tag, $tags)) {
|
if (!Pluf_Model_InArray($tag, $tags)) {
|
||||||
if (!isset($changes['lb'])) $changes['lb'] = array();
|
if (!isset($changes['lb'])) $changes['lb'] = array();
|
||||||
|
if (!isset($changes['lb']['rem'])) $changes['lb']['rem'] = array();
|
||||||
if ($tag->class != 'Other') {
|
if ($tag->class != 'Other') {
|
||||||
$changes['lb'][] = '-'.(string) $tag; //new tag
|
$changes['lb']['rem'][] = (string) $tag; //new tag
|
||||||
} else {
|
} else {
|
||||||
$changes['lb'][] = '-'.(string) $tag->name;
|
$changes['lb']['rem'][] = (string) $tag->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,6 +385,47 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
or ((!is_null($owner) and !is_null($this->issue->get_owner())) and $owner->id != $this->issue->get_owner()->id)) {
|
or ((!is_null($owner) and !is_null($this->issue->get_owner())) and $owner->id != $this->issue->get_owner()->id)) {
|
||||||
$changes['ow'] = (is_null($owner)) ? '---' : $owner->login;
|
$changes['ow'] = (is_null($owner)) ? '---' : $owner->login;
|
||||||
}
|
}
|
||||||
|
// Issue relations - additions
|
||||||
|
foreach ($this->cleaned_data['_added_issue_relations'] as $verb => $ids) {
|
||||||
|
$other_verb = $this->relation_types[$verb];
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$related_issue = new IDF_Issue($id);
|
||||||
|
$rel = new IDF_IssueRelation();
|
||||||
|
$rel->issue = $this->issue;
|
||||||
|
$rel->verb = $verb;
|
||||||
|
$rel->other_issue = $related_issue;
|
||||||
|
$rel->submitter = $this->user;
|
||||||
|
$rel->create();
|
||||||
|
|
||||||
|
$other_rel = new IDF_IssueRelation();
|
||||||
|
$other_rel->issue = $related_issue;
|
||||||
|
$other_rel->verb = $other_verb;
|
||||||
|
$other_rel->other_issue = $this->issue;
|
||||||
|
$other_rel->submitter = $this->user;
|
||||||
|
$other_rel->create();
|
||||||
|
}
|
||||||
|
if (!isset($changes['rel'])) $changes['rel'] = array();
|
||||||
|
if (!isset($changes['rel']['add'])) $changes['rel']['add'] = array();
|
||||||
|
$changes['rel']['add'][] = $verb.' '.implode(', ', $ids);
|
||||||
|
}
|
||||||
|
// Issue relations - removals
|
||||||
|
foreach ($this->cleaned_data['_removed_issue_relations'] as $verb => $ids) {
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$db = &Pluf::db();
|
||||||
|
$table = Pluf::factory('IDF_IssueRelation')->getSqlTable();
|
||||||
|
$sql = new Pluf_SQL('verb=%s AND (
|
||||||
|
(issue=%s AND other_issue=%s) OR
|
||||||
|
(other_issue=%s AND issue=%s))',
|
||||||
|
array($verb,
|
||||||
|
$this->issue->id, $id,
|
||||||
|
$this->issue->id, $id));
|
||||||
|
$db->execute('DELETE FROM '.$table.' WHERE '.$sql->gen());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($changes['rel'])) $changes['rel'] = array();
|
||||||
|
if (!isset($changes['rel']['rem'])) $changes['rel']['rem'] = array();
|
||||||
|
$changes['rel']['rem'][] = $verb.' '.implode(', ', $ids);
|
||||||
|
}
|
||||||
// Update the issue
|
// Update the issue
|
||||||
$this->issue->batchAssoc('IDF_Tag', $tagids);
|
$this->issue->batchAssoc('IDF_Tag', $tagids);
|
||||||
$this->issue->summary = trim($this->cleaned_data['summary']);
|
$this->issue->summary = trim($this->cleaned_data['summary']);
|
||||||
|
@ -169,6 +169,24 @@ class IDF_Issue extends Pluf_Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGroupedRelatedIssues($opts = array(), $idsOnly = false)
|
||||||
|
{
|
||||||
|
$rels = $this->get_related_issues_list(array_merge($opts, array(
|
||||||
|
'view' => 'with_other_issue',
|
||||||
|
)));
|
||||||
|
|
||||||
|
$res = array();
|
||||||
|
foreach ($rels as $rel) {
|
||||||
|
$verb = $rel->verb;
|
||||||
|
if (!array_key_exists($verb, $res)) {
|
||||||
|
$res[$verb] = array();
|
||||||
|
}
|
||||||
|
$res[$verb][] = $idsOnly ? $rel->other_issue : $rel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an HTML fragment used to display this issue in the
|
* Returns an HTML fragment used to display this issue in the
|
||||||
* timeline.
|
* timeline.
|
||||||
|
@ -155,10 +155,19 @@ class IDF_IssueComment extends Pluf_Model
|
|||||||
$out .= __('Owner:'); break;
|
$out .= __('Owner:'); break;
|
||||||
case 'lb':
|
case 'lb':
|
||||||
$out .= __('Labels:'); break;
|
$out .= __('Labels:'); break;
|
||||||
|
case 'rel':
|
||||||
|
$out .= __('Relations:'); break;
|
||||||
}
|
}
|
||||||
$out .= '</strong> ';
|
$out .= '</strong> ';
|
||||||
if ($w == 'lb') {
|
if ($w == 'lb' || $w == 'rel') {
|
||||||
$out .= Pluf_esc(implode(', ', $v));
|
foreach ($v as $t => $ls) {
|
||||||
|
foreach ($ls as $l) {
|
||||||
|
if ($t == 'rem') $out .= '<s>';
|
||||||
|
$out .= Pluf_esc($l);
|
||||||
|
if ($t == 'rem') $out .= '</s>';
|
||||||
|
$out .= ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$out .= Pluf_esc($v);
|
$out .= Pluf_esc($v);
|
||||||
}
|
}
|
||||||
|
100
src/IDF/IssueRelation.php
Normal file
100
src/IDF/IssueRelation.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# This file is part of InDefero, an open source project management application.
|
||||||
|
# Copyright (C) 2008-2011 Céondo Ltd and contributors.
|
||||||
|
#
|
||||||
|
# InDefero is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# InDefero is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A relation of one issue to another
|
||||||
|
*/
|
||||||
|
class IDF_IssueRelation extends Pluf_Model
|
||||||
|
{
|
||||||
|
public $_model = __CLASS__;
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->_a['table'] = 'idf_issuerelations';
|
||||||
|
$this->_a['model'] = __CLASS__;
|
||||||
|
$this->_a['cols'] = array(
|
||||||
|
// It is mandatory to have an "id" column.
|
||||||
|
'id' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
|
'blank' => true,
|
||||||
|
),
|
||||||
|
'issue' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
|
'model' => 'IDF_Issue',
|
||||||
|
'blank' => false,
|
||||||
|
'verbose' => __('issue'),
|
||||||
|
'relate_name' => 'related_issues',
|
||||||
|
),
|
||||||
|
'verb' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Text',
|
||||||
|
'blank' => false,
|
||||||
|
'verbose' => __('verb'),
|
||||||
|
),
|
||||||
|
'other_issue' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
|
'model' => 'IDF_Issue',
|
||||||
|
'blank' => false,
|
||||||
|
'verbose' => __('other issue'),
|
||||||
|
'relate_name' => 'related_other_issues',
|
||||||
|
),
|
||||||
|
'submitter' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
|
'model' => 'Pluf_User',
|
||||||
|
'blank' => false,
|
||||||
|
'verbose' => __('submitter'),
|
||||||
|
),
|
||||||
|
'creation_dtime' =>
|
||||||
|
array(
|
||||||
|
'type' => 'Pluf_DB_Field_Datetime',
|
||||||
|
'blank' => true,
|
||||||
|
'verbose' => __('creation date'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$this->_a['idx'] = array(
|
||||||
|
'creation_dtime_idx' =>
|
||||||
|
array(
|
||||||
|
'col' => 'creation_dtime',
|
||||||
|
'type' => 'normal',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$issuetbl = $this->_con->pfx.'idf_issues';
|
||||||
|
$this->_a['views'] = array(
|
||||||
|
'with_other_issue' => array(
|
||||||
|
'join' => 'INNER JOIN '.$issuetbl.' ON other_issue='.$issuetbl.'.id',
|
||||||
|
'select' => $this->getSelect().', summary',
|
||||||
|
'props' => array('summary' => 'other_summary'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function preSave($create=false)
|
||||||
|
{
|
||||||
|
if ($this->id == '') {
|
||||||
|
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
90
src/IDF/Migrations/17AddIssueRelations.php
Normal file
90
src/IDF/Migrations/17AddIssueRelations.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# This file is part of InDefero, an open source project management application.
|
||||||
|
# Copyright (C) 2008-2011 Céondo Ltd and contributors.
|
||||||
|
#
|
||||||
|
# InDefero is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# InDefero is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the new IDF_IssueRelation model.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function IDF_Migrations_17AddIssueRelations_up($params=null)
|
||||||
|
{
|
||||||
|
$db = Pluf::db();
|
||||||
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
$schema->model = new IDF_IssueRelation();
|
||||||
|
$schema->createTables();
|
||||||
|
|
||||||
|
// change the serialization format for added / removed labels in IDF_IssueComment
|
||||||
|
$comments = Pluf::factory('IDF_IssueComment')->getList();
|
||||||
|
foreach ($comments as $comment) {
|
||||||
|
if (!isset($comment->changes['lb'])) continue;
|
||||||
|
$changes = $comment->changes;
|
||||||
|
$adds = $removals = array();
|
||||||
|
foreach ($comment->changes['lb'] as $lb) {
|
||||||
|
if (substr($lb, 0, 1) == '-')
|
||||||
|
$removals[] = substr($lb, 1);
|
||||||
|
else
|
||||||
|
$adds[] = $lb;
|
||||||
|
}
|
||||||
|
$changes['lb'] = array();
|
||||||
|
if (count($adds) > 0)
|
||||||
|
$changes['lb']['add'] = $adds;
|
||||||
|
if (count($removals) > 0)
|
||||||
|
$changes['lb']['rem'] = $removals;
|
||||||
|
$comment->changes = $changes;
|
||||||
|
$comment->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function IDF_Migrations_17AddIssueRelations_down($params=null)
|
||||||
|
{
|
||||||
|
$db = Pluf::db();
|
||||||
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
$schema->model = new IDF_IssueRelation();
|
||||||
|
$schema->dropTables();
|
||||||
|
|
||||||
|
// change the serialization format for added / removed labels in IDF_IssueComment
|
||||||
|
$comments = Pluf::factory('IDF_IssueComment')->getList();
|
||||||
|
foreach ($comments as $comment) {
|
||||||
|
$changes = $comment->changes;
|
||||||
|
if (empty($changes))
|
||||||
|
continue;
|
||||||
|
if (isset($changes['lb'])) {
|
||||||
|
$labels = array();
|
||||||
|
foreach ($changes['lb'] as $type => $lbs) {
|
||||||
|
if (!is_array($lbs)) {
|
||||||
|
$labels[] = $lbs;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($lbs as $lb) {
|
||||||
|
$labels[] = ($type == 'rem' ? '-' : '') . $lb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$changes['lb'] = $labels;
|
||||||
|
}
|
||||||
|
// while we're at it, remove any 'rel' changes
|
||||||
|
unset($changes['rel']);
|
||||||
|
$comment->changes = $changes;
|
||||||
|
$comment->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -54,6 +54,7 @@ function IDF_Migrations_Backup_run($folder, $name=null)
|
|||||||
'IDF_Queue',
|
'IDF_Queue',
|
||||||
'IDF_Gconf',
|
'IDF_Gconf',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
|
'IDF_IssueRelation',
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
// Now, for each table, we dump the content in json, this is a
|
// Now, for each table, we dump the content in json, this is a
|
||||||
@ -100,6 +101,7 @@ function IDF_Migrations_Backup_restore($folder, $name)
|
|||||||
'IDF_Queue',
|
'IDF_Queue',
|
||||||
'IDF_Gconf',
|
'IDF_Gconf',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
|
'IDF_IssueRelation',
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
$schema = new Pluf_DB_Schema($db);
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
@ -51,6 +51,7 @@ function IDF_Migrations_Install_setup($params=null)
|
|||||||
'IDF_Queue',
|
'IDF_Queue',
|
||||||
'IDF_Gconf',
|
'IDF_Gconf',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
|
'IDF_IssueRelation',
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
$schema = new Pluf_DB_Schema($db);
|
$schema = new Pluf_DB_Schema($db);
|
||||||
@ -109,6 +110,7 @@ function IDF_Migrations_Install_teardown($params=null)
|
|||||||
'IDF_Commit',
|
'IDF_Commit',
|
||||||
'IDF_Project',
|
'IDF_Project',
|
||||||
'IDF_EmailAddress',
|
'IDF_EmailAddress',
|
||||||
|
'IDF_IssueRelation',
|
||||||
);
|
);
|
||||||
$db = Pluf::db();
|
$db = Pluf::db();
|
||||||
$schema = new Pluf_DB_Schema($db);
|
$schema = new Pluf_DB_Schema($db);
|
||||||
|
@ -233,6 +233,29 @@ class IDF_Project extends Pluf_Model
|
|||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of relations which are available in this project as
|
||||||
|
* associative array. Each key-value pair marks a set of orthogonal
|
||||||
|
* relations. To ease processing, each of these pairs is included twice
|
||||||
|
* in the array, once as key1 => key2 and once as key2 => key1.
|
||||||
|
*
|
||||||
|
* @return array List of relation names
|
||||||
|
*/
|
||||||
|
public function getRelationsFromConfig()
|
||||||
|
{
|
||||||
|
$conf = $this->getConf();
|
||||||
|
$rel = $conf->getVal('issue_relations', IDF_Form_IssueTrackingConf::init_relations);
|
||||||
|
$relations = array();
|
||||||
|
foreach (preg_split("/\015\012|\015|\012/", $rel, -1, PREG_SPLIT_NO_EMPTY) as $s) {
|
||||||
|
$verbs = preg_split("/\s*,\s*/", $s, 2);
|
||||||
|
if (count($verbs) == 1)
|
||||||
|
$relations += array($verbs[0] => $verbs[0]);
|
||||||
|
else
|
||||||
|
$relations += array($verbs[0] => $verbs[1], $verbs[1] => $verbs[0]);
|
||||||
|
}
|
||||||
|
return $relations;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return membership data.
|
* Return membership data.
|
||||||
*
|
*
|
||||||
|
@ -345,6 +345,7 @@ class IDF_Views_Issue
|
|||||||
'form' => $form,
|
'form' => $form,
|
||||||
'page_title' => $title,
|
'page_title' => $title,
|
||||||
'preview' => $preview,
|
'preview' => $preview,
|
||||||
|
'issue' => new IDF_Issue(),
|
||||||
),
|
),
|
||||||
self::autoCompleteArrays($prj)
|
self::autoCompleteArrays($prj)
|
||||||
);
|
);
|
||||||
@ -403,6 +404,8 @@ class IDF_Views_Issue
|
|||||||
$issue = Pluf_Shortcuts_GetObjectOr404('IDF_Issue', $match[2]);
|
$issue = Pluf_Shortcuts_GetObjectOr404('IDF_Issue', $match[2]);
|
||||||
$prj->inOr404($issue);
|
$prj->inOr404($issue);
|
||||||
$comments = $issue->get_comments_list(array('order' => 'id ASC'));
|
$comments = $issue->get_comments_list(array('order' => 'id ASC'));
|
||||||
|
$related_issues = $issue->getGroupedRelatedIssues(array('order' => 'other_issue ASC'));
|
||||||
|
|
||||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||||
array($prj->shortname, $issue->id));
|
array($prj->shortname, $issue->id));
|
||||||
$title = Pluf_Template::markSafe(sprintf(__('Issue <a href="%s">%d</a>: %s'), $url, $issue->id, $issue->summary));
|
$title = Pluf_Template::markSafe(sprintf(__('Issue <a href="%s">%d</a>: %s'), $url, $issue->id, $issue->summary));
|
||||||
@ -470,7 +473,8 @@ class IDF_Views_Issue
|
|||||||
'preview' => $preview,
|
'preview' => $preview,
|
||||||
'interested' => $interested->count(),
|
'interested' => $interested->count(),
|
||||||
'previous_issue_id' => $previous_issue_id,
|
'previous_issue_id' => $previous_issue_id,
|
||||||
'next_issue_id' => $next_issue_id
|
'next_issue_id' => $next_issue_id,
|
||||||
|
'related_issues' => $related_issues,
|
||||||
),
|
),
|
||||||
$arrays),
|
$arrays),
|
||||||
$request);
|
$request);
|
||||||
@ -643,6 +647,73 @@ class IDF_Views_Issue
|
|||||||
$request);
|
$request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a JSON string containing completed issue information
|
||||||
|
* based on the queried / partial string
|
||||||
|
*/
|
||||||
|
public $autoCompleteIssueList_precond = array('IDF_Precondition::accessIssues');
|
||||||
|
public function autoCompleteIssueList($request, $match)
|
||||||
|
{
|
||||||
|
$prj = $request->project;
|
||||||
|
$issue_id = !empty($match[2]) ? intval($match[2]) : 0;
|
||||||
|
$query = trim($request->REQUEST['q']);
|
||||||
|
$limit = !empty($request->REQUEST['limit']) ? intval($request->REQUEST['limit']) : 0;
|
||||||
|
$limit = max(10, $limit);
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
// empty search, return the most recently updated issues
|
||||||
|
if (empty($query)) {
|
||||||
|
$sql = new Pluf_SQL('project=%s', array($prj->id));
|
||||||
|
$tmp = Pluf::factory('IDF_Issue')->getList(array(
|
||||||
|
'filter' => $sql->gen(),
|
||||||
|
'order' => 'modif_dtime DESC'
|
||||||
|
));
|
||||||
|
$issues += $tmp->getArrayCopy();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// ID-based search
|
||||||
|
if (is_numeric($query)) {
|
||||||
|
$sql = new Pluf_SQL('project=%s AND id LIKE %s', array($prj->id, $query.'%'));
|
||||||
|
$tmp = Pluf::factory('IDF_Issue')->getList(array(
|
||||||
|
'filter' => $sql->gen(),
|
||||||
|
'order' => 'id ASC'
|
||||||
|
));
|
||||||
|
$issues += $tmp->getArrayCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// text-based search
|
||||||
|
$res = new Pluf_Search_ResultSet(
|
||||||
|
IDF_Search::mySearch($query, $prj, 'IDF_Issue')
|
||||||
|
);
|
||||||
|
foreach ($res as $issue)
|
||||||
|
$issues[] = $issue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Autocomplete from jQuery UI works with JSON, this old one still
|
||||||
|
// expects a parsable string; since we'd need to bump jQuery beyond
|
||||||
|
// 1.2.6 for this to use as well, we're trying to cope with the old format.
|
||||||
|
// see http://www.learningjquery.com/2010/06/autocomplete-migration-guide
|
||||||
|
$out = '';
|
||||||
|
$ids = array();
|
||||||
|
foreach ($issues as $issue)
|
||||||
|
{
|
||||||
|
if ($issue->id == $issue_id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (in_array($issue->id, $ids))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (--$limit < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
$out .= str_replace('|', '|', $issue->summary) .'|'.$issue->id."\n";
|
||||||
|
$ids[] = $issue->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Pluf_HTTP_Response($out);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Star/Unstar an issue.
|
* Star/Unstar an issue.
|
||||||
*/
|
*/
|
||||||
@ -715,6 +786,15 @@ class IDF_Views_Issue
|
|||||||
}
|
}
|
||||||
$auto['auto_owner'] = substr($auto['auto_owner'], 0, -2);
|
$auto['auto_owner'] = substr($auto['auto_owner'], 0, -2);
|
||||||
unset($auto['_auto_owner']);
|
unset($auto['_auto_owner']);
|
||||||
|
// Get issue relations
|
||||||
|
$r = $project->getRelationsFromConfig();
|
||||||
|
$auto['auto_relation_types'] = '';
|
||||||
|
foreach ($r as $rt) {
|
||||||
|
$esc = Pluf_esc($rt);
|
||||||
|
$auto['auto_relation_types'] .= sprintf('{ name: "%s", to: "%s" }, ',
|
||||||
|
$esc, $esc);
|
||||||
|
}
|
||||||
|
$auto['auto_relation_types'] = substr($auto['auto_relation_types'], 0, -2);
|
||||||
return $auto;
|
return $auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,8 @@ class IDF_Views_Project
|
|||||||
$params = array();
|
$params = array();
|
||||||
$keys = array('labels_issue_template',
|
$keys = array('labels_issue_template',
|
||||||
'labels_issue_open', 'labels_issue_closed',
|
'labels_issue_open', 'labels_issue_closed',
|
||||||
'labels_issue_predefined', 'labels_issue_one_max');
|
'labels_issue_predefined', 'labels_issue_one_max',
|
||||||
|
'issue_relations');
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$_val = $conf->getVal($key, false);
|
$_val = $conf->getVal($key, false);
|
||||||
if ($_val !== false) {
|
if ($_val !== false) {
|
||||||
|
@ -173,6 +173,11 @@ $ctl[] = array('regex' => '#^/watchlist/(\w+)$#',
|
|||||||
'model' => 'IDF_Views_Issue',
|
'model' => 'IDF_Views_Issue',
|
||||||
'method' => 'forgeWatchList');
|
'method' => 'forgeWatchList');
|
||||||
|
|
||||||
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/autocomplete/(\d*)$#',
|
||||||
|
'base' => $base,
|
||||||
|
'model' => 'IDF_Views_Issue',
|
||||||
|
'method' => 'autoCompleteIssueList');
|
||||||
|
|
||||||
// ---------- SCM ----------------------------------------
|
// ---------- SCM ----------------------------------------
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#',
|
||||||
|
@ -45,6 +45,7 @@ $m['IDF_Scm_Cache_Git'] = array('relate_to' => array('IDF_Project'));
|
|||||||
|
|
||||||
$m['IDF_UserData'] = array('relate_to' => array('Pluf_User'));
|
$m['IDF_UserData'] = array('relate_to' => array('Pluf_User'));
|
||||||
$m['IDF_EmailAddress'] = array('relate_to' => array('Pluf_User'));
|
$m['IDF_EmailAddress'] = array('relate_to' => array('Pluf_User'));
|
||||||
|
$m['IDF_IssueRelation'] = array('relate_to' => array('IDF_Issue', 'Pluf_User'));
|
||||||
|
|
||||||
Pluf_Signal::connect('Pluf_Template_Compiler::construct_template_tags_modifiers',
|
Pluf_Signal::connect('Pluf_Template_Compiler::construct_template_tags_modifiers',
|
||||||
array('IDF_Middleware', 'updateTemplateTagsModifiers'));
|
array('IDF_Middleware', 'updateTemplateTagsModifiers'));
|
||||||
|
@ -35,6 +35,13 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td colspan="2"><strong>{$form.f.issue_relations.labelTag}:</strong><br />
|
||||||
|
{if $form.f.issue_relations.errors}{$form.f.issue_relations.fieldErrors}{/if}
|
||||||
|
{$form.f.issue_relations|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.issue_relations.help_text}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
|
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
|
||||||
</td>
|
</td>
|
||||||
|
@ -63,6 +63,15 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>{$form.f.relation_type0.labelTag}:</th>
|
||||||
|
<td>
|
||||||
|
{if $form.f.relation_type0.errors}{$form.f.relation_type0.fieldErrors}{/if}
|
||||||
|
{if $form.f.relation_issue0.errors}{$form.f.relation_issue0.fieldErrors}{/if}
|
||||||
|
{$form.f.relation_type0|unsafe}
|
||||||
|
{$form.f.relation_issue0|unsafe}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<th>{$form.f.label1.labelTag}:</th>
|
<th>{$form.f.label1.labelTag}:</th>
|
||||||
<td>
|
<td>
|
||||||
{if $form.f.label1.errors}{$form.f.label1.fieldErrors}{/if}{$form.f.label1|unsafe}
|
{if $form.f.label1.errors}{$form.f.label1.fieldErrors}{/if}{$form.f.label1|unsafe}
|
||||||
@ -123,11 +132,11 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
var j=0;
|
var j=0;
|
||||||
for (j=1;j<4;j=j+1) {
|
for (j=1;j<4;j=j+1) {
|
||||||
if($("tr#form-attachment-"+j+" > td > ul.errorlist").length == 0){
|
if($("tr#form-attachment-"+j+" > td > ul.errorlist").length == 0){
|
||||||
$("#form-attachment-"+j).hide();
|
$("#form-attachment-"+j).hide();
|
||||||
}else{
|
}else{
|
||||||
$("#form-block-"+(j-1)).remove();
|
$("#form-block-"+(j-1)).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -7,49 +7,83 @@
|
|||||||
var auto_labels = [{/literal}{$auto_labels|safe}{literal}];
|
var auto_labels = [{/literal}{$auto_labels|safe}{literal}];
|
||||||
var auto_status = [{/literal}{$auto_status|safe}{literal}];
|
var auto_status = [{/literal}{$auto_status|safe}{literal}];
|
||||||
var auto_owner = [{/literal}{$auto_owner|safe}{literal}];
|
var auto_owner = [{/literal}{$auto_owner|safe}{literal}];
|
||||||
|
var auto_relation_types = [{/literal}{$auto_relation_types|safe}{literal}];
|
||||||
|
|
||||||
var j=0;
|
var j=0;
|
||||||
for (j=1;j<7;j=j+1) {
|
for (j=1;j<7;j=j+1) {
|
||||||
$("#id_label"+j).autocomplete(auto_labels, {
|
$("#id_label"+j).autocomplete(auto_labels, {
|
||||||
minChars: 0,
|
minChars: 0,
|
||||||
width: 310,
|
width: 310,
|
||||||
matchContains: true,
|
matchContains: true,
|
||||||
max: 50,
|
max: 50,
|
||||||
highlightItem: false,
|
highlightItem: false,
|
||||||
formatItem: function(row, i, max, term) {
|
formatItem: function(row, i, max, term) {
|
||||||
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
||||||
},
|
},
|
||||||
formatResult: function(row) {
|
formatResult: function(row) {
|
||||||
return row.to;
|
return row.to;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$("#id_status").autocomplete(auto_status, {
|
$("#id_status").autocomplete(auto_status, {
|
||||||
minChars: 0,
|
minChars: 0,
|
||||||
width: 310,
|
width: 310,
|
||||||
matchContains: true,
|
matchContains: true,
|
||||||
max: 50,
|
max: 50,
|
||||||
highlightItem: false,
|
highlightItem: false,
|
||||||
formatItem: function(row, i, max, term) {
|
formatItem: function(row, i, max, term) {
|
||||||
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
||||||
},
|
},
|
||||||
formatResult: function(row) {
|
formatResult: function(row) {
|
||||||
return row.to;
|
return row.to;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#id_owner").autocomplete(auto_owner, {
|
$("#id_owner").autocomplete(auto_owner, {
|
||||||
minChars: 0,
|
minChars: 0,
|
||||||
width: 310,
|
width: 310,
|
||||||
matchContains: true,
|
matchContains: true,
|
||||||
max: 50,
|
max: 50,
|
||||||
highlightItem: false,
|
highlightItem: false,
|
||||||
formatItem: function(row, i, max, term) {
|
formatItem: function(row, i, max, term) {
|
||||||
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
||||||
},
|
},
|
||||||
formatResult: function(row) {
|
formatResult: function(row) {
|
||||||
return row.to;
|
return row.to;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
for (var idx = 0; ; ++idx) {
|
||||||
|
if ($("#id_relation_type" + idx).length == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
$("#id_relation_type" + idx).autocomplete(auto_relation_types, {
|
||||||
|
minChars: 0,
|
||||||
|
width: 310,
|
||||||
|
matchContains: true,
|
||||||
|
max: 50,
|
||||||
|
highlightItem: false,
|
||||||
|
formatItem: function(row, i, max, term) {
|
||||||
|
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
|
||||||
|
},
|
||||||
|
formatResult: function(row) {
|
||||||
|
return row.to;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#id_relation_issue" + idx).autocomplete("{/literal}{url 'IDF_Views_Issue::autoCompleteIssueList', array($project.shortname, $issue.id)}{literal}", {
|
||||||
|
minChars: 0,
|
||||||
|
width: 310,
|
||||||
|
matchContains: true,
|
||||||
|
max: 10,
|
||||||
|
multiple: true,
|
||||||
|
delay: 500,
|
||||||
|
highlightItem: false,
|
||||||
|
formatItem: function(row, i, max, term) {
|
||||||
|
return row[1].replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row[0] + "</span>";
|
||||||
|
},
|
||||||
|
formatResult: function(row) {
|
||||||
|
return row[1];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
{/literal} //-->
|
{/literal} //-->
|
||||||
</script>
|
</script>
|
||||||
|
@ -40,7 +40,16 @@
|
|||||||
{if $i> 0 and $c.changedIssue()}
|
{if $i> 0 and $c.changedIssue()}
|
||||||
<div class="issue-changes">
|
<div class="issue-changes">
|
||||||
{foreach $c.changes as $w => $v}
|
{foreach $c.changes as $w => $v}
|
||||||
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}</strong> {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}<br />
|
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}{if $w == 'rel'}{trans 'Relations:'}{/if}</strong>
|
||||||
|
{if $w == 'lb' or $w == 'rel'}
|
||||||
|
{foreach $v as $t => $ls}
|
||||||
|
{foreach $ls as $l}
|
||||||
|
{if $t == 'rem'}<s>{/if}{$l}{if $t == 'rem'}</s>{/if}
|
||||||
|
{/foreach}
|
||||||
|
{/foreach}
|
||||||
|
{else}
|
||||||
|
{$v}
|
||||||
|
{/if}<br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -120,6 +129,23 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>{$form.f.relation_type0.labelTag}:</th>
|
||||||
|
<td>
|
||||||
|
{assign $prevField}
|
||||||
|
{foreach $form as $field}
|
||||||
|
{if strpos($field.name, 'relation_type') === 0}
|
||||||
|
{$field|unsafe}
|
||||||
|
{assign $prevField = $field}
|
||||||
|
{/if}
|
||||||
|
{if strpos($field.name, 'relation_issue') === 0}
|
||||||
|
{$field|unsafe}<br />
|
||||||
|
{if $prevField.errors}{$prevField.fieldErrors}{/if}
|
||||||
|
{if $field.errors}{$field.fieldErrors}{/if}
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<th>{$form.f.label1.labelTag}:</th>
|
<th>{$form.f.label1.labelTag}:</th>
|
||||||
<td>
|
<td>
|
||||||
{if $form.f.label1.errors}{$form.f.label1.fieldErrors}{/if}{$form.f.label1|unsafe}
|
{if $form.f.label1.errors}{$form.f.label1.fieldErrors}{/if}{$form.f.label1|unsafe}
|
||||||
@ -161,6 +187,21 @@
|
|||||||
<span class="label"><a href="{$url}" class="label"><strong>{$tag.class}:</strong>{$tag.name}</a></span><br />
|
<span class="label"><a href="{$url}" class="label"><strong>{$tag.class}:</strong>{$tag.name}</a></span><br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</p>{/if}
|
</p>{/if}
|
||||||
|
{if count($related_issues) > 0}
|
||||||
|
{foreach $related_issues as $verb => $rel_issues}
|
||||||
|
<p>
|
||||||
|
<strong>{blocktrans}This issue {$verb}{/blocktrans}</strong><br />
|
||||||
|
{foreach $rel_issues as $rel_issue}
|
||||||
|
<span class="label">
|
||||||
|
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $rel_issue.other_issue)}"
|
||||||
|
class="label" title="{$rel_issue.other_summary}">
|
||||||
|
<strong>{$rel_issue.other_issue}</strong> - {$rel_issue.other_summary|shorten:30}
|
||||||
|
</a>
|
||||||
|
</span><br />
|
||||||
|
{/foreach}
|
||||||
|
</p>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
{block javascript}{if $form}{include 'idf/issues/js-autocomplete.html'}
|
{block javascript}{if $form}{include 'idf/issues/js-autocomplete.html'}
|
||||||
|
Loading…
Reference in New Issue
Block a user