Changeset 2848
- Timestamp:
- 12/04/07 08:18:29 (1 year ago)
- Files:
-
- ticketboxmacro/0.10/TicketBox.py (modified) (7 diffs)
- ticketboxmacro/0.11/TicketBox.py (modified) (7 diffs)
- ticketboxmacro/0.8/TicketBox.py (modified) (7 diffs)
- ticketboxmacro/0.9/TicketBox.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ticketboxmacro/0.10/TicketBox.py
r2768 r2848 39 39 "width": "25%", 40 40 } 41 inline_styles = { "background": "#f7f7f0", } 41 42 42 43 args_pat = [r"#?(?P<tktnum>\d+)", … … 44 45 r"\[report:(?P<rptnum2>\d+)(?P<dv>\?.*)?\]", 45 46 r"(?P<width>\d+(pt|px|%))", 47 r"(?P<summary>summary)", 48 r"(?P<inline>inline)", 46 49 r"(?P<title1>'.*')", 47 50 r'(?P<title2>".*")'] … … 62 65 txt = '' 63 66 items = [] 67 long_items = {} 68 show_summary = False 69 inline = False 64 70 title = "Tickets" 65 71 args_re = re.compile("^(?:" + string.join(args_pat, "|") + ")$") … … 77 83 elif match.group('tktnum'): 78 84 items.append(int(match.group('tktnum'))) 85 elif match.group('summary'): 86 show_summary = True 87 elif match.group('inline'): 88 inline = True 79 89 elif match.group('rptnum') or match.group('rptnum2'): 80 90 num = match.group('rptnum') or match.group('rptnum2') … … 104 114 descriptions = [desc[0] for desc in curs.description] 105 115 idx = descriptions.index('ticket') 116 summ = descriptions.index('summary') 106 117 for row in rows: 107 118 items.append(row[idx]) 119 long_items[row[idx]] = row[summ] 108 120 finally: 109 121 if not hasattr(env, 'get_cnx_pool'): … … 117 129 # for trac 0.9 or later 118 130 from trac.wiki.formatter import wiki_to_oneliner 119 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),120 env, env.get_db_cnx())121 131 except: 122 132 # for trac 0.8.x 123 133 from trac.WikiFormatter import wiki_to_oneliner 134 135 if show_summary: 136 html = string.join([wiki_to_oneliner("%s (#%d)" % (v,k), 137 env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>") 138 else: 124 139 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 125 hdf, env, env.get_db_cnx()) 140 env, env.get_db_cnx()) 141 126 142 if html != '': 127 143 try: … … 129 145 except: 130 146 pass 131 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 147 if inline: 148 style = string.join(["%s:%s" % (k,v) for k,v in inline_styles.items() if v <> ""], "; ") 149 else: 150 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 132 151 return '<fieldset class="ticketbox" style="%s"><legend>%s</legend>%s</fieldset>' % \ 133 152 (style, title, html) ticketboxmacro/0.11/TicketBox.py
r2769 r2848 39 39 "width": "25%", 40 40 } 41 inline_styles = { "background": "#f7f7f0", } 41 42 42 43 args_pat = [r"#?(?P<tktnum>\d+)", … … 44 45 r"\[report:(?P<rptnum2>\d+)(?P<dv>\?.*)?\]", 45 46 r"(?P<width>\d+(pt|px|%))", 47 r"(?P<summary>summary)", 48 r"(?P<inline>inline)", 46 49 r"(?P<title1>'.*')", 47 50 r'(?P<title2>".*")'] … … 65 68 txt = '' 66 69 items = [] 70 long_items = {} 71 show_summary = False 72 inline = False 67 73 title = "Tickets" 68 74 args_re = re.compile("^(?:" + string.join(args_pat, "|") + ")$") … … 80 86 elif match.group('tktnum'): 81 87 items.append(int(match.group('tktnum'))) 88 elif match.group('summary'): 89 show_summary = True 90 elif match.group('inline'): 91 inline = True 82 92 elif match.group('rptnum') or match.group('rptnum2'): 83 93 num = match.group('rptnum') or match.group('rptnum2') … … 107 117 descriptions = [desc[0] for desc in curs.description] 108 118 idx = descriptions.index('ticket') 119 summ = descriptions.index('summary') 109 120 for row in rows: 110 121 items.append(row[idx]) 122 long_items[row[idx]] = row[summ] 111 123 finally: 112 124 if not hasattr(env, 'get_cnx_pool'): … … 117 129 items.sort() 118 130 html = '' 119 from trac.wiki.formatter import wiki_to_oneliner, wiki_to_outline 120 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 121 env, env.get_db_cnx(), req=formatter.req) 131 from trac.wiki.formatter import wiki_to_oneliner 132 if show_summary: 133 html = string.join([wiki_to_oneliner("%s (#%d)" % (v,k), 134 env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>") 135 else: 136 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 137 env, env.get_db_cnx(), req=formatter.req) 122 138 if html != '': 123 139 try: … … 125 141 except: 126 142 pass 127 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 143 if inline: 144 style = string.join(["%s:%s" % (k,v) for k,v in inline_styles.items() if v <> ""], "; ") 145 else: 146 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 128 147 return '<fieldset class="ticketbox" style="%s"><legend>%s</legend>%s</fieldset>' % \ 129 148 (style, title, html) ticketboxmacro/0.8/TicketBox.py
r2768 r2848 39 39 "width": "25%", 40 40 } 41 inline_styles = { "background": "#f7f7f0", } 41 42 42 43 args_pat = [r"#?(?P<tktnum>\d+)", … … 44 45 r"\[report:(?P<rptnum2>\d+)(?P<dv>\?.*)?\]", 45 46 r"(?P<width>\d+(pt|px|%))", 47 r"(?P<summary>summary)", 48 r"(?P<inline>inline)", 46 49 r"(?P<title1>'.*')", 47 50 r'(?P<title2>".*")'] … … 62 65 txt = '' 63 66 items = [] 67 long_items = {} 68 show_summary = False 69 inline = False 64 70 title = "Tickets" 65 71 args_re = re.compile("^(?:" + string.join(args_pat, "|") + ")$") … … 77 83 elif match.group('tktnum'): 78 84 items.append(int(match.group('tktnum'))) 85 elif match.group('summary'): 86 show_summary = True 87 elif match.group('inline'): 88 inline = True 79 89 elif match.group('rptnum') or match.group('rptnum2'): 80 90 num = match.group('rptnum') or match.group('rptnum2') … … 104 114 descriptions = [desc[0] for desc in curs.description] 105 115 idx = descriptions.index('ticket') 116 summ = descriptions.index('summary') 106 117 for row in rows: 107 118 items.append(row[idx]) 119 long_items[row[idx]] = row[summ] 108 120 finally: 109 121 if not hasattr(env, 'get_cnx_pool'): … … 117 129 # for trac 0.9 or later 118 130 from trac.wiki.formatter import wiki_to_oneliner 119 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),120 env, env.get_db_cnx())121 131 except: 122 132 # for trac 0.8.x 123 133 from trac.WikiFormatter import wiki_to_oneliner 134 135 if show_summary: 136 html = string.join([wiki_to_oneliner("%s (#%d)" % (v,k), 137 hdf, env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>") 138 else: 124 139 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 125 140 hdf, env, env.get_db_cnx()) 141 126 142 if html != '': 127 143 try: … … 129 145 except: 130 146 pass 131 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 147 if inline: 148 style = string.join(["%s:%s" % (k,v) for k,v in inline_styles.items() if v <> ""], "; ") 149 else: 150 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 132 151 return '<fieldset class="ticketbox" style="%s"><legend>%s</legend>%s</fieldset>' % \ 133 152 (style, title, html) ticketboxmacro/0.9/TicketBox.py
r2768 r2848 39 39 "width": "25%", 40 40 } 41 inline_styles = { "background": "#f7f7f0", } 41 42 42 43 args_pat = [r"#?(?P<tktnum>\d+)", … … 44 45 r"\[report:(?P<rptnum2>\d+)(?P<dv>\?.*)?\]", 45 46 r"(?P<width>\d+(pt|px|%))", 47 r"(?P<summary>summary)", 48 r"(?P<inline>inline)", 46 49 r"(?P<title1>'.*')", 47 50 r'(?P<title2>".*")'] … … 62 65 txt = '' 63 66 items = [] 67 long_items = {} 68 show_summary = False 69 inline = False 64 70 title = "Tickets" 65 71 args_re = re.compile("^(?:" + string.join(args_pat, "|") + ")$") … … 77 83 elif match.group('tktnum'): 78 84 items.append(int(match.group('tktnum'))) 85 elif match.group('summary'): 86 show_summary = True 87 elif match.group('inline'): 88 inline = True 79 89 elif match.group('rptnum') or match.group('rptnum2'): 80 90 num = match.group('rptnum') or match.group('rptnum2') … … 104 114 descriptions = [desc[0] for desc in curs.description] 105 115 idx = descriptions.index('ticket') 116 summ = descriptions.index('summary') 106 117 for row in rows: 107 118 items.append(row[idx]) 119 long_items[row[idx]] = row[summ] 108 120 finally: 109 121 if not hasattr(env, 'get_cnx_pool'): … … 117 129 # for trac 0.9 or later 118 130 from trac.wiki.formatter import wiki_to_oneliner 119 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),120 env, env.get_db_cnx())121 131 except: 122 132 # for trac 0.8.x 123 133 from trac.WikiFormatter import wiki_to_oneliner 134 135 if show_summary: 136 html = string.join([wiki_to_oneliner("%s (#%d)" % (v,k), 137 env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>") 138 else: 124 139 html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 125 hdf, env, env.get_db_cnx()) 140 env, env.get_db_cnx()) 141 126 142 if html != '': 127 143 try: … … 129 145 except: 130 146 pass 131 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 147 if inline: 148 style = string.join(["%s:%s" % (k,v) for k,v in inline_styles.items() if v <> ""], "; ") 149 else: 150 style = string.join(["%s:%s" % (k,v) for k,v in styles.items() if v <> ""], "; ") 132 151 return '<fieldset class="ticketbox" style="%s"><legend>%s</legend>%s</fieldset>' % \ 133 152 (style, title, html)
