Ticket #7026: query_column_reorder2_6737.diff
| File query_column_reorder2_6737.diff, 14.4 KB (added by ebray <hyugaricdeau@…>, 10 months ago) |
|---|
-
trac/ticket/web_ui.py
72 72 default_priority = Option('ticket', 'default_priority', 'major', 73 73 """Default priority for newly created tickets.""") 74 74 75 default_resolution = Option('ticket', 'default_resolution', 'fixed', 76 """Default resolution when closing tickets.""") 77 75 78 default_milestone = Option('ticket', 'default_milestone', '', 76 79 """Default milestone for newly created tickets.""") 77 80 -
trac/ticket/default_workflow.py
263 263 resolutions[0]) 264 264 else: 265 265 id = action + '_resolve_resolution' 266 <<<<<<< .mine 267 default = self.config.get('ticket', 'default_resolution') 268 selected_option = req.args.get(id, default) 269 ======= 266 270 selected_option = req.args.get(id, 267 271 self.config.get('ticket', 'default_resolution')) 272 >>>>>>> .r6363 268 273 control.append(tag(['as ', tag.select( 269 274 [tag.option(x, selected=(x == selected_option or None)) 270 275 for x in resolutions], -
trac/ticket/model.py
62 62 def _init_defaults(self, db=None): 63 63 for field in self.fields: 64 64 default = None 65 <<<<<<< .mine 66 field_name = field['name'] 67 if not field.get('custom'): 68 ======= 65 69 if field['name'] in ['resolution', 'status']: 66 70 # Ignore for new - only change through workflow 67 71 pass 68 72 elif not field.get('custom'): 69 default = self.env.config.get('ticket', 70 'default_' + field['name']) 73 >>>>>>> .r6363 74 if field_name != 'resolution': 75 default = self.env.config.get('ticket', 76 'default_' + field_name) 71 77 else: 72 78 default = field.get('value') 73 79 options = field.get('options') … … 77 83 except (ValueError, IndexError): 78 84 self.env.log.warning('Invalid default value "%s" ' 79 85 'for custom field "%s"' 80 % (default, field ['name']))86 % (default, field_name)) 81 87 if default: 82 self.values.setdefault(field ['name'], default)88 self.values.setdefault(field_name, default) 83 89 84 90 def _fetch_ticket(self, tkt_id, db=None): 85 91 db = self._get_db(db) -
trac/ticket/query.py
41 41 INavigationContributor, Chrome 42 42 from trac.wiki.api import IWikiSyntaxProvider, parse_args 43 43 from trac.wiki.macros import WikiMacroBase # TODO: should be moved in .api 44 from trac.config import Option 44 from trac.config import Option 45 45 46 46 class QuerySyntaxError(Exception): 47 47 """Exception raised when a ticket query cannot be parsed from a string.""" … … 94 94 for filter_ in filters: 95 95 filter_ = filter_.split('=') 96 96 if len(filter_) != 2: 97 raise QuerySyntaxError('Query filter requires field and ' 97 raise QuerySyntaxError('Query filter requires field and ' 98 98 'constraints separated by a "="') 99 99 field,values = filter_ 100 100 if not field: … … 254 254 # shorter in the common case where we just want the default columns. 255 255 if cols == self.get_default_columns(): 256 256 cols = None 257 for idx, col in enumerate(cols))) 257 258 return href.query(report=id, 258 259 order=order, desc=desc and 1 or None, 259 260 group=self.group or None, … … 637 638 rows, 638 639 req.args.get('limit')) 639 640 641 if cols: 642 for idx, col in enumerate(cols): 643 if 'up_' + col in req.args: 644 query.cols[idx] = cols[idx-1] 645 query.cols[idx-1] = col 646 req.redirect(query.get_href(req.href)) 647 elif 'down_' + col in req.args: 648 query.cols[idx] = cols[idx+1] 649 query.cols[idx+1] = col 650 req.redirect(query.get_href(req.href)) 651 640 652 if 'update' in req.args: 641 653 # Reset session vars 642 654 for var in ('query_constraints', 'query_time', 'query_tickets'): … … 779 791 data.setdefault('description', None) 780 792 data['title'] = title 781 793 782 data['all_columns'] = query.get_all_columns() 794 all_columns = query.get_all_columns() 795 all_columns.sort(key=lambda x: (not x in query.cols, 796 x in query.cols and 797 query_cols.index(x))) 783 798 # Don't allow the user to remove the id column 784 data['all_columns'].remove('id') 799 all_columns.remove('id') 800 data['all_columns'] = all_columns 785 801 data['all_textareas'] = query.get_all_textareas() 786 802 787 803 add_stylesheet(req, 'common/css/report.css') -
trac/ticket/templates/query.html
136 136 <fieldset id="columns"> 137 137 <legend>Columns</legend> 138 138 <div> 139 <py:for each="column in all_columns"> 140 <label> 141 <input type="checkbox" name="col" value="$column" 142 checked="${any([(value == column) for value in col]) 143 and 'checked' or None}" /> 144 ${labels.get(column, column or 'none')} 145 </label> 146 </py:for> 139 <table> 140 <tbody> 141 <tr py:for="idx, column in enumerate(all_columns)"> 142 <td> 143 <input type="checkbox" name="col" value="$column" 144 checked="${any([(value == column) for value in col]) 145 and 'selected' or None}" /> 146 </td> 147 <td>${labels.get(column, column or 'none')}</td> 148 <td> 149 <input type="submit" name="up_${column}" value="Up" 150 disabled="${not idx or None}" /> 151 <input type="submit" name="down_${column}" value="Down" 152 disabled="${idx == len(all_columns)-1 or None}" /> 153 </td> 154 </tr> 155 </tbody> 156 </table> 147 157 </div> 148 158 </fieldset> 149 159 -
trac/htdocs/js/query.js
273 273 } 274 274 select.selectedIndex = 0; 275 275 } 276 277 $("input[@name^='up_']").click(function() { 278 var row = $(this).parents('tr'); 279 if (row.prev().length) { 280 var prev = row.prev(); 281 if (!row.next().length) { 282 prev.find("input[@name^='down_']").attr("disabled", true); 283 } 284 prev.find("input[@name^='up_']").attr("disabled", false); 285 row.insertBefore(row.prev()); 286 if (!row.prev().length) { 287 $(this).attr("disabled", true); 288 } 289 row.find("input[@name^='down_']").attr("disabled", false); 290 } 291 return false; 292 }); 293 $("input[@name^='down_']").click(function() { 294 var row = $(this).parents('tr'); 295 if (row.next().length) { 296 var next = row.next(); 297 if (!row.prev().length) { 298 next.find("input[@name^='up_']").attr("disabled", true); 299 } 300 next.find("input[@name^='down_']").attr("disabled", false); 301 row.insertAfter(row.next()); 302 if (!row.next().length) { 303 $(this).attr("disabled", true); 304 } 305 row.find("input[@name^='up_']").attr("disabled", false); 306 } 307 return false; 308 }); 276 309 } 277 278 })(jQuery); 279 No newline at end of file 310 })(jQuery); -
trac/htdocs/js/expand_dir.js
1 1 // Enable expanding/folding folders in TracBrowser 2 2 3 <<<<<<< .mine 4 var FOLDERID_COUNTER = 0; 5 var SUBFOLDER_INDENT = 20; 6 7 // enableExpandDir adds the capability to folder rows to be expanded and folded 8 // It also teach the rows about their ancestors. It expects: 9 // - `parent_tr`, the logical parent row (`null` if there's no ancestor) 10 // - a `rows` jQuery object matching the newly created entry rows 11 // - `qargs`, additional parameters to send to the server when expanding 12 13 function enableExpandDir(parent_tr, rows, qargs) { 14 // the ancestors folder ids are present in the parent_tr class attribute 15 var ancestor_folderids = []; 16 if (parent_tr) 17 ancestor_folderids = $.grep(parent_tr.attr("class").split(" "), 18 function(c) { return c.match(/^f\d+$/)}); 19 var space = ($.browser.msie && $.browser.version == "6.0" ? " " : 20 "​"); 21 rows.each(function () { 22 var a = $(this).find("a.dir"); 23 24 if (a.length) { // then the entry is a folder 25 // create new folder id 26 var folderid = "f" + FOLDERID_COUNTER++; 27 this.id = folderid; 28 $(this).addClass(folderid); 29 30 // add the expander icon 31 a.wrap('<div></div>'); 32 <<<<<<< .mine 33 var expander = a.before('<span class="expander">' + space + 34 '</span>').prev(); 35 ======= 36 var expander = a.before('<span class="expander"> </span>').prev(); 37 >>>>>>> .r6391 38 expander.attr("title", "Expand sub-directory in place") 39 .click(function() { toggleDir($(this), qargs); }); 40 } 41 42 // tie that row to ancestor folders 43 ======= 3 44 (function($){ 4 45 var FOLDERID_COUNTER = 0; 5 46 var SUBFOLDER_INDENT = 20; … … 13 54 window.enableExpandDir = function(parent_tr, rows, qargs) { 14 55 // the ancestors folder ids are present in the parent_tr class attribute 15 56 var ancestor_folderids = []; 57 >>>>>>> .r6737 16 58 if (parent_tr) 17 59 ancestor_folderids = $.grep(parent_tr.attr("class").split(" "), 18 60 function(c) { return c.match(/^f\d+$/)}); -
trac/htdocs/css/report.css
41 41 #filters td.filter label { padding-right: 1em } 42 42 #filters td.actions { text-align: right; white-space: nowrap } 43 43 44 #columns div { 45 height: 15em; 46 overflow: -moz-scrollbars-vertical; 47 overflow-x: hidden; 48 overflow-y: scroll; 49 } 50 44 51 #columns div label { 45 52 display: block; 46 53 float: left; -
trac/wiki/web_ui.py
43 43 from trac.wiki.formatter import format_to_oneliner 44 44 from trac.wiki.model import WikiPage 45 45 46 class InvalidWikiPage(TracError):47 """Exception raised when a Wiki page fails validation."""48 49 50 46 class WikiModule(Component): 51 47 52 48 implements(IContentConverter, INavigationContributor, IPermissionRequestor, … … 131 127 if a in req.args: 132 128 action = a 133 129 break 134 if action == 'edit' and not has_collision: 130 valid = self._validate(context) 131 if action == 'edit' and not has_collision and valid: 135 132 self._do_save(req, versioned_page) 136 133 else: 137 134 return self._render_editor(req, page, action, has_collision) … … 167 164 168 165 # Internal methods 169 166 167 <<<<<<< .mine 168 def _validate(self, context): 169 req = context.req 170 page = context.resource 171 172 valid = True 173 # Give the manipulators a pass at post-processing the page 174 for manipulator in self.page_manipulators: 175 for field, message in manipulator.validate_wiki_page(req, page): 176 valid = False 177 if field: 178 req.warning(_("The Wiki page field '%(field)s' is " 179 "invalid: %(message)s", 180 field=field, message=message)) 181 else: 182 req.warning(_("Invalid Wiki page: %(message)s", 183 message=message)) 184 return valid 185 186 def _page_data(self, context, action=''): 187 page_name = context.name() 188 title = context.summary() 189 ======= 170 190 def _page_data(self, req, page, action=''): 171 191 title = get_resource_summary(self.env, page.resource) 192 >>>>>>> .r6363 172 193 if action: 173 194 title += ' (%s)' % action 174 195 return {'page': page, 'action': action, 'title': title} … … 240 261 # WIKI_ADMIN 241 262 page.readonly = int('readonly' in req.args) 242 263 243 # Give the manipulators a pass at post-processing the page244 for manipulator in self.page_manipulators:245 for field, message in manipulator.validate_wiki_page(req, page):246 if field:247 raise InvalidWikiPage(_("The Wiki page field '%(field)s' "248 "is invalid: %(message)s",249 field=field, message=message))250 else:251 raise InvalidWikiPage(_("Invalid Wiki page: %(message)s",252 message=message))253 254 264 try: 255 265 page.save(get_reporter_id(req, 'author'), 256 266 req.args.get('comment'),
