Start with issue 638 (issue links); nothing workable yet.
This commit is contained in:
parent
be4774c95c
commit
9171bfd1ab
@ -319,6 +319,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
||||
'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed,
|
||||
'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined,
|
||||
'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max,
|
||||
'issue_relations' => IDF_Form_IssueTrackingConf::init_relations,
|
||||
'webhook_url' => '',
|
||||
'downloads_access_rights' => 'all',
|
||||
'review_access_rights' => 'all',
|
||||
|
@ -109,6 +109,21 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
||||
),
|
||||
));
|
||||
|
||||
$relation_types = $extra['project']->getRelationsFromConfig();
|
||||
$this->fields['relation_type'] = new Pluf_Form_Field_Varchar(
|
||||
array('required' => false,
|
||||
'label' => __('This issue'),
|
||||
'initial' => $relation_types[0],
|
||||
'widget_attrs' => array('size' => 15),
|
||||
));
|
||||
|
||||
$this->fields['relation_issue'] = new Pluf_Form_Field_Varchar(
|
||||
array('required' => false,
|
||||
'label' => null,
|
||||
'initial' => '',
|
||||
'widget_attrs' => array('size' => 10),
|
||||
));
|
||||
|
||||
/*
|
||||
* get predefined tags for issues from current project
|
||||
*
|
||||
|
@ -72,6 +72,9 @@ Performance = Performance issue
|
||||
Usability = Affects program usability
|
||||
Maintainability = Hinders future changes';
|
||||
const init_one_max = 'Type, Priority, Milestone';
|
||||
const init_relations = 'is related to
|
||||
blocks, is blocked by
|
||||
duplicates, is duplicated by';
|
||||
|
||||
public function initFields($extra=array())
|
||||
{
|
||||
@ -118,6 +121,15 @@ Maintainability = Hinders future changes';
|
||||
'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',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,6 +233,22 @@ class IDF_Project extends Pluf_Model
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of relations which are available in this project
|
||||
*
|
||||
* @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) {
|
||||
$relations = array_merge($relations, preg_split("/\s*,\s*/", $s, 2));
|
||||
}
|
||||
return $relations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return membership data.
|
||||
*
|
||||
|
@ -643,6 +643,35 @@ class IDF_Views_Issue
|
||||
$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;
|
||||
|
||||
// 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
|
||||
|
||||
$arr = array(
|
||||
'Fo|o' => 110,
|
||||
'Bar' => 111,
|
||||
'Baz' => 112,
|
||||
);
|
||||
|
||||
$out = '';
|
||||
foreach ($arr as $key => $val)
|
||||
{
|
||||
$out .= str_replace('|', '|', $key).'|'.$val."\n";
|
||||
}
|
||||
|
||||
return new Pluf_HTTP_Response($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Star/Unstar an issue.
|
||||
*/
|
||||
@ -715,6 +744,15 @@ class IDF_Views_Issue
|
||||
}
|
||||
$auto['auto_owner'] = substr($auto['auto_owner'], 0, -2);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,8 @@ class IDF_Views_Project
|
||||
$params = array();
|
||||
$keys = array('labels_issue_template',
|
||||
'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) {
|
||||
$_val = $conf->getVal($key, false);
|
||||
if ($_val !== false) {
|
||||
|
@ -173,6 +173,11 @@ $ctl[] = array('regex' => '#^/watchlist/(\w+)$#',
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'forgeWatchList');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/autocomplete/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'autoCompleteIssueList');
|
||||
|
||||
// ---------- SCM ----------------------------------------
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#',
|
||||
|
@ -35,6 +35,13 @@
|
||||
</td>
|
||||
</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">
|
||||
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
|
||||
</td>
|
||||
|
@ -63,6 +63,15 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$form.f.relation_type.labelTag}:</th>
|
||||
<td>
|
||||
{if $form.f.relation_type.errors}{$form.f.relation_type.fieldErrors}{/if}
|
||||
{if $form.f.relation_issue.errors}{$form.f.relation_issue.fieldErrors}{/if}
|
||||
{$form.f.relation_type|unsafe}
|
||||
{$form.f.relation_issue|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$form.f.label1.labelTag}:</th>
|
||||
<td>
|
||||
{if $form.f.label1.errors}{$form.f.label1.fieldErrors}{/if}{$form.f.label1|unsafe}
|
||||
@ -123,11 +132,11 @@ $(document).ready(function(){
|
||||
});
|
||||
var j=0;
|
||||
for (j=1;j<4;j=j+1) {
|
||||
if($("tr#form-attachment-"+j+" > td > ul.errorlist").length == 0){
|
||||
$("#form-attachment-"+j).hide();
|
||||
}else{
|
||||
$("#form-block-"+(j-1)).remove();
|
||||
}
|
||||
if($("tr#form-attachment-"+j+" > td > ul.errorlist").length == 0){
|
||||
$("#form-attachment-"+j).hide();
|
||||
}else{
|
||||
$("#form-block-"+(j-1)).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -7,49 +7,77 @@
|
||||
var auto_labels = [{/literal}{$auto_labels|safe}{literal}];
|
||||
var auto_status = [{/literal}{$auto_status|safe}{literal}];
|
||||
var auto_owner = [{/literal}{$auto_owner|safe}{literal}];
|
||||
var auto_relation_types = [{/literal}{$auto_relation_types|safe}{literal}];
|
||||
|
||||
var j=0;
|
||||
for (j=1;j<7;j=j+1) {
|
||||
$("#id_label"+j).autocomplete(auto_labels, {
|
||||
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;
|
||||
}
|
||||
});
|
||||
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_status").autocomplete(auto_status, {
|
||||
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;
|
||||
}
|
||||
});
|
||||
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_owner").autocomplete(auto_owner, {
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
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_type").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").autocomplete("{/literal}{url 'IDF_Views_Issue::autoCompleteIssueList', array($project.shortname)}{literal}", {
|
||||
minChars: 0,
|
||||
width: 310,
|
||||
matchContains: true,
|
||||
max: 10,
|
||||
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} //-->
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user