websiteWebsite
codingteam CodingTeam
A free forge, lightweight and extensible.

 

Browse the code

Differences between 356 and 357 on /.
Number of edited files: 7 (0 added, 1 deleted and 6 modified)
Author: xbright
Log message: * Changed a lot of things in the bug tracker:
* Fixed a bug: issues don't have anymore to rely on a version
* Removed 'default' and 'all' views, 'all' view is the new 'default' one (I don't understand what I wrote but you can read the code)
* Added 3 new filters: priority, title, content
Date: 2010-02-23 11:16:41

Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
123 123
                               '><a href="project/'.$this->dbname.'/bugs">' ).i18n('Tracker').' <img src="public/images/dropdown.png" alt="dropdown" /></a>
124 124
                                   <ul class="submenu">
125 125
                                    '.( ($this->views['roadmap'] == 'TRUE') ? '<li><a href="project/'.$this->dbname.'/roadmap">'.i18n('Roadmap').'</a></li>' : '' ).'
126  
                                    <li><a href="project/'.$this->dbname.'/bugs/all">'.i18n('Browse all bugs').'</a></li>
127 126
                                    <li><a href="project/'.$this->dbname.'/bugs/add"><strong>'.i18n('Report a bug').'</strong></a></li>
128 127
                                  </ul>
129 128
                                </li>';
130 129

                                        

 

Old New Code
264 264

                                        
265 265
        foreach ($condition as $name => $value)
266 266
            if (!in_array($name, array('type', 'status', 'assignedid',
267  
                                       'version', 'milestone', 'projectid')))
  267
                                       'version', 'milestone', 'projectid',
  268
                                       'priority', 'name', 'text')))
268 269
                unset($condition[$name]);
