--- a/src/pyams_content/shared/view/interfaces.py Mon Nov 26 17:06:03 2018 +0100
+++ b/src/pyams_content/shared/view/interfaces.py Tue Nov 27 08:50:02 2018 +0100
@@ -30,6 +30,7 @@
VIEW_CONTENT_TYPE = 'view'
VIEW_CONTENT_NAME = _('View')
+RELEVANCE_ORDER = 'relevance'
CREATION_DATE_ORDER = 'created_date'
UPDATE_DATE_ORDER = 'modified_date'
PUBLICATION_DATE_ORDER = 'publication_date'
@@ -46,6 +47,18 @@
for item in VIEW_ORDERS])
+USER_VIEW_ORDERS = (
+ {'id': RELEVANCE_ORDER, 'title': _("Relevance (on user search)")},
+ {'id': CREATION_DATE_ORDER, 'title': _("Creation date")},
+ {'id': UPDATE_DATE_ORDER, 'title': _("Last update date")},
+ {'id': PUBLICATION_DATE_ORDER, 'title': _("Current publication date")},
+ {'id': FIRSTPUBLICATION_DATE_ORDER, 'title': _("First publication date")}
+)
+
+USER_VIEW_ORDER_VOCABULARY = SimpleVocabulary([SimpleTerm(item['id'], title=item['title'])
+ for item in USER_VIEW_ORDERS])
+
+
class IViewsManager(ISharedTool):
"""Views manager interface"""
@@ -101,7 +114,8 @@
is_using_context = Attribute("Check if view is using context settings")
- def get_results(self, context, sort_index=None, reverse=True, limit=None, ignore_cache=False):
+ def get_results(self, context, sort_index=None, reverse=True, limit=None,
+ start=0, length=999, ignore_cache=False, get_count=False):
"""Get results of catalog query"""
@@ -122,8 +136,18 @@
class IViewQuery(Interface):
"""View query interface"""
+ def get_params(self, context):
+ """Get static view query params"""
+
def get_results(self, context, sort_index, reverse, limit):
- """Get results of catalog query"""
+ """Get tuple of limited results and total results count"""
+
+
+class IViewUserQuery(Interface):
+ """View user search query interface"""
+
+ def get_user_params(self, request):
+ """Get dynamic user query params"""
class IViewQueryExtension(Interface):