Changeset 2059
- Timestamp:
- 02/27/07 23:03:22 (1 year ago)
- Files:
-
- wikiwygplugin/0.11/setup.py (modified) (1 diff)
- wikiwygplugin/0.11/wikiwyg/templates (added)
- wikiwygplugin/0.11/wikiwyg/templates/Trac.js (moved) (moved from wikiwygplugin/0.11/wikiwyg/htdocs/Trac.js) (1 diff)
- wikiwygplugin/0.11/wikiwyg/wikiwyg.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wikiwygplugin/0.11/setup.py
r2052 r2059 8 8 version = '1.0', 9 9 packages = ['wikiwyg'], 10 package_data = {'wikiwyg': ['htdocs/*.js', 'htdocs/*.css', 'htdocs/*.gif', 'htdocs/*.htc' ]}, # 'templates/*.html' can go back in here if we need it10 package_data = {'wikiwyg': ['htdocs/*.js', 'htdocs/*.css', 'htdocs/*.gif', 'htdocs/*.htc', 'templates/*.js']}, 11 11 12 12 author = "soloturn, Erik Rose, and Frank Wierzbicki", wikiwygplugin/0.11/wikiwyg/templates/Trac.js
r2038 r2059 2 2 // onload should wikify the html. search for a better possibility 3 3 // 4 onload = function() { 5 alert("wikifying start ..."); 6 var wiki = document.getElementById('wikipage'); 7 Wikiwyg.Trac.setup_wikiwyg_section(wiki, '<?cs var:htdocs_location ?>'); 8 } 4 addEvent("onload", ( 5 function() { 6 var div = $(".wikipage")[0]; // uses JQuery 7 Wikiwyg.Trac.setup_wikiwyg_section(div, '${href()}/chrome/'); //should be something like '/my-env/chrome/' 8 }) 9 ); 9 10 10 11 wikiwygplugin/0.11/wikiwyg/wikiwyg.py
r2053 r2059 1 1 # vim: expandtab tabstop=4 2 import re 2 3 3 4 from trac.core import * 4 5 from trac.web.chrome import ITemplateProvider, add_stylesheet, add_script 5 from trac.web.api import IRequestFilter 6 from trac.web.api import IRequestFilter, IRequestHandler 6 7 7 8 from pkg_resources import resource_filename 8 9 9 10 class TracWikiwygModule(Component): 10 implements(ITemplateProvider, IRequestFilter )11 implements(ITemplateProvider, IRequestFilter, IRequestHandler) 11 12 12 13 # ITemplateProvider methods 13 14 14 15 def get_templates_dirs(self): 15 return []16 yield resource_filename(__name__, 'templates') 16 17 17 18 def get_htdocs_dirs(self): … … 20 21 21 22 23 # IRequestHandler methods 24 25 def match_request(self, req): 26 """Return whether the handler wants to process the given request.""" 27 return re.match(r'^/wikiwyg(?:/(.*)|$)', req.path_info) is not None 28 29 def process_request(self, req): 30 """For now, just always return Trac.js, as it's the only template we have.""" 31 return 'Trac.js', {}, 'text/plain' # TODO: Should be text/javascript, of course, but there's a bug in 0.11 trunk (#4855) that invokes Genshi's XHTML mode for that. 32 33 22 34 # IRequestFilter methods 23 35 24 36 def pre_process_request(self, req, handler): 25 """Load Wikiwyg libs pages that make use of them."""37 """Load Wikiwyg libs on pages that make use of them.""" 26 38 def uses_wikiwyg(req): 27 39 """Return whether the page referenced by req can make use of Wikiwyg.""" … … 29 41 30 42 if uses_wikiwyg(req): 31 for curScript in [' Wikiwyg', 'Toolbar', 'Wysiwyg', 'Wikitext', 'Preview', 'Trac']: # 'ClientServer' (put this back in when you implement async save)43 for curScript in ['Util', 'Wikiwyg', 'Toolbar', 'Wysiwyg', 'Wikitext', 'Preview']: # 'ClientServer' (put this back in when you implement async save) 32 44 add_script(req, 'wikiwyg/%s.js' % curScript) 45 add_script(req, '/wikiwyg/Trac.js') 33 46 return handler 34 47
