eea.facetednavigation 16.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eea/facetednavigation/README.txt +34 -0
- eea/facetednavigation/__init__.py +10 -0
- eea/facetednavigation/browser/__init__.py +2 -0
- eea/facetednavigation/browser/app/__init__.py +2 -0
- eea/facetednavigation/browser/app/catalog.py +43 -0
- eea/facetednavigation/browser/app/configure.py +307 -0
- eea/facetednavigation/browser/app/counter.py +77 -0
- eea/facetednavigation/browser/app/error.py +28 -0
- eea/facetednavigation/browser/app/exportimport.py +85 -0
- eea/facetednavigation/browser/app/query.py +209 -0
- eea/facetednavigation/browser/app/schema.py +39 -0
- eea/facetednavigation/browser/app/view.py +169 -0
- eea/facetednavigation/browser/configure.zcml +155 -0
- eea/facetednavigation/browser/interfaces.py +52 -0
- eea/facetednavigation/browser/javascript/edit.js +1198 -0
- eea/facetednavigation/browser/javascript/expand.js +107 -0
- eea/facetednavigation/browser/javascript/independent.js +25 -0
- eea/facetednavigation/browser/javascript/view.js +551 -0
- eea/facetednavigation/browser/static/30px.png +0 -0
- eea/facetednavigation/browser/static/32px.png +0 -0
- eea/facetednavigation/browser/static/README.md +6 -0
- eea/facetednavigation/browser/static/ajax-loader-small.gif +0 -0
- eea/facetednavigation/browser/static/ajax-loader.gif +0 -0
- eea/facetednavigation/browser/static/faceted-edit.css +325 -0
- eea/facetednavigation/browser/static/faceted-edit.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-edit.min.css +2 -0
- eea/facetednavigation/browser/static/faceted-edit.min.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-edit.min.js +1 -0
- eea/facetednavigation/browser/static/faceted-jquery.css +4117 -0
- eea/facetednavigation/browser/static/faceted-jquery.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-jquery.min.css +6 -0
- eea/facetednavigation/browser/static/faceted-jquery.min.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-jquery.min.js +2 -0
- eea/facetednavigation/browser/static/faceted-jquery.min.js.LICENSE.txt +263 -0
- eea/facetednavigation/browser/static/faceted-view.css +447 -0
- eea/facetednavigation/browser/static/faceted-view.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-view.min.css +2 -0
- eea/facetednavigation/browser/static/faceted-view.min.css.map +1 -0
- eea/facetednavigation/browser/static/faceted-view.min.js +1 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-bold-webfont.eot +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-bold-webfont.svg +2377 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-bold-webfont.ttf +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-bold-webfont.woff +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-extralight-webfont.eot +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-extralight-webfont.svg +2410 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-extralight-webfont.ttf +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-extralight-webfont.woff +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-regular-webfont.eot +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-regular-webfont.svg +2725 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-regular-webfont.ttf +0 -0
- eea/facetednavigation/browser/static/fonts/titillium/titilliumweb-regular-webfont.woff +0 -0
- eea/facetednavigation/browser/static/hide.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_444444_256x240.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_555555_256x240.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_777620_256x240.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_777777_256x240.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_cc0000_256x240.png +0 -0
- eea/facetednavigation/browser/static/images/ui-icons_ffffff_256x240.png +0 -0
- eea/facetednavigation/browser/static/select2-spinner.gif +0 -0
- eea/facetednavigation/browser/static/select2.png +0 -0
- eea/facetednavigation/browser/static/select2x2.png +0 -0
- eea/facetednavigation/browser/static/show.png +0 -0
- eea/facetednavigation/browser/static/throbber.gif +0 -0
- eea/facetednavigation/browser/stylesheets/edit.scss +383 -0
- eea/facetednavigation/browser/stylesheets/view.scss +126 -0
- eea/facetednavigation/browser/template/configure.pt +180 -0
- eea/facetednavigation/browser/template/counter.pt +0 -0
- eea/facetednavigation/browser/template/default.xml +54 -0
- eea/facetednavigation/browser/template/error.pt +15 -0
- eea/facetednavigation/browser/template/macros.pt +59 -0
- eea/facetednavigation/browser/template/query.pt +14 -0
- eea/facetednavigation/browser/template/simple_view.pt +9 -0
- eea/facetednavigation/browser/template/view.pt +34 -0
- eea/facetednavigation/browser/template/widgets.pt +57 -0
- eea/facetednavigation/caching/__init__.py +24 -0
- eea/facetednavigation/caching/cache.py +64 -0
- eea/facetednavigation/caching/configure.zcml +17 -0
- eea/facetednavigation/caching/nocache.py +24 -0
- eea/facetednavigation/config.py +6 -0
- eea/facetednavigation/configure.zcml +29 -0
- eea/facetednavigation/criteria/__init__.py +2 -0
- eea/facetednavigation/criteria/configure.zcml +12 -0
- eea/facetednavigation/criteria/handler.py +291 -0
- eea/facetednavigation/criteria/interfaces.py +7 -0
- eea/facetednavigation/criteria/utils.py +11 -0
- eea/facetednavigation/data/vocabularies/faceted_sortorder.vdex +115 -0
- eea/facetednavigation/docs/browser.txt +294 -0
- eea/facetednavigation/docs/counter.txt +76 -0
- eea/facetednavigation/docs/criteria.txt +134 -0
- eea/facetednavigation/docs/exportimport.txt +544 -0
- eea/facetednavigation/docs/facetednavigation.txt +113 -0
- eea/facetednavigation/docs/solr.txt +66 -0
- eea/facetednavigation/docs/syndication.txt +36 -0
- eea/facetednavigation/docs/unicode.txt +224 -0
- eea/facetednavigation/docs/versions.txt +175 -0
- eea/facetednavigation/docs/vocabularies.txt +69 -0
- eea/facetednavigation/docs/widgets.txt +10 -0
- eea/facetednavigation/docs/wrapper.txt +87 -0
- eea/facetednavigation/events.py +56 -0
- eea/facetednavigation/exportimport/__init__.py +2 -0
- eea/facetednavigation/exportimport/configure.zcml +27 -0
- eea/facetednavigation/exportimport/criteria.py +103 -0
- eea/facetednavigation/exportimport/criterion.py +75 -0
- eea/facetednavigation/exportimport/faceted.py +35 -0
- eea/facetednavigation/indexes/__init__.py +2 -0
- eea/facetednavigation/indexes/configure.zcml +8 -0
- eea/facetednavigation/indexes/language/__init__.py +2 -0
- eea/facetednavigation/indexes/language/adapter.py +77 -0
- eea/facetednavigation/indexes/language/configure.zcml +13 -0
- eea/facetednavigation/indexes/language/interfaces.py +7 -0
- eea/facetednavigation/interfaces.py +109 -0
- eea/facetednavigation/layout/__init__.py +2 -0
- eea/facetednavigation/layout/configure.zcml +38 -0
- eea/facetednavigation/layout/events.py +63 -0
- eea/facetednavigation/layout/interfaces.py +21 -0
- eea/facetednavigation/layout/layout.py +95 -0
- eea/facetednavigation/layout/menu.py +77 -0
- eea/facetednavigation/layout/overrides.zcml +13 -0
- eea/facetednavigation/locales/bg/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/bg/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/bg/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/bg/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/ca/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/ca/LC_MESSAGES/eea.po +1180 -0
- eea/facetednavigation/locales/ca/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/ca/LC_MESSAGES/plone.po +38 -0
- eea/facetednavigation/locales/cs/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/cs/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/cs/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/cs/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/da/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/da/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/da/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/da/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/de/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/de/LC_MESSAGES/eea.po +1236 -0
- eea/facetednavigation/locales/de/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/de/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/eea.pot +1182 -0
- eea/facetednavigation/locales/el/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/el/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/el/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/el/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/en/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/en/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/en/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/en/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/es/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/es/LC_MESSAGES/eea.po +1247 -0
- eea/facetednavigation/locales/es/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/es/LC_MESSAGES/plone.po +39 -0
- eea/facetednavigation/locales/et/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/et/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/et/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/et/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/eu/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/eu/LC_MESSAGES/eea.po +1247 -0
- eea/facetednavigation/locales/eu/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/eu/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/fi/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/fi/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/fi/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/fi/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/fr/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/fr/LC_MESSAGES/eea.po +1247 -0
- eea/facetednavigation/locales/fr/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/fr/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/hr/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/hr/LC_MESSAGES/eea.po +1182 -0
- eea/facetednavigation/locales/hr/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/hr/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/hu/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/hu/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/hu/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/hu/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/is/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/is/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/is/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/is/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/it/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/it/LC_MESSAGES/eea.po +1242 -0
- eea/facetednavigation/locales/it/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/it/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/kl/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/kl/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/kl/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/kl/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/lt/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/lt/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/lt/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/lt/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/lv/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/lv/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/lv/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/lv/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/mt/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/mt/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/mt/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/mt/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/nl/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/nl/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/nl/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/nl/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/no/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/no/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/no/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/no/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/pl/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/pl/LC_MESSAGES/eea.po +1242 -0
- eea/facetednavigation/locales/pl/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/pl/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/plone-manual.pot +38 -0
- eea/facetednavigation/locales/pt/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/pt/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/pt/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/pt/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/pt_BR/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/pt_BR/LC_MESSAGES/eea.po +1180 -0
- eea/facetednavigation/locales/pt_BR/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/pt_BR/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/ro/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/ro/LC_MESSAGES/eea.po +1244 -0
- eea/facetednavigation/locales/ro/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/ro/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/ru/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/ru/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/ru/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/ru/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/sk/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/sk/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/sk/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/sk/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/sl/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/sl/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/sl/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/sl/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/sv/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/sv/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/sv/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/sv/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/tr/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/tr/LC_MESSAGES/eea.po +1179 -0
- eea/facetednavigation/locales/tr/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/tr/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/locales/update.sh +6 -0
- eea/facetednavigation/locales/zh_TW/LC_MESSAGES/eea.mo +0 -0
- eea/facetednavigation/locales/zh_TW/LC_MESSAGES/eea.po +1243 -0
- eea/facetednavigation/locales/zh_TW/LC_MESSAGES/plone.mo +0 -0
- eea/facetednavigation/locales/zh_TW/LC_MESSAGES/plone.po +37 -0
- eea/facetednavigation/meta.zcml +22 -0
- eea/facetednavigation/overrides.zcml +11 -0
- eea/facetednavigation/permissions.zcml +12 -0
- eea/facetednavigation/plonex.py +36 -0
- eea/facetednavigation/profiles/default/actions.xml +67 -0
- eea/facetednavigation/profiles/default/eea.facetednavigation.txt +0 -0
- eea/facetednavigation/profiles/default/metadata.xml +4 -0
- eea/facetednavigation/profiles/default/registry.xml +48 -0
- eea/facetednavigation/profiles/default/rolemap.xml +11 -0
- eea/facetednavigation/profiles/uninstall/actions.xml +11 -0
- eea/facetednavigation/profiles/uninstall/eea.facetednavigation.txt +0 -0
- eea/facetednavigation/profiles/uninstall/registry.xml +8 -0
- eea/facetednavigation/profiles.zcml +42 -0
- eea/facetednavigation/search/__init__.py +2 -0
- eea/facetednavigation/search/catalog.py +84 -0
- eea/facetednavigation/search/configure.zcml +8 -0
- eea/facetednavigation/search/interfaces.py +10 -0
- eea/facetednavigation/settings/__init__.py +2 -0
- eea/facetednavigation/settings/configure.zcml +34 -0
- eea/facetednavigation/settings/interfaces.py +52 -0
- eea/facetednavigation/settings/menu.py +170 -0
- eea/facetednavigation/setuphandlers.py +92 -0
- eea/facetednavigation/subtypes/__init__.py +2 -0
- eea/facetednavigation/subtypes/configure.zcml +61 -0
- eea/facetednavigation/subtypes/interfaces.py +45 -0
- eea/facetednavigation/subtypes/subtyper.py +130 -0
- eea/facetednavigation/subtypes/wrapper.py +39 -0
- eea/facetednavigation/syndication/__init__.py +2 -0
- eea/facetednavigation/syndication/configure.zcml +13 -0
- eea/facetednavigation/syndication/feed.py +19 -0
- eea/facetednavigation/tests/__init__.py +2 -0
- eea/facetednavigation/tests/autocomplete.py +33 -0
- eea/facetednavigation/tests/autocomplete.zcml +15 -0
- eea/facetednavigation/tests/base.py +49 -0
- eea/facetednavigation/tests/configure.zcml +17 -0
- eea/facetednavigation/tests/data/criteria_with_purge_false.xml +15 -0
- eea/facetednavigation/tests/data/criteria_with_purge_true.xml +15 -0
- eea/facetednavigation/tests/data/criterion_with_purge_false.xml +15 -0
- eea/facetednavigation/tests/data/criterion_with_purge_true.xml +15 -0
- eea/facetednavigation/tests/data/exportimport.xml +31 -0
- eea/facetednavigation/tests/profiles/testing/types/Document.xml +6 -0
- eea/facetednavigation/tests/profiles/testing/types.xml +4 -0
- eea/facetednavigation/tests/test_bundles.py +42 -0
- eea/facetednavigation/tests/test_doctests.py +139 -0
- eea/facetednavigation/tests/utils.py +39 -0
- eea/facetednavigation/upgrades/__init__.py +2 -0
- eea/facetednavigation/upgrades/configure.zcml +28 -0
- eea/facetednavigation/upgrades/evolve165.py +13 -0
- eea/facetednavigation/utils.py +66 -0
- eea/facetednavigation/version.txt +1 -0
- eea/facetednavigation/versions/__init__.py +2 -0
- eea/facetednavigation/versions/browser.py +78 -0
- eea/facetednavigation/versions/configure.zcml +20 -0
- eea/facetednavigation/versions/events.py +16 -0
- eea/facetednavigation/versions/interfaces.py +15 -0
- eea/facetednavigation/views/__init__.py +2 -0
- eea/facetednavigation/views/configure.zcml +41 -0
- eea/facetednavigation/views/example/__init__.py +2 -0
- eea/facetednavigation/views/example/configure.zcml +24 -0
- eea/facetednavigation/views/example/summary.pt +74 -0
- eea/facetednavigation/views/example/summary.py +20 -0
- eea/facetednavigation/views/interfaces.py +7 -0
- eea/facetednavigation/views/meta.py +63 -0
- eea/facetednavigation/views/preview-item.pt +10 -0
- eea/facetednavigation/views/preview-items.pt +38 -0
- eea/facetednavigation/views/preview.py +74 -0
- eea/facetednavigation/vocabularies/__init__.py +2 -0
- eea/facetednavigation/vocabularies/autocomplete.py +44 -0
- eea/facetednavigation/vocabularies/catalog.py +204 -0
- eea/facetednavigation/vocabularies/configure.zcml +101 -0
- eea/facetednavigation/vocabularies/faceted.py +62 -0
- eea/facetednavigation/vocabularies/portal.py +55 -0
- eea/facetednavigation/vocabularies/position.py +23 -0
- eea/facetednavigation/vocabularies/section.py +19 -0
- eea/facetednavigation/vocabularies/simple.py +40 -0
- eea/facetednavigation/vocabularies/types.py +23 -0
- eea/facetednavigation/vocabularies/utils.py +10 -0
- eea/facetednavigation/widgets/__init__.py +12 -0
- eea/facetednavigation/widgets/alphabetic/__init__.py +2 -0
- eea/facetednavigation/widgets/alphabetic/adapters.py +48 -0
- eea/facetednavigation/widgets/alphabetic/alphabets.py +1042 -0
- eea/facetednavigation/widgets/alphabetic/configure.zcml +19 -0
- eea/facetednavigation/widgets/alphabetic/edit.js +80 -0
- eea/facetednavigation/widgets/alphabetic/edit.scss +0 -0
- eea/facetednavigation/widgets/alphabetic/interfaces.py +44 -0
- eea/facetednavigation/widgets/alphabetic/tests.py +32 -0
- eea/facetednavigation/widgets/alphabetic/view.js +229 -0
- eea/facetednavigation/widgets/alphabetic/view.scss +47 -0
- eea/facetednavigation/widgets/alphabetic/widget.pt +45 -0
- eea/facetednavigation/widgets/alphabetic/widget.py +64 -0
- eea/facetednavigation/widgets/alphabetic/widget.txt +104 -0
- eea/facetednavigation/widgets/autocomplete/__init__.py +2 -0
- eea/facetednavigation/widgets/autocomplete/configure.zcml +20 -0
- eea/facetednavigation/widgets/autocomplete/edit.js +52 -0
- eea/facetednavigation/widgets/autocomplete/edit.scss +0 -0
- eea/facetednavigation/widgets/autocomplete/interfaces.py +77 -0
- eea/facetednavigation/widgets/autocomplete/tests.py +32 -0
- eea/facetednavigation/widgets/autocomplete/view.js +245 -0
- eea/facetednavigation/widgets/autocomplete/view.scss +52 -0
- eea/facetednavigation/widgets/autocomplete/widget.pt +63 -0
- eea/facetednavigation/widgets/autocomplete/widget.py +117 -0
- eea/facetednavigation/widgets/autocomplete/widget.txt +142 -0
- eea/facetednavigation/widgets/boolean/__init__.py +2 -0
- eea/facetednavigation/widgets/boolean/configure.zcml +12 -0
- eea/facetednavigation/widgets/boolean/interfaces.py +48 -0
- eea/facetednavigation/widgets/boolean/widget.pt +46 -0
- eea/facetednavigation/widgets/boolean/widget.py +56 -0
- eea/facetednavigation/widgets/checkbox/__init__.py +2 -0
- eea/facetednavigation/widgets/checkbox/configure.zcml +12 -0
- eea/facetednavigation/widgets/checkbox/edit.js +115 -0
- eea/facetednavigation/widgets/checkbox/edit.scss +0 -0
- eea/facetednavigation/widgets/checkbox/interfaces.py +104 -0
- eea/facetednavigation/widgets/checkbox/view.js +319 -0
- eea/facetednavigation/widgets/checkbox/view.scss +59 -0
- eea/facetednavigation/widgets/checkbox/widget.pt +75 -0
- eea/facetednavigation/widgets/checkbox/widget.py +102 -0
- eea/facetednavigation/widgets/configure.zcml +30 -0
- eea/facetednavigation/widgets/criteria/__init__.py +2 -0
- eea/facetednavigation/widgets/criteria/configure.zcml +12 -0
- eea/facetednavigation/widgets/criteria/edit.js +0 -0
- eea/facetednavigation/widgets/criteria/edit.scss +0 -0
- eea/facetednavigation/widgets/criteria/interfaces.py +35 -0
- eea/facetednavigation/widgets/criteria/view.js +123 -0
- eea/facetednavigation/widgets/criteria/view.scss +61 -0
- eea/facetednavigation/widgets/criteria/widget.pt +36 -0
- eea/facetednavigation/widgets/criteria/widget.py +17 -0
- eea/facetednavigation/widgets/date/__init__.py +2 -0
- eea/facetednavigation/widgets/date/configure.zcml +12 -0
- eea/facetednavigation/widgets/date/edit.js +89 -0
- eea/facetednavigation/widgets/date/edit.scss +0 -0
- eea/facetednavigation/widgets/date/interfaces.py +36 -0
- eea/facetednavigation/widgets/date/tests.py +32 -0
- eea/facetednavigation/widgets/date/view.js +195 -0
- eea/facetednavigation/widgets/date/view.scss +10 -0
- eea/facetednavigation/widgets/date/widget.pt +40 -0
- eea/facetednavigation/widgets/date/widget.py +166 -0
- eea/facetednavigation/widgets/date/widget.txt +225 -0
- eea/facetednavigation/widgets/daterange/__init__.py +2 -0
- eea/facetednavigation/widgets/daterange/configure.zcml +12 -0
- eea/facetednavigation/widgets/daterange/edit.js +114 -0
- eea/facetednavigation/widgets/daterange/edit.scss +0 -0
- eea/facetednavigation/widgets/daterange/interfaces.py +102 -0
- eea/facetednavigation/widgets/daterange/tests.py +32 -0
- eea/facetednavigation/widgets/daterange/utils.py +117 -0
- eea/facetednavigation/widgets/daterange/view.js +308 -0
- eea/facetednavigation/widgets/daterange/view.scss +14 -0
- eea/facetednavigation/widgets/daterange/widget.pt +61 -0
- eea/facetednavigation/widgets/daterange/widget.py +184 -0
- eea/facetednavigation/widgets/daterange/widget.txt +280 -0
- eea/facetednavigation/widgets/debug/__init__.py +2 -0
- eea/facetednavigation/widgets/debug/browser.py +161 -0
- eea/facetednavigation/widgets/debug/configure.zcml +58 -0
- eea/facetednavigation/widgets/debug/edit.js +104 -0
- eea/facetednavigation/widgets/debug/edit.scss +0 -0
- eea/facetednavigation/widgets/debug/interfaces.py +35 -0
- eea/facetednavigation/widgets/debug/view.js +109 -0
- eea/facetednavigation/widgets/debug/view.scss +6 -0
- eea/facetednavigation/widgets/debug/vocabulary.py +21 -0
- eea/facetednavigation/widgets/debug/widget.pt +43 -0
- eea/facetednavigation/widgets/debug/widget.py +17 -0
- eea/facetednavigation/widgets/etag/__init__.py +2 -0
- eea/facetednavigation/widgets/etag/configure.zcml +12 -0
- eea/facetednavigation/widgets/etag/edit.js +51 -0
- eea/facetednavigation/widgets/etag/edit.scss +0 -0
- eea/facetednavigation/widgets/etag/interfaces.py +52 -0
- eea/facetednavigation/widgets/etag/view.js +0 -0
- eea/facetednavigation/widgets/etag/view.scss +0 -0
- eea/facetednavigation/widgets/etag/widget.pt +25 -0
- eea/facetednavigation/widgets/etag/widget.py +16 -0
- eea/facetednavigation/widgets/interfaces.py +156 -0
- eea/facetednavigation/widgets/multiselect/__init__.py +2 -0
- eea/facetednavigation/widgets/multiselect/configure.zcml +12 -0
- eea/facetednavigation/widgets/multiselect/edit.js +131 -0
- eea/facetednavigation/widgets/multiselect/edit.scss +0 -0
- eea/facetednavigation/widgets/multiselect/interfaces.py +120 -0
- eea/facetednavigation/widgets/multiselect/view.js +383 -0
- eea/facetednavigation/widgets/multiselect/view.scss +65 -0
- eea/facetednavigation/widgets/multiselect/widget.pt +73 -0
- eea/facetednavigation/widgets/multiselect/widget.py +107 -0
- eea/facetednavigation/widgets/path/__init__.py +2 -0
- eea/facetednavigation/widgets/path/configure.zcml +28 -0
- eea/facetednavigation/widgets/path/edit.js +63 -0
- eea/facetednavigation/widgets/path/edit.scss +0 -0
- eea/facetednavigation/widgets/path/interfaces.py +67 -0
- eea/facetednavigation/widgets/path/tree.js +99 -0
- eea/facetednavigation/widgets/path/tree.py +171 -0
- eea/facetednavigation/widgets/path/view.js +158 -0
- eea/facetednavigation/widgets/path/view.scss +16 -0
- eea/facetednavigation/widgets/path/widget.pt +29 -0
- eea/facetednavigation/widgets/path/widget.py +134 -0
- eea/facetednavigation/widgets/portlet/__init__.py +2 -0
- eea/facetednavigation/widgets/portlet/configure.zcml +12 -0
- eea/facetednavigation/widgets/portlet/edit.js +0 -0
- eea/facetednavigation/widgets/portlet/edit.scss +0 -0
- eea/facetednavigation/widgets/portlet/interfaces.py +34 -0
- eea/facetednavigation/widgets/portlet/view.js +23 -0
- eea/facetednavigation/widgets/portlet/view.scss +6 -0
- eea/facetednavigation/widgets/portlet/widget.pt +20 -0
- eea/facetednavigation/widgets/portlet/widget.py +46 -0
- eea/facetednavigation/widgets/radio/__init__.py +2 -0
- eea/facetednavigation/widgets/radio/configure.zcml +12 -0
- eea/facetednavigation/widgets/radio/edit.js +76 -0
- eea/facetednavigation/widgets/radio/edit.scss +0 -0
- eea/facetednavigation/widgets/radio/interfaces.py +76 -0
- eea/facetednavigation/widgets/radio/view.js +262 -0
- eea/facetednavigation/widgets/radio/view.scss +11 -0
- eea/facetednavigation/widgets/radio/widget.pt +71 -0
- eea/facetednavigation/widgets/radio/widget.py +53 -0
- eea/facetednavigation/widgets/range/__init__.py +2 -0
- eea/facetednavigation/widgets/range/configure.zcml +12 -0
- eea/facetednavigation/widgets/range/edit.js +66 -0
- eea/facetednavigation/widgets/range/edit.scss +0 -0
- eea/facetednavigation/widgets/range/interfaces.py +78 -0
- eea/facetednavigation/widgets/range/tests.py +32 -0
- eea/facetednavigation/widgets/range/view.js +176 -0
- eea/facetednavigation/widgets/range/view.scss +14 -0
- eea/facetednavigation/widgets/range/widget.pt +50 -0
- eea/facetednavigation/widgets/range/widget.py +74 -0
- eea/facetednavigation/widgets/range/widget.txt +153 -0
- eea/facetednavigation/widgets/resultsfilter/__init__.py +2 -0
- eea/facetednavigation/widgets/resultsfilter/adapters.py +18 -0
- eea/facetednavigation/widgets/resultsfilter/configure.zcml +19 -0
- eea/facetednavigation/widgets/resultsfilter/edit.js +54 -0
- eea/facetednavigation/widgets/resultsfilter/edit.scss +0 -0
- eea/facetednavigation/widgets/resultsfilter/interfaces.py +41 -0
- eea/facetednavigation/widgets/resultsfilter/tests.py +32 -0
- eea/facetednavigation/widgets/resultsfilter/view.js +0 -0
- eea/facetednavigation/widgets/resultsfilter/view.scss +0 -0
- eea/facetednavigation/widgets/resultsfilter/widget.pt +24 -0
- eea/facetednavigation/widgets/resultsfilter/widget.py +94 -0
- eea/facetednavigation/widgets/resultsfilter/widget.txt +66 -0
- eea/facetednavigation/widgets/resultsperpage/__init__.py +2 -0
- eea/facetednavigation/widgets/resultsperpage/configure.zcml +12 -0
- eea/facetednavigation/widgets/resultsperpage/edit.js +47 -0
- eea/facetednavigation/widgets/resultsperpage/edit.scss +0 -0
- eea/facetednavigation/widgets/resultsperpage/interfaces.py +65 -0
- eea/facetednavigation/widgets/resultsperpage/view.js +159 -0
- eea/facetednavigation/widgets/resultsperpage/view.scss +5 -0
- eea/facetednavigation/widgets/resultsperpage/widget.pt +45 -0
- eea/facetednavigation/widgets/resultsperpage/widget.py +71 -0
- eea/facetednavigation/widgets/schema.pt +36 -0
- eea/facetednavigation/widgets/schema.py +31 -0
- eea/facetednavigation/widgets/select/__init__.py +2 -0
- eea/facetednavigation/widgets/select/configure.zcml +12 -0
- eea/facetednavigation/widgets/select/edit.js +63 -0
- eea/facetednavigation/widgets/select/edit.scss +0 -0
- eea/facetednavigation/widgets/select/interfaces.py +68 -0
- eea/facetednavigation/widgets/select/view.js +239 -0
- eea/facetednavigation/widgets/select/view.scss +24 -0
- eea/facetednavigation/widgets/select/widget.pt +59 -0
- eea/facetednavigation/widgets/select/widget.py +44 -0
- eea/facetednavigation/widgets/sorting/__init__.py +2 -0
- eea/facetednavigation/widgets/sorting/configure.zcml +12 -0
- eea/facetednavigation/widgets/sorting/edit.js +55 -0
- eea/facetednavigation/widgets/sorting/edit.scss +0 -0
- eea/facetednavigation/widgets/sorting/interfaces.py +35 -0
- eea/facetednavigation/widgets/sorting/view.js +213 -0
- eea/facetednavigation/widgets/sorting/view.scss +9 -0
- eea/facetednavigation/widgets/sorting/widget.pt +58 -0
- eea/facetednavigation/widgets/sorting/widget.py +80 -0
- eea/facetednavigation/widgets/storage.py +65 -0
- eea/facetednavigation/widgets/tagscloud/__init__.py +2 -0
- eea/facetednavigation/widgets/tagscloud/configure.zcml +20 -0
- eea/facetednavigation/widgets/tagscloud/counter.pt +0 -0
- eea/facetednavigation/widgets/tagscloud/counter.py +79 -0
- eea/facetednavigation/widgets/tagscloud/edit.js +150 -0
- eea/facetednavigation/widgets/tagscloud/edit.scss +0 -0
- eea/facetednavigation/widgets/tagscloud/interfaces.py +154 -0
- eea/facetednavigation/widgets/tagscloud/tagcloud.js +210 -0
- eea/facetednavigation/widgets/tagscloud/view.js +301 -0
- eea/facetednavigation/widgets/tagscloud/view.scss +33 -0
- eea/facetednavigation/widgets/tagscloud/widget.pt +65 -0
- eea/facetednavigation/widgets/tagscloud/widget.py +100 -0
- eea/facetednavigation/widgets/tal/__init__.py +2 -0
- eea/facetednavigation/widgets/tal/configure.zcml +12 -0
- eea/facetednavigation/widgets/tal/edit.js +54 -0
- eea/facetednavigation/widgets/tal/edit.scss +0 -0
- eea/facetednavigation/widgets/tal/interfaces.py +42 -0
- eea/facetednavigation/widgets/tal/tests.py +32 -0
- eea/facetednavigation/widgets/tal/view.js +0 -0
- eea/facetednavigation/widgets/tal/view.scss +0 -0
- eea/facetednavigation/widgets/tal/widget.pt +24 -0
- eea/facetednavigation/widgets/tal/widget.py +118 -0
- eea/facetednavigation/widgets/tal/widget.txt +216 -0
- eea/facetednavigation/widgets/text/__init__.py +2 -0
- eea/facetednavigation/widgets/text/configure.zcml +12 -0
- eea/facetednavigation/widgets/text/edit.js +52 -0
- eea/facetednavigation/widgets/text/edit.scss +0 -0
- eea/facetednavigation/widgets/text/interfaces.py +64 -0
- eea/facetednavigation/widgets/text/tests.py +32 -0
- eea/facetednavigation/widgets/text/view.js +190 -0
- eea/facetednavigation/widgets/text/view.scss +15 -0
- eea/facetednavigation/widgets/text/widget.pt +53 -0
- eea/facetednavigation/widgets/text/widget.py +77 -0
- eea/facetednavigation/widgets/text/widget.txt +153 -0
- eea/facetednavigation/widgets/widget.py +386 -0
- eea/facetednavigation/widgets/widgets.py +127 -0
- eea.facetednavigation-16.5-py3.14-nspkg.pth +1 -0
- eea_facetednavigation-16.5.dist-info/METADATA +1617 -0
- eea_facetednavigation-16.5.dist-info/RECORD +553 -0
- eea_facetednavigation-16.5.dist-info/WHEEL +5 -0
- eea_facetednavigation-16.5.dist-info/entry_points.txt +2 -0
- eea_facetednavigation-16.5.dist-info/namespace_packages.txt +1 -0
- eea_facetednavigation-16.5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
""" Abstract widgets
|
|
2
|
+
"""
|
|
3
|
+
from eea.facetednavigation.interfaces import IFacetedCatalog
|
|
4
|
+
from eea.facetednavigation.interfaces import ILanguageWidgetAdapter
|
|
5
|
+
from eea.facetednavigation.plonex import HAVE_SOLR
|
|
6
|
+
from eea.facetednavigation.plonex import ISolrSearch
|
|
7
|
+
from eea.facetednavigation.plonex import SolrConnectionException
|
|
8
|
+
from eea.facetednavigation.plonex import SolrInactiveException
|
|
9
|
+
from eea.facetednavigation.widgets.interfaces import CountableSchemata
|
|
10
|
+
from eea.facetednavigation.widgets.interfaces import DefaultSchemata
|
|
11
|
+
from eea.facetednavigation.widgets.interfaces import IWidget
|
|
12
|
+
from eea.facetednavigation.widgets.interfaces import LayoutSchemata
|
|
13
|
+
from plone.i18n.normalizer import urlnormalizer as normalizer
|
|
14
|
+
from Products.CMFCore.utils import getToolByName
|
|
15
|
+
from Products.CMFPlone.utils import safe_unicode
|
|
16
|
+
from Products.CMFPlone.utils import safeToInt
|
|
17
|
+
from z3c.form.form import Form
|
|
18
|
+
from z3c.form.group import GroupForm
|
|
19
|
+
from z3c.form.interfaces import IGroup
|
|
20
|
+
from zope import interface
|
|
21
|
+
from zope.component import queryMultiAdapter
|
|
22
|
+
from zope.component import queryUtility
|
|
23
|
+
from zope.i18n import translate
|
|
24
|
+
from zope.i18nmessageid.message import Message
|
|
25
|
+
from zope.schema.interfaces import IVocabularyFactory
|
|
26
|
+
from ZTUtils.Lazy import LazyMap
|
|
27
|
+
|
|
28
|
+
import logging
|
|
29
|
+
import re
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
logger = logging.getLogger("eea.facetednavigation")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def lowercase(value):
|
|
36
|
+
try:
|
|
37
|
+
return value[1].lower()
|
|
38
|
+
except AttributeError:
|
|
39
|
+
return value[1]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Faceted Widget
|
|
44
|
+
#
|
|
45
|
+
@interface.implementer(IWidget)
|
|
46
|
+
class Widget(GroupForm, Form):
|
|
47
|
+
"""All faceted widgets should inherit from this class"""
|
|
48
|
+
|
|
49
|
+
# z3c.form
|
|
50
|
+
groups = (DefaultSchemata, LayoutSchemata)
|
|
51
|
+
|
|
52
|
+
# Faceted Widget properties
|
|
53
|
+
widget_type = "abstract"
|
|
54
|
+
widget_label = "Abstract"
|
|
55
|
+
|
|
56
|
+
def __init__(self, context, request, data=None):
|
|
57
|
+
self.context = context
|
|
58
|
+
self.request = request
|
|
59
|
+
self.request.debug = False
|
|
60
|
+
self.data = data
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def prefix(self):
|
|
64
|
+
"""Form prefix"""
|
|
65
|
+
cid = self.data.getId()
|
|
66
|
+
return cid
|
|
67
|
+
|
|
68
|
+
def getContent(self):
|
|
69
|
+
"""Content"""
|
|
70
|
+
return self.data
|
|
71
|
+
|
|
72
|
+
def update(self):
|
|
73
|
+
"""Update"""
|
|
74
|
+
self.updateWidgets(prefix=self.prefix)
|
|
75
|
+
groups = []
|
|
76
|
+
for groupClass in self.groups:
|
|
77
|
+
if IGroup.providedBy(groupClass):
|
|
78
|
+
group = groupClass
|
|
79
|
+
else:
|
|
80
|
+
group = groupClass(self.data, self.request, self)
|
|
81
|
+
group.updateWidgets(prefix=self.prefix)
|
|
82
|
+
groups.append(group)
|
|
83
|
+
self.groups = tuple(groups)
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def template(self):
|
|
87
|
+
"""Widget template"""
|
|
88
|
+
return self.index()
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def css_class(self):
|
|
92
|
+
"""Widget specific css class"""
|
|
93
|
+
css_type = self.widget_type
|
|
94
|
+
css_title = normalizer.normalize(self.data.title)
|
|
95
|
+
return "faceted-{0}-widget section-{1}{2}".format(
|
|
96
|
+
css_type, css_title, self.custom_css
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def hidden(self):
|
|
101
|
+
"""Widget hidden?"""
|
|
102
|
+
return self.data.hidden
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def custom_css(self):
|
|
106
|
+
if self.data.custom_css:
|
|
107
|
+
return " {}".format(self.data.custom_css)
|
|
108
|
+
return ""
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def default(self):
|
|
112
|
+
"""Get default values"""
|
|
113
|
+
# Language widget has custom behaviour so be sure you keep
|
|
114
|
+
# this in your widget
|
|
115
|
+
index = self.data.get("index", None)
|
|
116
|
+
if index == "Language":
|
|
117
|
+
language_widget = queryMultiAdapter(
|
|
118
|
+
(self, self.context), ILanguageWidgetAdapter
|
|
119
|
+
)
|
|
120
|
+
if language_widget:
|
|
121
|
+
return language_widget.default
|
|
122
|
+
# Take value from request parameter, for example ?SearchableText=test.
|
|
123
|
+
from_request = self.request.form.pop(index, None)
|
|
124
|
+
if from_request is not None:
|
|
125
|
+
return from_request
|
|
126
|
+
return self.data.get("default", None)
|
|
127
|
+
|
|
128
|
+
def query(self, form):
|
|
129
|
+
"""Get value from form and return a catalog dict query"""
|
|
130
|
+
return {}
|
|
131
|
+
|
|
132
|
+
def translate(self, message):
|
|
133
|
+
"""Use zope.i18n to translate message"""
|
|
134
|
+
if not message:
|
|
135
|
+
return ""
|
|
136
|
+
|
|
137
|
+
if isinstance(message, Message):
|
|
138
|
+
# message is an i18n message
|
|
139
|
+
return translate(message, context=self.request)
|
|
140
|
+
|
|
141
|
+
# message is a simple msgid
|
|
142
|
+
for domain in ["eea", "plone"]:
|
|
143
|
+
if isinstance(message, bytes):
|
|
144
|
+
try:
|
|
145
|
+
message = message.decode("utf-8")
|
|
146
|
+
except Exception as err:
|
|
147
|
+
logger.exception(err)
|
|
148
|
+
continue
|
|
149
|
+
|
|
150
|
+
value = translate(message, domain=domain, context=self.request)
|
|
151
|
+
if value != message:
|
|
152
|
+
return value
|
|
153
|
+
return message
|
|
154
|
+
|
|
155
|
+
def cleanup(self, string):
|
|
156
|
+
"""Quote string"""
|
|
157
|
+
safe = re.compile(r"[^_A-Za-z0-9\-]")
|
|
158
|
+
return safe.sub("-", string)
|
|
159
|
+
|
|
160
|
+
def word_break(self, text="", insert="<wbr />", nchars=15):
|
|
161
|
+
"""Insert a string (insert) every space or if a word length is bigger
|
|
162
|
+
than given chars, every ${chars} characters.
|
|
163
|
+
|
|
164
|
+
Example:
|
|
165
|
+
>>> text = 'this is a bigwordwith_and-and.jpg'
|
|
166
|
+
>>> print word_break(text, nchars=10)
|
|
167
|
+
this is a bigwordwit<wbr />h_and-and.<wbr />jpg
|
|
168
|
+
"""
|
|
169
|
+
list_text = text.split(" ")
|
|
170
|
+
res = []
|
|
171
|
+
for word in list_text:
|
|
172
|
+
word = [word[i : i + nchars] for i in range(0, len(word), nchars)]
|
|
173
|
+
word = insert.join(word)
|
|
174
|
+
res.append(word)
|
|
175
|
+
return " ".join(res)
|
|
176
|
+
|
|
177
|
+
def catalog_vocabulary(self):
|
|
178
|
+
"""Get vocabulary from catalog"""
|
|
179
|
+
catalog = self.data.get("catalog", "portal_catalog")
|
|
180
|
+
ctool = getToolByName(self.context, catalog)
|
|
181
|
+
if not ctool:
|
|
182
|
+
return []
|
|
183
|
+
|
|
184
|
+
index = self.data.get("index", None)
|
|
185
|
+
if not index:
|
|
186
|
+
return []
|
|
187
|
+
|
|
188
|
+
index = ctool.Indexes.get(index, None)
|
|
189
|
+
if not index:
|
|
190
|
+
return []
|
|
191
|
+
|
|
192
|
+
res = []
|
|
193
|
+
for val in index.uniqueValues():
|
|
194
|
+
if isinstance(val, (int, float)):
|
|
195
|
+
val = str(val)
|
|
196
|
+
|
|
197
|
+
elif not isinstance(val, str):
|
|
198
|
+
try:
|
|
199
|
+
val = safe_unicode(str(val))
|
|
200
|
+
except Exception:
|
|
201
|
+
continue
|
|
202
|
+
|
|
203
|
+
val = val.strip()
|
|
204
|
+
if not val:
|
|
205
|
+
continue
|
|
206
|
+
|
|
207
|
+
if val not in res:
|
|
208
|
+
res.append(val)
|
|
209
|
+
|
|
210
|
+
return res
|
|
211
|
+
|
|
212
|
+
def portal_vocabulary(self):
|
|
213
|
+
"""Look up selected vocabulary from ZTK zope-vocabulary factory."""
|
|
214
|
+
voc_id = self.data.get("vocabulary", None)
|
|
215
|
+
if not voc_id:
|
|
216
|
+
return []
|
|
217
|
+
|
|
218
|
+
voc = queryUtility(IVocabularyFactory, voc_id, None)
|
|
219
|
+
if not voc:
|
|
220
|
+
return []
|
|
221
|
+
|
|
222
|
+
values = []
|
|
223
|
+
for term in voc(self.context):
|
|
224
|
+
value = term.value
|
|
225
|
+
if isinstance(value, bytes):
|
|
226
|
+
value = value.decode("utf-8")
|
|
227
|
+
values.append((value, (term.title or term.token or value)))
|
|
228
|
+
return values
|
|
229
|
+
|
|
230
|
+
def vocabulary(self, **kwargs):
|
|
231
|
+
"""Return data vocabulary"""
|
|
232
|
+
reverse = safeToInt(self.data.get("sortreversed", 0))
|
|
233
|
+
mapping = self.portal_vocabulary()
|
|
234
|
+
catalog = self.data.get("catalog", None)
|
|
235
|
+
|
|
236
|
+
if catalog:
|
|
237
|
+
mapping = dict(mapping)
|
|
238
|
+
values = []
|
|
239
|
+
|
|
240
|
+
if HAVE_SOLR:
|
|
241
|
+
try:
|
|
242
|
+
# get values from SOLR if collective.solr is present
|
|
243
|
+
searchutility = queryUtility(ISolrSearch)
|
|
244
|
+
if searchutility is not None:
|
|
245
|
+
index = self.data.get("index", None)
|
|
246
|
+
kw = {
|
|
247
|
+
"facet": "on",
|
|
248
|
+
"facet.field": index, # facet on index
|
|
249
|
+
"facet.limit": -1, # show unlimited results
|
|
250
|
+
"rows": 0,
|
|
251
|
+
} # no results needed
|
|
252
|
+
result = searchutility.search("*:*", **kw)
|
|
253
|
+
try:
|
|
254
|
+
values = list(
|
|
255
|
+
result.facet_counts["facet_fields"][index].keys()
|
|
256
|
+
)
|
|
257
|
+
except (AttributeError, KeyError):
|
|
258
|
+
pass
|
|
259
|
+
except (SolrConnectionException, SolrInactiveException):
|
|
260
|
+
# solr is down or disabled
|
|
261
|
+
pass
|
|
262
|
+
|
|
263
|
+
if not values:
|
|
264
|
+
values = self.catalog_vocabulary()
|
|
265
|
+
|
|
266
|
+
res = [(val, mapping.get(val, val)) for val in values]
|
|
267
|
+
res.sort(key=lowercase)
|
|
268
|
+
else:
|
|
269
|
+
res = mapping
|
|
270
|
+
|
|
271
|
+
if reverse:
|
|
272
|
+
res.reverse()
|
|
273
|
+
return res
|
|
274
|
+
|
|
275
|
+
def __call__(self, **kwargs):
|
|
276
|
+
""" """
|
|
277
|
+
return self.template
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class CountableWidget(Widget):
|
|
281
|
+
"""Defines useful methods for countable widgets"""
|
|
282
|
+
|
|
283
|
+
groups = Widget.groups + (CountableSchemata,)
|
|
284
|
+
|
|
285
|
+
@property
|
|
286
|
+
def countable(self):
|
|
287
|
+
"""Count results?"""
|
|
288
|
+
return bool(safeToInt(self.data.get("count", 0)))
|
|
289
|
+
|
|
290
|
+
@property
|
|
291
|
+
def sortcountable(self):
|
|
292
|
+
"""Sort results by countable value?"""
|
|
293
|
+
return bool(safeToInt(self.data.get("sortcountable", 0)))
|
|
294
|
+
|
|
295
|
+
@property
|
|
296
|
+
def hidezerocount(self):
|
|
297
|
+
"""Hide items that return no result?"""
|
|
298
|
+
return bool(safeToInt(self.data.get("hidezerocount", 0)))
|
|
299
|
+
|
|
300
|
+
faceted_field = True
|
|
301
|
+
|
|
302
|
+
def facet_counts(self, brains):
|
|
303
|
+
"""Count"""
|
|
304
|
+
res = {}
|
|
305
|
+
facet_fields = brains.facet_counts.get("facet_fields")
|
|
306
|
+
if facet_fields:
|
|
307
|
+
index_id = self.data.get("index")
|
|
308
|
+
facet_field = facet_fields.get(index_id, {})
|
|
309
|
+
for value, num in facet_field.items():
|
|
310
|
+
normalized_value = safe_unicode(value)
|
|
311
|
+
if isinstance(value, str):
|
|
312
|
+
res[value] = num
|
|
313
|
+
elif isinstance(normalized_value, str):
|
|
314
|
+
res[normalized_value] = num
|
|
315
|
+
else:
|
|
316
|
+
unicode_value = value.decode("utf-8")
|
|
317
|
+
res[unicode_value] = num
|
|
318
|
+
else:
|
|
319
|
+
# no facet counts were returned. we exit anyway because
|
|
320
|
+
# zcatalog methods throw an error on solr responses
|
|
321
|
+
return res
|
|
322
|
+
|
|
323
|
+
res[""] = res["all"] = len(brains)
|
|
324
|
+
return res
|
|
325
|
+
|
|
326
|
+
def count(self, brains, sequence=None):
|
|
327
|
+
"""Intersect results"""
|
|
328
|
+
res = {}
|
|
329
|
+
# by checking for facet_counts we assume this is a SolrResponse
|
|
330
|
+
# from collective.solr
|
|
331
|
+
if hasattr(brains, "facet_counts"):
|
|
332
|
+
return self.facet_counts(brains)
|
|
333
|
+
|
|
334
|
+
# this is handled by the zcatalog.
|
|
335
|
+
if not sequence:
|
|
336
|
+
sequence = [key for key, value in self.vocabulary()]
|
|
337
|
+
|
|
338
|
+
if not sequence:
|
|
339
|
+
return res
|
|
340
|
+
|
|
341
|
+
index_id = self.data.get("index")
|
|
342
|
+
if not index_id:
|
|
343
|
+
return res
|
|
344
|
+
|
|
345
|
+
ctool = getToolByName(self.context, "portal_catalog")
|
|
346
|
+
index = ctool._catalog.getIndex(index_id)
|
|
347
|
+
ctool = queryUtility(IFacetedCatalog)
|
|
348
|
+
if not ctool:
|
|
349
|
+
return res
|
|
350
|
+
|
|
351
|
+
if isinstance(brains, LazyMap):
|
|
352
|
+
values = brains._seq
|
|
353
|
+
# 75384 seq might be a pair of tuples instead of ints
|
|
354
|
+
# if you upgrade to ZCatalog 3
|
|
355
|
+
if isinstance(values[0], tuple):
|
|
356
|
+
values = [v[1] for v in values]
|
|
357
|
+
brains = frozenset(values)
|
|
358
|
+
else:
|
|
359
|
+
brains = frozenset(brain.getRID() for brain in brains)
|
|
360
|
+
|
|
361
|
+
res[""] = res["all"] = len(brains)
|
|
362
|
+
for value in sequence:
|
|
363
|
+
normalized_value = safe_unicode(value)
|
|
364
|
+
if index.meta_type == "BooleanIndex":
|
|
365
|
+
if normalized_value in ("False", 0):
|
|
366
|
+
normalized_value = False
|
|
367
|
+
elif normalized_value in ("True", 1):
|
|
368
|
+
normalized_value = True
|
|
369
|
+
if not value:
|
|
370
|
+
res[value] = len(brains)
|
|
371
|
+
continue
|
|
372
|
+
|
|
373
|
+
rset = ctool.apply_index(self.context, index, normalized_value)[0]
|
|
374
|
+
rset = frozenset(rset)
|
|
375
|
+
rset = brains.intersection(rset)
|
|
376
|
+
if isinstance(value, str):
|
|
377
|
+
res[value] = len(rset)
|
|
378
|
+
elif isinstance(normalized_value, str):
|
|
379
|
+
res[normalized_value] = len(rset)
|
|
380
|
+
elif isinstance(normalized_value, bool):
|
|
381
|
+
# We only get here for true values, not for false.
|
|
382
|
+
res["selected"] = len(rset)
|
|
383
|
+
else:
|
|
384
|
+
unicode_value = value.decode("utf-8")
|
|
385
|
+
res[unicode_value] = len(rset)
|
|
386
|
+
return res
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
""" Faceted widgets
|
|
2
|
+
"""
|
|
3
|
+
import warnings
|
|
4
|
+
from zope.interface import implementer
|
|
5
|
+
from zope.component.zcml import adapter
|
|
6
|
+
from eea.facetednavigation.widgets.interfaces import ICriterion
|
|
7
|
+
from eea.facetednavigation.widgets.interfaces import IWidgetsInfo
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@implementer(IWidgetsInfo)
|
|
11
|
+
class WidgetsInfo(object):
|
|
12
|
+
"""Widgets registry"""
|
|
13
|
+
|
|
14
|
+
_widgets = {}
|
|
15
|
+
_schemas = {}
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def widgets(self):
|
|
19
|
+
"""Widgets"""
|
|
20
|
+
return self._widgets
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def schemas(self):
|
|
24
|
+
"""Widgets schemas"""
|
|
25
|
+
return self._schemas
|
|
26
|
+
|
|
27
|
+
def widget(self, name, default=None):
|
|
28
|
+
"""Get widget by name"""
|
|
29
|
+
return self.widgets.get(name, default)
|
|
30
|
+
|
|
31
|
+
def schema(self, name, default=None):
|
|
32
|
+
"""Return widget schema by name"""
|
|
33
|
+
return self.schemas.get(name, default)
|
|
34
|
+
|
|
35
|
+
def __call__(self, key):
|
|
36
|
+
"""Get widget by key or raise"""
|
|
37
|
+
return self.widgets.get(key)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class WidgetData(object):
|
|
41
|
+
"""Get data to populate widget with"""
|
|
42
|
+
|
|
43
|
+
def __init__(self, context):
|
|
44
|
+
self.context = context
|
|
45
|
+
|
|
46
|
+
def __getattr__(self, name, default=None):
|
|
47
|
+
return self.context.get(name, default)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def WidgetDirective(
|
|
51
|
+
_context,
|
|
52
|
+
factory=None,
|
|
53
|
+
schema=None,
|
|
54
|
+
accessor=WidgetData,
|
|
55
|
+
criterion=ICriterion,
|
|
56
|
+
**kwargs
|
|
57
|
+
):
|
|
58
|
+
"""Register faceted widgets"""
|
|
59
|
+
if not factory:
|
|
60
|
+
raise TypeError("No factory provided")
|
|
61
|
+
|
|
62
|
+
name = getattr(factory, "widget_type", None)
|
|
63
|
+
if not name:
|
|
64
|
+
raise TypeError("Invalid factory: widget_type property is empty or not defined")
|
|
65
|
+
|
|
66
|
+
WidgetsInfo._widgets[name] = factory
|
|
67
|
+
|
|
68
|
+
if schema is None:
|
|
69
|
+
raise TypeError("No schema provided for faceted widget type '%s'" % name)
|
|
70
|
+
|
|
71
|
+
WidgetsInfo._schemas[name] = schema
|
|
72
|
+
adapter(_context=_context, provides=schema, factory=(accessor,), for_=(criterion,))
|
|
73
|
+
|
|
74
|
+
#
|
|
75
|
+
# Ensure custom Faceted Navigation widgets were upgraded
|
|
76
|
+
#
|
|
77
|
+
edit_schema = getattr(factory, "edit_schema", None)
|
|
78
|
+
if edit_schema is not None:
|
|
79
|
+
warnings.warn(
|
|
80
|
+
"'edit_schema' attribute is deprecated. "
|
|
81
|
+
"Please remove it from your custom Faceted Widget: %s" % name,
|
|
82
|
+
DeprecationWarning,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
view_schema = getattr(factory, "view_schema", None)
|
|
86
|
+
if view_schema is not None:
|
|
87
|
+
warnings.warn(
|
|
88
|
+
"'view_schema' attribute is deprecated. "
|
|
89
|
+
"Please remove it from your custom Faceted Widget: %s" % name,
|
|
90
|
+
DeprecationWarning,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
view_css = getattr(factory, "view_css", None)
|
|
94
|
+
if view_css is not None:
|
|
95
|
+
warnings.warn(
|
|
96
|
+
"'view_css' attribute is deprecated. "
|
|
97
|
+
"Please remove it from your custom Faceted Widget: %s "
|
|
98
|
+
"and register it within registry.xml/cssregistry,xml" % name,
|
|
99
|
+
DeprecationWarning,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
edit_css = getattr(factory, "edit_css", None)
|
|
103
|
+
if edit_css is not None:
|
|
104
|
+
warnings.warn(
|
|
105
|
+
"'edit_css' attribute is deprecated. "
|
|
106
|
+
"Please remove it from your custom Faceted Widget: %s "
|
|
107
|
+
"and register it within registry.xml/cssregistry,xml" % name,
|
|
108
|
+
DeprecationWarning,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
view_js = getattr(factory, "view_js", None)
|
|
112
|
+
if view_js is not None:
|
|
113
|
+
warnings.warn(
|
|
114
|
+
"'view_js' attribute is deprecated. "
|
|
115
|
+
"Please remove it from your custom Faceted Widget: %s "
|
|
116
|
+
"and register it within registry.xml/jsregistry,xml" % name,
|
|
117
|
+
DeprecationWarning,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
edit_js = getattr(factory, "edit_js", None)
|
|
121
|
+
if edit_js is not None:
|
|
122
|
+
warnings.warn(
|
|
123
|
+
"'edit_js' attribute is deprecated. "
|
|
124
|
+
"Please remove it from your custom Faceted Widget: %s "
|
|
125
|
+
"and register it within registry.xml/jsregistry,xml" % name,
|
|
126
|
+
DeprecationWarning,
|
|
127
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('eea',));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('eea', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('eea', [os.path.dirname(p)])));m = m or sys.modules.setdefault('eea', types.ModuleType('eea'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
|