Changeset 3531
- Timestamp:
- 04/20/08 06:21:56 (7 months ago)
- Files:
-
- ccselectorplugin/0.10/cc_selector/cc_selector.py (modified) (1 diff)
- ccselectorplugin/0.10/cc_selector/htdocs/cc_selector.js (modified) (2 diffs)
- ccselectorplugin/0.10/setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ccselectorplugin/0.10/cc_selector/cc_selector.py
r3454 r3531 1 1 import re 2 2 from trac.core import * 3 from trac.web.api import IRequestFilter 3 4 from trac.web.chrome import add_script, \ 4 INavigationContributor, \5 5 ITemplateProvider 6 7 import trac 6 8 7 9 8 10 class TicketWebUiAddon(Component): 9 implements(I NavigationContributor, ITemplateProvider)11 implements(IRequestFilter, ITemplateProvider) 10 12 11 13 def __init__(self): 12 14 pass 13 14 def get_navigation_items(self, req): 15 if re.search('ticket', req.path_info): 16 add_script(req, 'cc_selector/cc_selector.js') 17 return [] 15 16 # IRequestFilter methods 17 # for trac 0.10 we call add_script in post_process_request 18 # for trac 0.11 we call add_script in pre_process_request 19 def pre_process_request(self, req, handler): 20 if trac.__version__.startswith('0.11'): 21 if re.search('ticket', req.path_info): 22 add_script(req, 'cc_selector/cc_selector.js') 23 return handler 24 def post_process_request(self, req, template, content_type): 25 if trac.__version__.startswith('0.10'): 26 if re.search('ticket', req.path_info): 27 add_script(req, 'cc_selector/cc_selector.js') 28 return(template, content_type) 18 29 19 30 # ITemplateProvider ccselectorplugin/0.10/cc_selector/htdocs/cc_selector.js
r3492 r3531 43 43 } 44 44 45 function guess_cc_field() 46 { 47 doc = document; 48 49 if (window.opener) 50 { 51 // alert("QQ1: shifting to parent"); 52 doc = window.opener.document; 53 } 54 55 cc_field = "cc"; 56 if (doc.getElementById(cc_field)) 57 return cc_field; 58 59 cc_field = "field-cc"; 60 if (doc.getElementById(cc_field)) 61 return cc_field; 62 63 64 // alert("QQ2: could not find cc field, giving up"); 65 } 66 45 67 // onload function. Used in both ticket window and in pop-up. 46 68 function afterLoad() 47 69 { 48 after_field = "cc"; 49 p = document.getElementById(after_field); 50 if ( ! p ) 70 71 // guess fromid (possible values: cc, from-cc) 72 cc_field = guess_cc_field() 73 74 nurl = document.location.href.split('/'); 75 if ( nurl.pop() == 'cc_selector.html') 51 76 { 52 split_into_checkboxes('cc', 'ccdiv') 53 return; 77 // we're in pop-up window 78 // create checkboxes 79 split_into_checkboxes(cc_field, 'ccdiv') 54 80 } 55 56 p = p.parentNode; 57 58 var ccb = document.createElement('input'); 59 ccb.setAttribute("type", "button"); 60 ccb.setAttribute("id", "ccbutton"); 61 ccb.setAttribute("name", "ccbutton"); 62 ccb.setAttribute("value", ">"); 63 ccb.setAttribute("alt", "Extended CC selection"); 64 // ccb.setAttribute("onClick", "show_selection()"); 65 ccb.onclick = show_selection; 66 p.appendChild(ccb); 81 else 82 { 83 // we're on ticket window 84 // create button 85 p = document.getElementById(cc_field); 86 p = p.parentNode; 87 88 var ccb = document.createElement('input'); 89 ccb.setAttribute("type", "button"); 90 ccb.setAttribute("id", "ccbutton"); 91 ccb.setAttribute("name", "ccbutton"); 92 ccb.setAttribute("value", ">"); 93 ccb.setAttribute("alt", "Extended CC selection"); 94 // ccb.setAttribute("onClick", "show_selection()"); 95 ccb.onclick = show_selection; 96 p.appendChild(ccb); 97 } 67 98 } 68 99 … … 127 158 function split_into_checkboxes(fromid, toid) { 128 159 t = document.getElementById(toid); 129 160 130 161 devs = split_field(fromid); 131 162 ccselectorplugin/0.10/setup.py
r3454 r3531 8 8 description='Visual cc editor for Trac', 9 9 keywords='cc checkbox editor', 10 version='0.0. 1',10 version='0.0.2', 11 11 author='Vladislav Naumov', 12 12 author_email='vnaum@vnaum.com',
