--- a/.installed.cfg Wed May 20 12:37:53 2015 +0200
+++ b/.installed.cfg Wed Jun 17 10:01:07 2015 +0200
@@ -6,14 +6,14 @@
__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/chardetect
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/fanstatic-compile
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pyams_upgrade
+ /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/prequest
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pviews
- /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/prequest
- /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/proutes
+ /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pdistreport
+ /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pshell
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pserve
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/ptweens
- /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pshell
- /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pdistreport
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/pcreate
+ /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/proutes
__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-15.0-py3.4.egg zc.buildout-2.3.1-py3.4.egg
_b = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin
_d = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/develop-eggs
@@ -78,7 +78,7 @@
[test]
__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/parts/test
/home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin/test
-__buildout_signature__ = zc.recipe.testrunner-2.0.0-py3.4.egg zc.recipe.egg-2.0.1-py3.4.egg setuptools-15.0-py3.4.egg zope.testrunner-4.4.6-py3.4.egg zc.buildout-2.3.1-py3.4.egg zope.interface-4.1.2-py3.4-linux-x86_64.egg zope.exceptions-4.0.7-py3.4.egg six-1482e89f68d85eea27f4ed7749df2819
+__buildout_signature__ = zc.recipe.testrunner-2.0.0-py3.4.egg zc.recipe.egg-2.0.1-py3.4.egg setuptools-15.0-py3.4.egg zope.testrunner-4.4.6-py3.4.egg zc.buildout-2.3.1-py3.4.egg zope.interface-4.1.2-py3.4-linux-x86_64.egg zope.exceptions-4.0.7-py3.4.egg six-e6b62e54b4df360c40dfcbb76c1ecf1a
_b = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/bin
_d = /home/tflorac/Dropbox/src/PyAMS/pyams_thesaurus/develop-eggs
_e = /var/local/env/pyams/eggs
--- a/src/pyams_thesaurus.egg-info/SOURCES.txt Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus.egg-info/SOURCES.txt Wed Jun 17 10:01:07 2015 +0200
@@ -3,8 +3,8 @@
docs/HISTORY.txt
docs/README.txt
src/pyams_thesaurus/__init__.py
-src/pyams_thesaurus/configure.zcml
src/pyams_thesaurus/include.py
+src/pyams_thesaurus/index.py
src/pyams_thesaurus/schema.py
src/pyams_thesaurus/term.py
src/pyams_thesaurus/thesaurus.py
@@ -29,6 +29,9 @@
src/pyams_thesaurus/loader/config.py
src/pyams_thesaurus/loader/skos.py
src/pyams_thesaurus/loader/superdoc.py
+src/pyams_thesaurus/locales/pyams_thesaurus.pot
+src/pyams_thesaurus/locales/fr/LC_MESSAGES/pyams_thesaurus.mo
+src/pyams_thesaurus/locales/fr/LC_MESSAGES/pyams_thesaurus.po
src/pyams_thesaurus/rpc/__init__.py
src/pyams_thesaurus/rpc/json/__init__.py
src/pyams_thesaurus/tests/__init__.py
--- a/src/pyams_thesaurus/__init__.py Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/__init__.py Wed Jun 17 10:01:07 2015 +0200
@@ -35,10 +35,13 @@
config.register_role({'id': 'thesaurus.Admin',
'title': _("Thesaurus administrator (role)"),
'permissions': {'thesaurus.admin', 'thesaurus.manage', 'thesaurus.extract.manage',
- 'view', 'system.view'}})
+ 'view', 'system.view'},
+ 'managers': {'system:admin', 'role:system.Manager'}})
config.register_role({'id': 'thesaurus.Manager',
'title': _("Thesaurus content manager (role)"),
- 'permissions': {'thesaurus.manage', 'thesaurus.extract.manage', 'view', 'system.view'}})
+ 'permissions': {'thesaurus.manage', 'thesaurus.extract.manage', 'view', 'system.view'},
+ 'managers': {'system:admin', 'role:system.Manager', 'role:thesaurus.Admin'}})
config.register_role({'id': 'thesaurus.ExtractManager',
'title': _("Thesaurus extract manager (role)"),
- 'permissions': {'thesaurus.extract.manage', 'view', 'system.view'}})
+ 'permissions': {'thesaurus.extract.manage', 'view', 'system.view'},
+ 'managers': {'system:admin', 'role:system.Manager', 'role:thesaurus.Admin'}})
--- a/src/pyams_thesaurus/zmi/extract.py Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/extract.py Wed Jun 17 10:01:07 2015 +0200
@@ -18,7 +18,7 @@
# import interfaces
from pyams_form.interfaces.form import IWidgetsPrefixViewletsManager
-from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtracts, IThesaurusExtractInfo, \
IThesaurusExtract
@@ -119,7 +119,7 @@
@viewlet_config(name='thesaurus.extract.adding', context=IThesaurus, view=ThesaurusExtractsTable,
- layer=IAdminLayer, manager=IToolbarViewletManager, permission='thesaurus.admin')
+ layer=IAdminLayer, manager=IWidgetTitleViewletManager, permission='thesaurus.admin')
class ThesaurusExtractAddAction(ToolbarAction):
"""Thesaurus extract add action"""
--- a/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.js Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.js Wed Jun 17 10:01:07 2015 +0200
@@ -113,6 +113,7 @@
var element = $('span.term:withtext("' + data.term + '")').parents('span.label');
$('html,body').animate({scrollTop: element.offset().top - 100}, 1000);
element.css('background-color', 'darkgreen')
+ .off('mouseover')
.on('mouseover', function() {
$(this).css('background-color', '');
})
--- a/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.min.js Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.min.js Wed Jun 17 10:01:07 2015 +0200
@@ -1,1 +1,1 @@
-(function(a){PyAMS_thesaurus={tree:{displaySubNodes:function(f,d,b){if(b===undefined){b=a('span.term:withtext("'+f+'")').siblings("i[data-ams-click-handler]")}var n=b.parents("span.label").siblings("ul.group");var m=n.closest("ul.group").closest("li");n.empty();for(var h in d){var e=d[h];var o=a("<li></li>");e.extracts.reverse();for(var k in e.extracts){var g=e.extracts[k];var c=a("<div></div>").addClass("pull-right margin-right-2").appendTo(o);var p=a("<i></i>").attr("data-ams-extract-name",g.name).addClass("fa fa-fw fa-square extract-checker").css("color","#"+g.color).appendTo(c);var j=a('>div i.extract-checker[data-ams-extract-name="'+g.name+'"]',m);if(j.hasClass("used")){if(g.used){p.addClass("used")}else{p.removeClass("fa-square").addClass("fa-square-o")}var i=a("i.switcher",'table.extracts tr[data-ams-element-name="'+g.name+'"]');if(!i.hasClass("fa-eye")){p.css("visibility","hidden")}}else{p.addClass("disabled").css("color","silver")}}var l=a("<span></span>").addClass("label label-success").addClass(e.css_class).attr("data-ams-url",e.view).attr("data-toggle","modal");if(e.expand){a("<i></i>").addClass("fa fa-lg fa-plus-circle").attr("data-ams-click-handler","PyAMS_thesaurus.tree.expand").attr("data-ams-stop-propagation",true).appendTo(l)}a("<span></span>").addClass("term").html(e.label).appendTo(l);l.appendTo(o);a("<ul></ul>").addClass("hidden group").appendTo(o);o.appendTo(n);if(e.subnodes){PyAMS_thesaurus.tree.displaySubNodes(e.label,e.subnodes)}}n.removeClass("hidden");b.removeClass("fa-gear").addClass("fa-minus-circle")},expand:function(){var d=a(this);if(d.hasClass("fa-plus-circle")){d.removeClass("fa-plus-circle").addClass("fa-gear");var b=d.siblings("span.term").text();var c=d.closest("div.tree").data("ams-tree-context");MyAMS.ajax.post(c+"/get-nodes.json",{term:b},function(e){PyAMS_thesaurus.tree.displaySubNodes(b,e.nodes,d)})}else{PyAMS_thesaurus.tree.collapse.call(this)}},collapse:function(){var b=a(this);b.parents("span.label").siblings("ul.group").addClass("hidden");b.removeClass("fa-minus-circle").addClass("fa-plus-circle")},updateTerm:function(b){var c=a('span.term:withtext("'+b.term+'")').siblings("i[data-ams-click-handler]");if(c.hasClass("fa-minus-circle")){PyAMS_thesaurus.tree.collapse.call(c)}PyAMS_thesaurus.tree.expand.call(c)},findTerm:function(b){MyAMS.ajax.post("get-parent-nodes.json",{term:b.term},function(d){PyAMS_thesaurus.tree.displaySubNodes(d.parent,d.nodes);var c=a('span.term:withtext("'+d.term+'")').parents("span.label");a("html,body").animate({scrollTop:c.offset().top-100},1000);c.css("background-color","darkgreen").on("mouseover",function(){a(this).css("background-color","")})})},switchExtract:function(){return function(){var c=a("i.fa",a(this));var b=c.parents("tr:first").data("ams-element-name");if(c.hasClass("fa-eye-slash")){PyAMS_thesaurus.tree.showExtract.call(this,b,c)}else{PyAMS_thesaurus.tree.hideExtract.call(this,b,c)}}},showExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","");b.removeClass("fa-eye-slash").removeClass("text-danger").addClass("fa-eye")},hideExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","hidden");b.removeClass("fa-eye").addClass("fa-eye-slash").addClass("text-danger")}},search:function(){var b=a(this).val();PyAMS_thesaurus.tree.findTerm({term:b})}};a(document).on("click","i.extract-checker",function(d){var b=a(this);if(b.hasClass("disabled")){return}var c=a("span.term",b.closest("div").siblings("span"));MyAMS.ajax.post("switch-extract.json",{term:c.text(),extract:b.data("ams-extract-name")},function(e){if(e.status){MyAMS.ajax.handleJSON(e)}else{if(e.used){b.removeClass("fa-square-o").addClass("fa-square used");a('>li >div i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square disabled").addClass("fa-square-o").css("color","#"+e.color)}else{b.removeClass("fa-square used").addClass("fa-square-o");a('i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square-o").addClass("fa-square disabled").css("color","silver")}}})})})(jQuery);
\ No newline at end of file
+(function(a){PyAMS_thesaurus={tree:{displaySubNodes:function(f,d,b){if(b===undefined){b=a('span.term:withtext("'+f+'")').siblings("i[data-ams-click-handler]")}var n=b.parents("span.label").siblings("ul.group");var m=n.closest("ul.group").closest("li");n.empty();for(var h in d){var e=d[h];var o=a("<li></li>");e.extracts.reverse();for(var k in e.extracts){var g=e.extracts[k];var c=a("<div></div>").addClass("pull-right margin-right-2").appendTo(o);var p=a("<i></i>").attr("data-ams-extract-name",g.name).addClass("fa fa-fw fa-square extract-checker").css("color","#"+g.color).appendTo(c);var j=a('>div i.extract-checker[data-ams-extract-name="'+g.name+'"]',m);if(j.hasClass("used")){if(g.used){p.addClass("used")}else{p.removeClass("fa-square").addClass("fa-square-o")}var i=a("i.switcher",'table.extracts tr[data-ams-element-name="'+g.name+'"]');if(!i.hasClass("fa-eye")){p.css("visibility","hidden")}}else{p.addClass("disabled").css("color","silver")}}var l=a("<span></span>").addClass("label label-success").addClass(e.css_class).attr("data-ams-url",e.view).attr("data-toggle","modal");if(e.expand){a("<i></i>").addClass("fa fa-lg fa-plus-circle").attr("data-ams-click-handler","PyAMS_thesaurus.tree.expand").attr("data-ams-stop-propagation",true).appendTo(l)}a("<span></span>").addClass("term").html(e.label).appendTo(l);l.appendTo(o);a("<ul></ul>").addClass("hidden group").appendTo(o);o.appendTo(n);if(e.subnodes){PyAMS_thesaurus.tree.displaySubNodes(e.label,e.subnodes)}}n.removeClass("hidden");b.removeClass("fa-gear").addClass("fa-minus-circle")},expand:function(){var d=a(this);if(d.hasClass("fa-plus-circle")){d.removeClass("fa-plus-circle").addClass("fa-gear");var b=d.siblings("span.term").text();var c=d.closest("div.tree").data("ams-tree-context");MyAMS.ajax.post(c+"/get-nodes.json",{term:b},function(e){PyAMS_thesaurus.tree.displaySubNodes(b,e.nodes,d)})}else{PyAMS_thesaurus.tree.collapse.call(this)}},collapse:function(){var b=a(this);b.parents("span.label").siblings("ul.group").addClass("hidden");b.removeClass("fa-minus-circle").addClass("fa-plus-circle")},updateTerm:function(b){var c=a('span.term:withtext("'+b.term+'")').siblings("i[data-ams-click-handler]");if(c.hasClass("fa-minus-circle")){PyAMS_thesaurus.tree.collapse.call(c)}PyAMS_thesaurus.tree.expand.call(c)},findTerm:function(b){MyAMS.ajax.post("get-parent-nodes.json",{term:b.term},function(d){PyAMS_thesaurus.tree.displaySubNodes(d.parent,d.nodes);var c=a('span.term:withtext("'+d.term+'")').parents("span.label");a("html,body").animate({scrollTop:c.offset().top-100},1000);c.css("background-color","darkgreen").off("mouseover").on("mouseover",function(){a(this).css("background-color","")})})},switchExtract:function(){return function(){var c=a("i.fa",a(this));var b=c.parents("tr:first").data("ams-element-name");if(c.hasClass("fa-eye-slash")){PyAMS_thesaurus.tree.showExtract.call(this,b,c)}else{PyAMS_thesaurus.tree.hideExtract.call(this,b,c)}}},showExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","");b.removeClass("fa-eye-slash").removeClass("text-danger").addClass("fa-eye")},hideExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","hidden");b.removeClass("fa-eye").addClass("fa-eye-slash").addClass("text-danger")}},search:function(){var b=a(this).val();PyAMS_thesaurus.tree.findTerm({term:b})}};a(document).on("click","i.extract-checker",function(d){var b=a(this);if(b.hasClass("disabled")){return}var c=a("span.term",b.closest("div").siblings("span"));MyAMS.ajax.post("switch-extract.json",{term:c.text(),extract:b.data("ams-extract-name")},function(e){if(e.status){MyAMS.ajax.handleJSON(e)}else{if(e.used){b.removeClass("fa-square-o").addClass("fa-square used");a('>li >div i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square disabled").addClass("fa-square-o").css("color","#"+e.color)}else{b.removeClass("fa-square used").addClass("fa-square-o");a('i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square-o").addClass("fa-square disabled").css("color","silver")}}})})})(jQuery);
\ No newline at end of file
--- a/src/pyams_thesaurus/zmi/templates/terms-tree.pt Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/templates/terms-tree.pt Wed Jun 17 10:01:07 2015 +0200
@@ -14,6 +14,7 @@
<tal:var content="len(view.context.terms)" i18n:name="len" /> terms
</span>
</h2>
+ <tal:var content="structure provider:pyams.widget_title" />
<tal:var content="structure provider:pyams.toolbar" />
</header>
<div class="widget-body">
--- a/src/pyams_thesaurus/zmi/term.py Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/term.py Wed Jun 17 10:01:07 2015 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
from pyams_thesaurus.interfaces.term import IThesaurusTerm
from pyams_thesaurus.interfaces.thesaurus import IThesaurus
@@ -42,7 +42,7 @@
@viewlet_config(name='thesaurus.term.adding', context=IThesaurus, view=ThesaurusTermsView,
- layer=IAdminLayer, manager=IToolbarViewletManager, permission='thesaurus.manage')
+ layer=IAdminLayer, manager=IWidgetTitleViewletManager, permission='thesaurus.manage')
class ThesaurusTermAddAction(ToolbarAction):
"""Thesaurus term add action"""
@@ -76,7 +76,7 @@
self.widgets[name].thesaurus_name = self.context.name
def create(self, data):
- return ThesaurusTerm()
+ return ThesaurusTerm(data.get('label'))
def update_content(self, content, data):
super(ThesaurusTermAddForm, self).update_content(content, data)
@@ -111,11 +111,12 @@
"""Thesaurus term add form, AJAX view"""
def get_ajax_output(self, changes):
- if changes.generic is not None:
+ if changes.generic is None:
return super(ThesaurusTermAJAXAddForm, self).get_ajax_output(changes)
else:
label = changes.label.replace("'", "'")
- return {'callback': 'PyAMS_thesaurus.tree.findTerm',
+ return {'status': 'callback',
+ 'callback': 'PyAMS_thesaurus.tree.findTerm',
'options': {'term': label}}
--- a/src/pyams_thesaurus/zmi/thesaurus.py Wed May 20 12:37:53 2015 +0200
+++ b/src/pyams_thesaurus/zmi/thesaurus.py Wed Jun 17 10:01:07 2015 +0200
@@ -9,6 +9,7 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_utils.request import check_request
__docformat__ = 'restructuredtext'
@@ -38,7 +39,7 @@
from pyams_form.schema import CloseButton
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.layer import IPyAMSLayer
-from pyams_skin.page import InnerPage
+from pyams_skin.page import InnerPage, DefaultPageHeaderAdapter
from pyams_skin.table import DefaultElementEditorAdapter
from pyams_skin.viewlet.menu import MenuItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
@@ -46,7 +47,7 @@
from pyams_thesaurus.loader.config import ThesaurusUpdaterConfiguration, ThesaurusExporterConfiguration
from pyams_thesaurus.thesaurus import Thesaurus
from pyams_thesaurus.zmi.extract import ThesaurusExtractsTable
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter, ContextRequestViewAdapter
+from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import query_utility, get_utility
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url
@@ -146,7 +147,8 @@
return resource_url(self.context, self.request, 'admin.html#{0}'.format(self.view_name))
-class ThesaurusHeaderAdapter(ContextRequestViewAdapter):
+@adapter_config(context=(IThesaurus, IAdminLayer, Interface), provides=IPageHeader)
+class ThesaurusHeaderAdapter(DefaultPageHeaderAdapter):
"""Thesaurus views header adapter"""
@property
@@ -156,7 +158,12 @@
back_target = None
icon_class = 'fa fa-fw fa-language'
- title = _("Thesaurus management")
+
+ @property
+ def title(self):
+ request = check_request()
+ translate = request.localizer.translate
+ return translate(_("Thesaurus « {0} »")).format(self.context.name)
@viewlet_config(name='properties.menu', layer=IAdminLayer, context=IThesaurus, manager=ISiteManagementMenu,
@@ -201,12 +208,6 @@
"""Thesaurus properties edit form, AJAX view"""
-@adapter_config(context=(IThesaurus, IAdminLayer, ThesaurusPropertiesEditForm), provides=IPageHeader)
-class ThesaurusPropertiesEditFormHeaderAdapter(ThesaurusHeaderAdapter):
-
- subtitle = _("Thesaurus properties")
-
-
#
# Thesaurus terms views
#
@@ -248,12 +249,6 @@
return json.dumps({'thesaurus_name': self.context.name})
-@adapter_config(context=(IThesaurus, IPyAMSLayer, ThesaurusTermsView), provides=IPageHeader)
-class ThesaurusTermsHeaderAdapter(ThesaurusHeaderAdapter):
-
- subtitle = _("Thesaurus terms")
-
-
class BaseTreeNodesView(object):
"""Base tree nodes views"""