PKͽÂ4ctxtnavadd/__init__.pyPK{680ªªÁ‡‡ctxtnavadd/__init__.pyo;ò Dc@sdS(N((((s7build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/__init__.pys?sPKy68][P1{{ctxtnavadd/web_ui.pyc;ò ?”Dc@s‡dkTdklZlZdklZydklZeZWne j o e ZnXdk l Z dZ defd„ƒYZdS( (s*(sINavigationContributorsITemplateProvider(sMarkup(sadd_javascript(s ICtxtnavAdders1sCtxtnavAddModulecBsftZdZeeeƒeeƒZd„Z d„Z d„Z d„Z d„Z d„Zd„ZRS(sEAn evil module that adds buttons to the ctxtnav bar of other plugins.cCsdSdS(Ns((sselfsreq((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_active_navigation_itemscCsmdidddgƒ}tot||ƒn|i||ii|ƒƒ|i ||i |ƒƒgSdS(Ns/s ctxtnavaddsjss ctxtnavadd.js( sjoinsevil_jsshave_ajsadd_javascriptsreqsselfs _add_js_incshrefschromes_add_jss_make_js(sselfsreqsevil_js((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_navigation_itemss cCsdkl}gSdS(sr Return the absolute path of the directory containing the provided ClearSilver templates. (sresource_filenameN(s pkg_resourcessresource_filename(sselfsresource_filename((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_templates_dirs%s cCs'dkl}d|tdƒfgSdS(s§ Return a list of directories with static resources (such as style sheets, images, etc.) Each item in the list must be a `(prefix, abspath)` tuple. The `prefix` part defines the path in the URL that requests to these resources are prefixed with. The `abspath` is the absolute path to the directory containing the resources on the local file system. (sresource_filenames ctxtnavaddshtdocsN(s pkg_resourcessresource_filenames__name__(sselfsresource_filename((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_htdocs_dirs.s  cCs.|id}||7}t|ƒ|ids  cCs|i|t|ƒdS(s2Add a javascript include via hdf['project.footer']N(sselfs_add_jssreqs inc_scriptsfile(sselfsreqsfile((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys _add_js_incDsc Cság}x§|iD]œ}|i|ƒo†xƒ|i|ƒD]n}t|t ƒo#|i t |i ddƒƒƒq6|\}}|i t d|t i|tƒfƒƒq6WqqWd}x|D]}|d|7}q½Wd|SdS(sGenerate the needed Javascript.s's\'s%sssadd_ctxtnav('%s'); s*N(saddssselfsctxtnav_adderssaddersmatch_ctxtnav_addsreqsget_ctxtnav_addssadds isinstancesMarkupsappendsreplaceshrefstextsescapesFalsesjs(sselfsreqsaddsstextsjssaddshrefsadder((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys_make_jsHs  # 5(s__name__s __module__s__doc__s implementssINavigationContributorsITemplateProvidersExtensionPoints ICtxtnavAddersctxtnav_adderssget_active_navigation_itemsget_navigation_itemssget_templates_dirssget_htdocs_dirss_add_jss _add_js_incs_make_js(((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysCtxtnavAddModules       N(s trac.corestrac.web.chromesINavigationContributorsITemplateProviders trac.utilsMarkupsadd_javascriptsTrueshave_ajs ImportErrorsFalsesctxtnavadd.apis ICtxtnavAdders inc_scripts ComponentsCtxtnavAddModule(sINavigationContributorshave_ajs ICtxtnavAddersMarkups inc_scriptsITemplateProvidersadd_javascriptsCtxtnavAddModule((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys?s     PKú©Ä4žÄpá__ctxtnavadd/api.pyfrom trac.core import * class ICtxtnavAdder(Interface): """An extension point interface to adding ctxtnav entries.""" def match_ctxtnav_add(req): """Return True if you want to alter this requests ctxtnav bar.""" def get_ctxtnav_adds(req): """Return a list of the form (path, text) to be added to the bar.""" PK{68­7-\ÞÞctxtnavadd/api.pyo;ò É…ƒDc@s!dkTdefd„ƒYZdS((s*s ICtxtnavAddercBs tZdZd„Zd„ZRS(s7An extension point interface to adding ctxtnav entries.cCsdS(s;Return True if you want to alter this requests ctxtnav bar.N((sreq((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pysmatch_ctxtnav_addscCsdS(s>Return a list of the form (path, text) to be added to the bar.N((sreq((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pysget_ctxtnav_adds s(s__name__s __module__s__doc__smatch_ctxtnav_addsget_ctxtnav_adds(((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pys ICtxtnavAdders  N(s trac.cores Interfaces ICtxtnavAdder(s ICtxtnavAdder((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pys?sPK{68][P1{{ctxtnavadd/web_ui.pyo;ò ?”Dc@s‡dkTdklZlZdklZydklZeZWne j o e ZnXdk l Z dZ defd„ƒYZdS( (s*(sINavigationContributorsITemplateProvider(sMarkup(sadd_javascript(s ICtxtnavAdders1sCtxtnavAddModulecBsftZdZeeeƒeeƒZd„Z d„Z d„Z d„Z d„Z d„Zd„ZRS(sEAn evil module that adds buttons to the ctxtnav bar of other plugins.cCsdSdS(Ns((sselfsreq((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_active_navigation_itemscCsmdidddgƒ}tot||ƒn|i||ii|ƒƒ|i ||i |ƒƒgSdS(Ns/s ctxtnavaddsjss ctxtnavadd.js( sjoinsevil_jsshave_ajsadd_javascriptsreqsselfs _add_js_incshrefschromes_add_jss_make_js(sselfsreqsevil_js((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_navigation_itemss cCsdkl}gSdS(sr Return the absolute path of the directory containing the provided ClearSilver templates. (sresource_filenameN(s pkg_resourcessresource_filename(sselfsresource_filename((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_templates_dirs%s cCs'dkl}d|tdƒfgSdS(s§ Return a list of directories with static resources (such as style sheets, images, etc.) Each item in the list must be a `(prefix, abspath)` tuple. The `prefix` part defines the path in the URL that requests to these resources are prefixed with. The `abspath` is the absolute path to the directory containing the resources on the local file system. (sresource_filenames ctxtnavaddshtdocsN(s pkg_resourcessresource_filenames__name__(sselfsresource_filename((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysget_htdocs_dirs.s  cCs.|id}||7}t|ƒ|ids  cCs|i|t|ƒdS(s2Add a javascript include via hdf['project.footer']N(sselfs_add_jssreqs inc_scriptsfile(sselfsreqsfile((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys _add_js_incDsc Cság}x§|iD]œ}|i|ƒo†xƒ|i|ƒD]n}t|t ƒo#|i t |i ddƒƒƒq6|\}}|i t d|t i|tƒfƒƒq6WqqWd}x|D]}|d|7}q½Wd|SdS(sGenerate the needed Javascript.s's\'s%sssadd_ctxtnav('%s'); s*N(saddssselfsctxtnav_adderssaddersmatch_ctxtnav_addsreqsget_ctxtnav_addssadds isinstancesMarkupsappendsreplaceshrefstextsescapesFalsesjs(sselfsreqsaddsstextsjssaddshrefsadder((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys_make_jsHs  # 5(s__name__s __module__s__doc__s implementssINavigationContributorsITemplateProvidersExtensionPoints ICtxtnavAddersctxtnav_adderssget_active_navigation_itemsget_navigation_itemssget_templates_dirssget_htdocs_dirss_add_jss _add_js_incs_make_js(((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pysCtxtnavAddModules       N(s trac.corestrac.web.chromesINavigationContributorsITemplateProviders trac.utilsMarkupsadd_javascriptsTrueshave_ajs ImportErrorsFalsesctxtnavadd.apis ICtxtnavAdders inc_scripts ComponentsCtxtnavAddModule(sINavigationContributorshave_ajs ICtxtnavAddersMarkups inc_scriptsITemplateProvidersadd_javascriptsCtxtnavAddModule((s5build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/web_ui.pys?s     PKy680ªªÁ‡‡ctxtnavadd/__init__.pyc;ò Dc@sdS(N((((s7build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/__init__.pys?sPKy68­7-\ÞÞctxtnavadd/api.pyc;ò É…ƒDc@s!dkTdefd„ƒYZdS((s*s ICtxtnavAddercBs tZdZd„Zd„ZRS(s7An extension point interface to adding ctxtnav entries.cCsdS(s;Return True if you want to alter this requests ctxtnav bar.N((sreq((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pysmatch_ctxtnav_addscCsdS(s>Return a list of the form (path, text) to be added to the bar.N((sreq((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pysget_ctxtnav_adds s(s__name__s __module__s__doc__smatch_ctxtnav_addsget_ctxtnav_adds(((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pys ICtxtnavAdders  N(s trac.cores Interfaces ICtxtnavAdder(s ICtxtnavAdder((s2build/bdist.darwin-8.0.1-x86/egg/ctxtnavadd/api.pys?sPKÓZÑ4^ã)Áð ð ctxtnavadd/web_ui.pyfrom trac.core import * from trac.web.chrome import INavigationContributor, ITemplateProvider from trac.util import Markup try: from trac.web.chrome import add_javascript have_aj = True except ImportError: have_aj = False from ctxtnavadd.api import ICtxtnavAdder inc_script = """""" class CtxtnavAddModule(Component): """An evil module that adds buttons to the ctxtnav bar of other plugins.""" implements(INavigationContributor, ITemplateProvider) ctxtnav_adders = ExtensionPoint(ICtxtnavAdder) # INavigationContributor methods def get_active_navigation_item(self, req): return '' # This is never called def get_navigation_items(self, req): evil_js = '/'.join(['ctxtnavadd','js','ctxtnavadd.js']) if have_aj: add_javascript(req, evil_js) else: self._add_js_inc(req, req.href.chrome(evil_js)) self._add_js(req,self._make_js(req)) return [] # This returns no buttons # ITemplateProvider methods def get_templates_dirs(self): """ Return the absolute path of the directory containing the provided ClearSilver templates. """ from pkg_resources import resource_filename #return [resource_filename(__name__, 'templates')] return [] def get_htdocs_dirs(self): """ Return a list of directories with static resources (such as style sheets, images, etc.) Each item in the list must be a `(prefix, abspath)` tuple. The `prefix` part defines the path in the URL that requests to these resources are prefixed with. The `abspath` is the absolute path to the directory containing the resources on the local file system. """ from pkg_resources import resource_filename return [('ctxtnavadd', resource_filename(__name__, 'htdocs'))] # Internal methods def _add_js(self, req, data): """Add javascript to a page via hdf['project.footer']""" footer = req.hdf['project.footer'] footer += data req.hdf['project.footer'] = Markup(footer) def _add_js_inc(self, req, file): """Add a javascript include via hdf['project.footer']""" self._add_js(req, inc_script%file) def _make_js(self, req): """Generate the needed Javascript.""" adds = [] for adder in self.ctxtnav_adders: if adder.match_ctxtnav_add(req): for add in adder.get_ctxtnav_adds(req): if isinstance(add, Markup): adds.append(Markup(add.replace("'","\\'"))) else: href, text = add adds.append(Markup('%s'%(href,Markup.escape(text,False)))) js = "" for add in adds: js += "add_ctxtnav('%s');\n"%add return """"""%js PKͽÂ4†v©cc"ctxtnavadd/htdocs/js/ctxtnavadd.jsfunction find_old_last() { var ctxtnav = document.getElementById('ctxtnav'); for (var i in ctxtnav.childNodes) { if(ctxtnav.childNodes[i].tagName == 'UL') { var ul_node = ctxtnav.childNodes[i]; for (var j in ul_node.childNodes) { if(ul_node.childNodes[j].tagName == 'LI') { var li_node = ul_node.childNodes[j]; if(li_node.getAttribute('class') == 'last') { return(li_node); } } } } } } function add_ctxtnav(txt) { // Make a new
  • and find the old
  • var new_li = document.createElement('LI'); var old_li = find_old_last(); // Insert content new_li.innerHTML = txt; // Set the class on the new
  • and clear the old one new_li.setAttribute('class','last'); old_li.removeAttribute('class'); // Insert the new node old_li.parentNode.appendChild(new_li); } function add_ctxtnav_link(href, txt) { var html = '' + txt + ''; add_ctxtnav(html); } PKôÃ4k÷ÏçPP"ctxtnavadd/templates/ctxtnavadd.csadd_ctxtnav(''); PK}68“×2EGG-INFO/zip-safe PKv68-½ EGG-INFO/SOURCES.txtsetup.py TracCtxtnavAdd.egg-info/PKG-INFO TracCtxtnavAdd.egg-info/SOURCES.txt TracCtxtnavAdd.egg-info/dependency_links.txt TracCtxtnavAdd.egg-info/entry_points.txt TracCtxtnavAdd.egg-info/top_level.txt ctxtnavadd/__init__.py ctxtnavadd/api.py ctxtnavadd/web_ui.py PKu68Ž…=Ð66EGG-INFO/entry_points.txt[trac.plugins] ctxtnavadd.web_ui = ctxtnavadd.web_ui PKu68“×2EGG-INFO/dependency_links.txt PKu68W±u'¸¸EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TracCtxtnavAdd Version: 1.1-r1 Summary: Allow adding to the ctxtnav bar of other plugins. Home-page: http://trac-hacks.org/wiki/CtxtnavAddPlugin Author: Noah Kantrowitz Author-email: coderanger@yahoo.com License: BSD Description: Exposes an extension point interface for manipulating the ctxtnav bar (the little bar below the main navigation bar) of other plugins Keywords: trac plugin ctxtnav Platform: UNKNOWN PKu68ŸÐÁ} EGG-INFO/top_level.txtctxtnavadd PKͽÂ4¤ctxtnavadd/__init__.pyPK{680ªªÁ‡‡¤4ctxtnavadd/__init__.pyoPKy68][P1{{¤ðctxtnavadd/web_ui.pycPKú©Ä4žÄpá__¤žctxtnavadd/api.pyPK{68­7-\ÞÞ¤,ctxtnavadd/api.pyoPK{68][P1{{¤:ctxtnavadd/web_ui.pyoPKy680ªªÁ‡‡¤è+ctxtnavadd/__init__.pycPKy68­7-\ÞÞ¤¤,ctxtnavadd/api.pycPKÓZÑ4^ã)Áð 𠤲0ctxtnavadd/web_ui.pyPKͽÂ4†v©cc"¤Ô<ctxtnavadd/htdocs/js/ctxtnavadd.jsPKôÃ4k÷ÏçPP"¤wActxtnavadd/templates/ctxtnavadd.csPK}68“×2¤BEGG-INFO/zip-safePKv68-½ ¤7BEGG-INFO/SOURCES.txtPKu68Ž…=Ð66¤qCEGG-INFO/entry_points.txtPKu68“×2¤ÞCEGG-INFO/dependency_links.txtPKu68W±u'¸¸¤DEGG-INFO/PKG-INFOPKu68ŸÐÁ} ¤FEGG-INFO/top_level.txtPK‹@F