269 270

                                        
270 271
        return $this->ct_db->select('projects_bugs', $condition,
271 272

                                        

 

Old New Code
14 14

                                        
15 15
    <strong><?=i18n('Affected version:');?></strong><br />
16 16
    <select style="width:205px;margin-bottom: 10px;" name="version">
  17
      <option value="" <?=(($sel_version == '') ? 'selected="selected"' : '');?>>&nbsp;<?=_('No version')?></option>
17 18
      <? foreach ($versions as $version): ?>
18 19
        <option value="<?=$version['version'];?>" <?=(($sel_version == $version['version']) ? 'selected="selected"' : '');?>><?=$version['version'];?> (<?=$available_status[$version['status']];?>)</option>
19 20
      <? endforeach; ?>
20 21

                                        

 

Old New Code
1 1
<h1><?=i18n('Bug tracking');?></h1>
2 2

                                        
3  
<form method="get" action="<?=getURLbyTags($this->page);?>">
  3
<form method="get" action="<?=getURLbyTags($this->page);?>/">
4 4
  <div class="evidence">
5 5
    <h4 onclick="javascript:hideorshow();"><?=i18n('Filter these bugs');?></h4>
6 6
    <div id="formconf">
37 37
            </select>
38 38
          </td>
39 39
        </tr>
  40
        <tr>
  41
          <td style="vertical-align: top;" class="border_all_light">
  42
            <strong><?=i18n('By priority:');?></strong><br />
  43
            <label><input type="checkbox" name="blocker" value="1" <?=((isset($filter['blocker'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Blocker');?></label>
  44
            <label><input type="checkbox" name="critical" value="1" <?=((isset($filter['critical'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Critical');?></label>
  45
            <label><input type="checkbox" name="major" value="1" <?=((isset($filter['major'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Major');?></label>
  46
            <label><input type="checkbox" name="normal" value="1" <?=((isset($filter['normal'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Normal');?></label>
  47
            <label><input type="checkbox" name="minor" value="1" <?=((isset($filter['minor'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Minor');?></label>
  48
            <label><input type="checkbox" name="trivial" value="1" <?=((isset($filter['trivial'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Trivial');?></label>
  49
          </td>
  50
          <td style="vertical-align: top;" class="border_all_light">
  51
            <strong><?=i18n('By keywords:');?></strong><br />
  52
            <label><input type="checkbox" name="withtitle" value="1" <?=((isset($filter['withtitle'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Title:');?></label>
  53
            <input type="text" name="title" value="<?=((isset($filter['title'])) ? htmlspecialchars($filter['title']) : '');?>" /><br />
  54

                                    
  55
            <label><input type="checkbox" name="withtext" value="1" <?=((isset($filter['withtext'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Text:');?></label>
  56
            <input type="text" name="text" value="<?=((isset($filter['text'])) ? htmlspecialchars($filter['text']) : '');?>" />
  57
          </td>
  58
        </tr>
40 59
        <? if(!empty($versions)): ?>
41 60
          <tr>
42 61
            <td style="vertical-align: top;" class="border_all_light">
43 62
              <strong><?=i18n('Version:');?></strong><br />
44 63
              <label><input type="checkbox" name="withversion" value="1" <?=((isset($filter['withversion'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Show only version:');?></label>
45 64
              <select name="version">
  65
                <option <?=((isset($filter['version']) && '' == $filter['version']) ? 'selected="selected"' : '');?> value="">&nbsp;<?=_('No version')?></option>
46 66
                <? foreach ($versions as $version): ?>
47 67
                  <option <?=((isset($filter['version']) && $version['version'] == $filter['version']) ? 'selected="selected"' : '');?> value="<?=$version['version'];?>">&nbsp;<?=$version['version'];?></option>
48 68
                <? endforeach; ?>
52 72
              <strong><?=i18n('Milestone:');?></strong><br />
53 73
              <label><input type="checkbox" name="withmilestone" value="1" <?=((isset($filter['withmilestone'])) ? 'checked="checked"' : '');?> >&nbsp;<?=i18n('Show only milestone:');?></label>
54 74
              <select name="milestone">
  75
                <option <?=((isset($filter['milestone']) && '' == $filter['milestone']) ? 'selected="selected"' : '');?> value="">&nbsp;<?=_('No milestone')?></option>
55 76
                <? foreach ($versions as $version) : ?>
56 77
                  <option <?=((isset($filter['milestone']) && $version['version'] == $filter['milestone']) ? 'selected="selected"' : '');?> value="<?=$version['version'];?>">&nbsp;<?=$version['version'];?></option>
57 78
                <? endforeach; ?>
76 97
  <thead>
77 98
    <tr>
78 99
      <th style="width: 5%;" <?=(($orderby == 'id') ? 'class="current-th"' : '');?>>
79  
        <a href="project/<?=$_dbname;?>/bugs/all?order=id:asc<?=$linkstr;?>">
  100
        <a href="project/<?=$_dbname;?>/bugs/?order=id:asc<?=$linkstr;?>">
80 101
          <img src="public/images/sort-asc.gif" alt="sort" /></a>
81 102

                                        
82  
        <a href="project/<?=$_dbname;?>/bugs/all?order=id:desc<?=$linkstr;?>">
  103
        <a href="project/<?=$_dbname;?>/bugs/?order=id:desc<?=$linkstr;?>">
83 104
          <img src="public/images/sort-desc.gif" alt="sort" /></a>
84 105

                                        
85 106
        <?=i18n('ID');?>
86 107
      </th>
87 108

                                        
88 109
      <th <?=(($orderby == 'name') ? 'class="current-th"' : '');?>>
89  
        <a href="project/<?=$_dbname;?>/bugs/all?order=name:asc<?=$linkstr;?>">
  110
        <a href="project/<?=$_dbname;?>/bugs/?order=name:asc<?=$linkstr;?>">
90 111
          <img src="public/images/sort-asc.gif" alt="sort" /></a>
91 112

                                        
92  
        <a href="project/<?=$_dbname;?>/bugs/all?order=name:desc<?=$linkstr;?>">
  113
        <a href="project/<?=$_dbname;?>/bugs/?order=name:desc<?=$linkstr;?>">
93 114
          <img src="public/images/sort-desc.gif" alt="sort" /></a>
94 115

                                        
95 116
        <?=i18n('Name');?>
96 117
      </th>
97 118

                                        
98 119
      <th style="width: 10%;" <?=(($orderby == 'priority') ? 'class="current-th"' : '');?>>
99  
        <a href="project/<?=$_dbname;?>/bugs/all?order=priority:asc<?=$linkstr;?>">
  120
        <a href="project/<?=$_dbname;?>/bugs/?order=priority:asc<?=$linkstr;?>">
100 121
          <img src="public/images/sort-asc.gif" alt="sort" /></a>
101 122

                                        
102  
        <a href="project/<?=$_dbname;?>/bugs/all?order=priority:desc<?=$linkstr;?>">
  123
        <a href="project/<?=$_dbname;?>/bugs/?order=priority:desc<?=$linkstr;?>">
103 124
          <img src="public/images/sort-desc.gif" alt="sort" /></a>
104 125

                                        
105 126
        <?=i18n('Priority');?>
106 127
      </th>
107 128

                                        
108 129
      <th style="width: 10%;" <?=(($orderby == 'status') ? 'class="current-th"' : '');?>>
109  
        <a href="project/<?=$_dbname;?>/bugs/all?order=status:asc<?=$linkstr;?>">
  130
        <a href="project/<?=$_dbname;?>/bugs/?order=status:asc<?=$linkstr;?>">
110 131
          <img src="public/images/sort-asc.gif" alt="sort" /></a>
111 132

                                        
112  
        <a href="project/<?=$_dbname;?>/bugs/all?order=status:desc<?=$linkstr;?>">
  133
        <a href="project/<?=$_dbname;?>/bugs/?order=status:desc<?=$linkstr;?>">
113 134
          <img src="public/images/sort-desc.gif" alt="sort" /></a>
114 135

                                        
115 136
        <?=i18n('Status');?>
116 137
      </th>
117 138

                                        
118 139
      <th style="width: 10%;" <?=(($orderby == 'version') ? 'class="current-th"' : '');?>>
119  
        <a href="project/<?=$_dbname;?>/bugs/all?order=version:asc<?=$linkstr;?>">
  140
        <a href="project/<?=$_dbname;?>/bugs/?order=version:asc<?=$linkstr;?>">
120 141
          <img src="public/images/sort-asc.gif" alt="sort" /></a>
121 142

                                        
122  
        <a href="project/<?=$_dbname;?>/bugs/all?order=version:desc<?=$linkstr;?>">
  143
        <a href="project/<?=$_dbname;?>/bugs/?order=version:desc<?=$linkstr;?>">
123 144
          <img src="public/images/sort-desc.gif" alt="sort" /></a>
124 145

                                        
125 146
        <?=i18n('Version');?>
171 192
          <?=$_status[$bugs[$i]['status']];?>
172 193
        </td>
173 194
        <td style="color: #<?=$bugs[$i]['st_color'];?>;" class="center <?=$cl;?>">
174  
          <a href="project/<?=$_dbname;?>/bugs/all?nbbugs=30&amp;withversion=1&amp;version=<?=$bugs[$i]['version'];?>">
175  
            <?=$bugs[$i]['version'];?></a>
  195
            <?=( (!empty($bugs[$i]['version'])) ? '<a href="project/'.$_dbname.'/bugs/all?nbbugs=30&amp;withversion=1&amp;version='.$bugs[$i]['version'].'">'.$bugs[$i]['version'].'</a>' : 'n/a' );?>
176 196
        </td>
177 197
      </tr>
178 198
    <? endfor; ?>
179 199

                                        

 

Old New Code
27 27
  </tr>
28 28
  <tr>
29 29
    <td style="padding-left: 5px;width: 20%;" class="background_title text_title"><?=i18n('Affected version:');?></td>
30  
    <td style="padding-left: 5px;width: 30%;"><a href="project/<?=$_dbname;?>/bugs/all?nbbugs=30&amp;withversion=1&amp;version=<?=$version;?>"><?=$version;?></a></td>
  30
    <td style="padding-left: 5px;width: 30%;"><?=(!empty($version) ? '<a href="project/'.$_dbname.'/bugs/all?nbbugs=30&amp;withversion=1&amp;version='.$version.'">'.$version.'</a>' : '<em>n/a</em>');?></td>
31 31

                                        
32 32
    <td style="padding-left: 5px;width: 20%;" class="background_title text_title"><?=i18n('Milestone:');?></td>
33  
    <td style="padding-left: 5px;width: 30%;"><a href="project/<?=$_dbname;?>/roadmap"><?=(!empty($milestone) ? $milestone : 'n/a');?></a></td>
  33
    <td style="padding-left: 5px;width: 30%;"><?=(!empty($milestone) ? '<a href="project/'.$_dbname.'/roadmap">'.$milestone.'</a>' : '<em>n/a</em>');?></td>
34 34
  </tr>
35 35
  <tr>
36 36
    <td style="padding-left: 5px;width: 20%;" class="background_title text_title"><?=i18n('Reported by:');?></td>
147 147
        <strong><?=i18n('Version:');?></strong><br />
148 148
        <select name="version" style="margin-bottom: 5px;width: 205px;">
149 149
          <? foreach ($versions as $key): ?>
150  
            <? if ($key['version'] == $version): ?>
  150
            <? if ($key['version'] == $adm_version): ?>
151 151
              <option value="<?=$key['version'];?>" selected="selected"><?=$key['version'];?> (<?=$available_status[$key['status']];?>)</option>
152 152
            <? else: ?>
153 153
              <option value="<?=$key['version'];?>"><?=$key['version'];?> (<?=$available_status[$key['status']];?>)</option>
154 154

                                        

 

Old New Code
191 191
                if ($log_list[$i]['status'] != '!nochange!')
192 192
                    $editlist .= '<br />'.i18n('Status changed to %(status)s', array('status' => '<strong>'.$this->status[$log_list[$i]['status']].'</strong>'));
193 193

                                        
194  
                if ($log_list[$i]['version'] != '!nochange!')
195  
                    $editlist .= '<br />'.i18n('Version changed to %(version)s', array('version' => '<strong>'.$log_list[$i]['version'].'</strong>'));
  194
                if ($log_list[$i]['version'] != '!nochange!' && $log_list[$i]['version'] != '')
  195
                {
  196
                    $ver = ((!empty($log_list[$i]['version']) && $log_list[$i]['version'] != 'No Version') ? $log_list[$i]['version'] : 'n/a');
  197
                    $editlist .= '<br />'.i18n('Version changed to %(version)s', array('version' => '<strong>'.$ver.'</strong>'));
  198
                }
196 199

                                        
197 200
                if ($log_list[$i]['milestone'] != '!nochange!' && $log_list[$i]['milestone'] != '')
198 201
                {
411 414
                        $new_assignto = $this->ct_db->cleanentry($_POST['assignto'], TRUE);
412 415

                                        
413 416
                        $new_version = $this->ct_db->cleanentry($_POST['version'], TRUE);
414  
                        if (!$this->project_versions->versionExist($this->id, $new_version))
  417
                        if (!$this->project_versions->versionExist($this->id, $new_version) &&
  418
                            $new_version != 'No Version')
415 419
                            exit('Error.');
416 420

                                        
417 421
                        $new_milestone = $this->ct_db->cleanentry($_POST['milestone'], TRUE);
463 467
                            array_push($edited_values, array('assignedid' => 0));
464 468

                                        
465 469
                        $previous_version = $this->project_bugs->getVersion();
  470
                        if ($new_version == 'No Version')
  471
                        {
  472
                            $new_version = '';
  473
                            $log_version = 'No Version';
  474
                        }
  475
                        else
  476
                            $log_version = $new_version;
  477

                                    
466 478
                        if ($this->project_bugs->getVersion() != $new_version)
467 479
                        {
468 480
                            $this->project_bugs->setVersion($new_version);
469  
                            array_push($edited_values, array('version' => $new_version));
  481
                            array_push($edited_values, array('version' => $log_version));
470 482
                            $nb_edit ++;
471 483
                        }
472 484
                        else
629 641

                                        
630 642
            $this->form_version = $this->ct_db->cleanentry($_POST['version'], TRUE);
631 643
            if (!$this->project_versions->versionExist($this->id, $this->form_version))
632  
                exit('Error.');
  644
                if (!empty($this->form_version))
  645
                    exit('Error.');
633 646

                                        
634 647
            $this->form_type = $this->ct_db->cleanentry($_POST['type'], TRUE);
635 648
            if (!in_array($this->form_type, array('bugreport', 'featurerequest')))
704 717
                                  'beta'        => i18n('Beta'),
705 718
                                  'stable'      => i18n('Stable'),
706 719
                                  'abandonned'  => i18n('Abandonned'),
707  
                                  'none'        => i18n('Do not shedule a bug fix in a milestone'));
  720
                                  'none'        => i18n('Do not shedule a bug fix in a milestone'),
  721
                                  'nonebis'     => i18n('No version matches'));
708 722

                                        
709 723
        $colors = array('blocker'  => 'CD2626',
710 724
                        'critical' => 'FFA500',
793 807
                    $editlist .= '<br />'.i18n('Status changed to %(status)s',
794 808
                        array('status' => '<strong>'.$this->status[$log_item['status']].'</strong>'));
795 809

                                        
796  
                if ($log_item['version'] != '!nochange!')
  810
                if ($log_item['version'] != '!nochange!' && $log_item['version'] != '')
  811
                {
  812
                    $ver = ((!empty($log_item['version']) && $log_item['version'] != 'No Version') ? $log_item['version'] : 'n/a');
797 813
                    $editlist .= '<br />'.i18n('Version changed to %(version)s',
798  
                        array('version' => '<strong>'.$log_item['version'].'</strong>'));
  814
                        array('version' => '<strong>'.$ver.'</strong>;'));
  815
                }
799 816

                                        
800 817
                if ($log_item['milestone'] != '!nochange!' && $log_item['milestone'] != '')
801 818
                {
909 926

                                        
910 927
                    $construct['_type'] = $this->type;
911 928
                    $construct['_priority'] = $this->priority;
912  
                    $construct['versions'] = $versions;
913 929
                    $construct['available_status'] = $available_status;
914 930
                    $construct['_status'] = $this->status;
915 931

                                        
917 933
                    if ($construct['milestone'] == '')
918 934
                        $construct['adm_milestone'] = 'No Milestone';
919 935

                                        
  936
                    $construct['adm_version'] = $construct['version'];
  937
                    if ($construct['version'] == '')
  938
                        $construct['adm_version'] = 'No Version';
  939

                                    
920 940
                    $milestones = $versions;
921 941
                    array_push($milestones,
922 942
                               array('id'        => 0,
925 945
                                     'status'    => 'none'));
926 946
                    $construct['milestones'] = $milestones;
927 947

                                        
  948
                    $public_versions = $versions;
  949
                    array_push($public_versions,
  950
                               array('id'        => 0,
  951
                                     'projectid' => $this->id,
  952
                                     'version'   => 'No Version',
  953
                                     'status'    => 'nonebis'));
  954
                    $construct['versions'] = $public_versions;
  955

                                    
928 956
                    $construct['curassign'] = $this->project_bugs->getAssignedid();
929 957
                    $construct['_admins'] = array();
930 958
                    $arr = $this->project_admins->getAdmins($this->id, 'project');
1050 1078
                $this->error->displayError($mess, 0);
1051 1079
            }
1052 1080
        }
1053  
        elseif (!empty($this->page[4]) && mb_substr($this->page[4], 0, 3) == 'all')
  1081
        elseif (empty($this->page[4]))
1054 1082
        {
1055 1083
            // Browse bugs
1056 1084
            $construct['__tpl__'] = 'bugs-all.tpl';   
1066 1094

                                        
1067 1095
            $filterparam = array('type'       => '',
1068 1096
                                 'status'     => '',
1069  
                                 'assignedid' => '');
  1097
                                 'assignedid' => '',
  1098
                                 'priority'   => '');
1070 1099

                                        
1071 1100
            if (isset($conf['withversion']) && !is_null($conf['withversion']))
1072  
                if (isset($conf['version']) && !is_null($conf['version']))
  1101
                if (isset($conf['version']))
1073 1102
                    $filterparam['version'] = $conf['version'];
1074 1103

                                        
1075 1104
            if (isset($conf['withmilestone']) && !is_null($conf['withmilestone']))
1076  
                if (isset($conf['milestone']) && !is_null($conf['milestone']))
  1105
                if (isset($conf['milestone']))
1077 1106
                    $filterparam['milestone'] = $conf['milestone'];
1078 1107

                                        
1079 1108
            if (isset($conf['onlybug']) && !is_null($conf['onlybug']))
1092 1121
                if (isset($conf['assignedusers']) && !is_null($conf['assignedusers']))
1093 1122
                    $filterparam['assignedid'] = $conf['assignedusers'];
1094 1123

                                        
  1124
            // Status
1095 1125
            if (isset($conf['active']) && !is_null($conf['active']))
1096 1126
                $filterparam['status'] = array('confirmed', 'working');
1097 1127

                                        
1104 1134
            if (isset($conf['waiting']) && !is_null($conf['waiting']))
1105 1135
                $filterparam['status'] = (!is_array($filterparam['status'])) ? array('needinformations', 'needcontributors', 'needtests') : array_merge($filterparam['status'], array('needinformations', 'needcontributors', 'needtests'));
1106 1136

                                        
  1137
            // Priority
  1138
            if (isset($conf['blocker']) && !is_null($conf['blocker']))
  1139
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('blocker') : array_merge($filterparam['priority'], array('blocker'));
  1140

                                    
  1141
            if (isset($conf['critical']) && !is_null($conf['critical']))
  1142
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('critical') : array_merge($filterparam['priority'], array('critical'));
  1143

                                    
  1144
            if (isset($conf['major']) && !is_null($conf['major']))
  1145
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('major') : array_merge($filterparam['priority'], array('major'));
  1146

                                    
  1147
            if (isset($conf['normal']) && !is_null($conf['normal']))
  1148
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('normal') : array_merge($filterparam['priority'], array('normal'));
  1149

                                    
  1150
            if (isset($conf['minor']) && !is_null($conf['minor']))
  1151
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('minor') : array_merge($filterparam['priority'], array('minor'));
  1152

                                    
  1153
            if (isset($conf['trivial']) && !is_null($conf['trivial']))
  1154
                $filterparam['priority'] = (!is_array($filterparam['priority'])) ? array('trivial') : array_merge($filterparam['priority'], array('trivial'));
  1155

                                    
  1156
            // Keywords
  1157
            if (isset($conf['withtitle']) && !is_null($conf['withtitle']))
  1158
                if (isset($conf['title']) && !is_null($conf['title']))
  1159
                    $filterparam['name'] = array($conf['title'], 'LIKE');
  1160

                                    
  1161
            if (isset($conf['withtext']) && !is_null($conf['withtext']))
  1162
                if (isset($conf['text']) && !is_null($conf['text']))
  1163
                    $filterparam['text'] = array($conf['text'], 'LIKE');
  1164

                                    
1107 1165
            foreach ($filterparam as $key => $value)
1108  
               if (empty($filterparam[$key]))
  1166
               if (empty($filterparam[$key]) && !in_array($key, array('version', 'milestone')))
1109 1167
                  unset($filterparam[$key]);
1110 1168

                                        
1111 1169
            $authorize = array('id:asc', 'id:desc',
1138 1196
                         'onlybug', 'onlyfeaturerequest', 'notassign',
1139 1197
                         'assignedtome', 'assignedto', 'assignedusers',
1140 1198
                         'active', 'closed', 'unconfirmed', 'waiting',
1141  
                         'nbbugs', 'page', 'order');
  1199
                         'nbbugs', 'page', 'order', 'blocker', 'critical',
  1200
                         'major', 'normal', 'minor', 'trivial', 'title', 'text',
  1201
                         'withtitle', 'withtext', 'title', 'text');
1142 1202
            foreach ($conf as $key => $value)
1143 1203
            {
1144 1204
                if (!in_array($key, $ars))
1146 1206
                elseif (in_array($key, array('version', 'milestone')))
1147 1207
                {
1148 1208
                    if (!$this->project_versions->versionExist($this->id, $value))
1149  
                        exit('Error.');
  1209
                        if (!empty($value))
  1210
                            exit('Error.');
1150 1211
                }
1151  
                elseif (!in_array($key, array('version', 'milestone')) && $key != 'order')
  1212
                elseif (!in_array($key, array('version', 'milestone', 'title', 'text')) && $key != 'order')
1152 1213
                {
1153 1214
                    if (!mb_ereg("^[0-9]+$", $value))
1154 1215
                        exit ('Error.');
1201 1262
                while($i < ($totalbugs / $max))
1202 1263
                {
1203 1264
                    if($i != $page)
1204  
                        $str .= '&nbsp;<a href="project/'.$this->dbname.'/bugs/all?page='.($i + 1).
  1265
                        $str .= '&nbsp;<a href="project/'.$this->dbname.'/bugs/?page='.($i + 1).
1205 1266
                                $linkstr.'">'.($i + 1).'</a>';
1206 1267
                    else
1207 1268
                        $str .= '&nbsp;<b>'.($i + 1).'</b>';
1290 1351
            }
1291 1352
            $construct['adminslist'] = $adms;
1292 1353
        }
1293  
        elseif (empty($this->page[4]))
1294  
        {
1295  
            // Default
1296  
            $construct['__tpl__'] = 'bugs-default.tpl';
1297  

                                    
1298  
            $construct['_dbname'] = $this->dbname;
1299  
            $construct['_priority'] = $this->priority;
1300  
            $construct['_colors'] = $colors;
1301  
            $construct['_status'] = $this->status;
1302  

                                    
1303  
            $construct['bugs'] = array();
1304  
            $bugs_list = $this->project_bugs->getLatestBugs($this->id, 'ORDER BY id DESC LIMIT 5');
1305  

                                    
1306  
            foreach ($bugs_list as $bug)
1307  
            {
1308  
                $has_attachements = $this->project_bugs->bugHasAttachement($bug['id']);
1309  

                                    
1310  
                if (in_array($bug['status'], array('resolved', 'rejected')))
1311  
                    $title = '<span style="text-decoration: line-through;">'.
1312  
                             map_str(htmlspecialchars($bug['name']), 90).'</span>';
1313  
                else
1314  
                    $title = map_str(htmlspecialchars($bug['name']), 90);
1315  

                                    
1316  
                switch ($bug['status'])
1317  
                {
1318  
                    case 'unconfirmed':
1319  
                    case 'needinformations':
1320  
                    case 'needcontributors':
1321  
                    case 'needtests':
1322  
                        $color = '#696969';
1323  
                    break;
1324  

                                    
1325  
                    case 'working':
1326  
                    case 'confirmed':
1327  
                        $color = '#5F9EA0';
1328  
                    break;                        
1329  

                                    
1330  
                    case 'resolved':
1331  
                        $color = '#228B22';
1332  
                    break;
1333  

                                    
1334  
                    case 'rejected':
1335  
                        $color = '#FF6347';
1336  
                    break;
1337  
                }
1338  

                                    
1339  
                array_push($construct['bugs'],
1340  
                           array('id'               => $bug['id'],
1341  
                                 'title'            => $title,
1342  
                                 'type'             => $bug['type'],
1343  
                                 'status'           => $bug['status'],
1344  
                                 'priority'         => $bug['priority'],
1345  
                                 'has_attachements' => $has_attachements,
1346  
                                 'status_color'     => $color));
1347  
            }
1348  

                                    
1349  
            // Feed
1350  
            $construct['feed'] = i18n('Feed subscription: %(rss)s or %(atom)s.',
1351  
                                      array('rss' => '<a href="rss/project/'.$this->dbname.'/bugs">'.
1352  
                                                     i18n('RSS').'</a>',
1353  
                                            'atom' => '<a href="atom/project/'.$this->dbname.'/bugs">'.
1354  
                                                      i18n('Atom').'</a>'));
1355  

                                    
1356  
            // Versions
1357  
            $colors = array('planned'     => 'AFEEEE',
1358  
                            'development' => 'E0FFFF',
1359  
                            'testing'     => 'FAEBD7',
1360  
                            'alpha'       => 'EEE9BF',
1361  
                            'beta'        => 'FFFACD',
1362  
                            'stable'      => 'C1FFC1',
1363  
                            'abandonned'  => 'EEE8AA');
1364  

                                    
1365  
            $construct['versions'] = array();
1366  
            $classed = $versions;
1367  
            usort($classed, 'invertedvsort');
1368  
            foreach ($classed as $version)
1369  
            {
1370  
                $has_bugs = $this->project_bugs->getBugsByVersion($this->id, $version['version']);
1371  
                if (!$has_bugs)
1372  
                    continue;
1373  

                                    
1374  
                $bg = $colors[$version['status']];
1375  
                $vname = htmlspecialchars($version['version']);
1376  
                $txt = i18n('%(n)s bug(s) reported',
1377  
                            array('n' => '<strong>'.
1378  
                                         $this->project_bugs->countReports($this->id, $vname).
1379  
                                         '</strong>'));
1380  

                                    
1381  
                array_push($construct['versions'],
1382  
                           array('bg' => $bg,
1383  
                                 'st' => $available_status[$version['status']],
1384  
                                 'vn' => $vname,
1385  
                                 'tx' => $txt));
1386  
            }
1387  
        }
1388 1354
        else
1389 1355
            $this->error->displayError(i18n('Wrong request.'), 0);
1390 1356

                                        
1391 1357