Indefero

Indefero Commit Details


Date:2011-05-10 09:21:29 (13 years 7 months ago)
Author:Thomas Keller
Branch:develop, feature.content-md5, feature.diff-whitespace, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.2, release-1.3
Commit:7e226b43d33351622f06bc52ea18c9918b1c270f
Parents: 9171bfd1abea5e00aea6a440c88919b3c31012a0
Message:More work on the issue relation infrastructure - actually query data for the incoming query - exclude the current issue from being linked with itself - allow multiple issues to be given in the second input field - add the form fields to the ticket update view as well

Changes:

File differences

src/IDF/Form/IssueUpdate.php
6969
7070
7171
72
72
7373
7474
7575
76
76
7777
7878
7979
......
102102
103103
104104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
105121
106122
107123
// case of someone allowing the upload path to be accessible
// to everybody.
for ($i=1;$i<4;$i++) {
$filename = substr($md5, 0, 2).'/'.substr($md5, 2, 2).'/'.substr($md5, 4).'/%s.dummy';
$filename = substr($md5, 0, 2).'/'.substr($md5, 2, 2).'/'.substr($md5, 4).'/%s.dummy';
$this->fields['attachment'.$i] = new Pluf_Form_Field_File(
array('required' => false,
'label' => __('Attach a file'),
'move_function_params' =>
'move_function_params' =>
array('upload_path' => $upload_path,
'upload_path_create' => true,
'file_name' => $filename,
'size' => 15,
),
));
$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),
));
$tags = $this->issue->get_tags_list();
for ($i=1;$i<7;$i++) {
$initial = '';
src/IDF/Views/Issue.php
345345
346346
347347
348
348349
349350
350351
......
651652
652653
653654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
654689
655690
656691
657692
658693
659
660
661
662
663
664
665
666694
667
695
696
668697
669
698
699
700
701
702
703
704
705
706
707
708
670709
671710
672711
'form' => $form,
'page_title' => $title,
'preview' => $preview,
'issue' => new IDF_Issue(),
),
self::autoCompleteArrays($prj)
);
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
$arr = array(
'Fo|o' => 110,
'Bar' => 111,
'Baz' => 112,
);
$out = '';
foreach ($arr as $key => $val)
$ids = array();
foreach ($issues as $issue)
{
$out .= str_replace('|', '&#124;', $key).'|'.$val."\n";
if ($issue->id == $issue_id)
continue;
if (in_array($issue->id, $ids))
continue;
if (--$limit < 0)
break;
$out .= str_replace('|', '&#124;', $issue->summary) .'|'.$issue->id."\n";
$ids[] = $issue->id;
}
return new Pluf_HTTP_Response($out);
src/IDF/conf/urls.php
173173
174174
175175
176
176
177177
178178
179179
'model' => 'IDF_Views_Issue',
'method' => 'forgeWatchList');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/autocomplete/$#',
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/autocomplete/(\d*)$#',
'base' => $base,
'model' => 'IDF_Views_Issue',
'method' => 'autoCompleteIssueList');
src/IDF/templates/idf/issues/js-autocomplete.html
6464
6565
6666
67
67
6868
6969
7070
7171
72
7273
7374
7475
return row.to;
}
});
$("#id_relation_issue").autocomplete("{/literal}{url 'IDF_Views_Issue::autoCompleteIssueList', array($project.shortname)}{literal}", {
$("#id_relation_issue").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) {
src/IDF/templates/idf/issues/view.html
120120
121121
122122
123
124
125
126
127
128
129
130
131
123132
124133
125134
</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}

Archive Download the corresponding diff file

Page rendered in 0.09669s using 13 queries.