diff --git a/browser/common.py b/browser/common.py index 352761a..ab60826 100644 --- a/browser/common.py +++ b/browser/common.py @@ -40,9 +40,9 @@ from zope.security.proxy import removeSecurityProxy from cybertools.browser.view import GenericView from cybertools.relation.interfaces import IRelationRegistry -from cybertools.typology.interfaces import IType +from cybertools.typology.interfaces import IType, ITypeManager from loops.interfaces import IView -#from loops import util +from loops import util from loops.util import _ @@ -154,6 +154,13 @@ class BaseView(GenericView): for o in objs: yield BaseView(o, request) + def typesForSearch(self): + general = [('loops:resource:*', 'Any Resource'), + ('loops:concept:*', 'Any Concept'),] + return util.KeywordVocabulary(general + sorted([(t.tokenForSearch, t.title) + for t in ITypeManager(self.context).types]) + + [('loops:*', 'Any')]) + @Lazy def uniqueId(self): return zapi.getUtility(IRelationRegistry).getUniqueIdForObject(self.context) diff --git a/browser/loops.js b/browser/loops.js index bda45cd..2f2b231 100644 --- a/browser/loops.js +++ b/browser/loops.js @@ -23,13 +23,17 @@ function submitReplacing(targetId, formId, actionUrl) { } function inlineEdit(id, saveUrl) { + var iconNode = dojo.byId("inlineedit_icon"); + iconNode.style.visibility = "hidden"; var editor = dojo.widget.fromScript("Editor", {items: ["save", "|", "formatblock", "|", "insertunorderedlist", "insertorderedlist", "|", "bold", "italic", "|", "createLink", "insertimage"], saveUrl: saveUrl, closeOnSave: true, - onSave: function(){this.disableToolbar(true);}, + onSave: function(){ + this.disableToolbar(true); + iconNode.style.visibility = "visible";} }, dojo.byId(id)); return false; } diff --git a/browser/node.py b/browser/node.py index f16de3c..8a58cd4 100644 --- a/browser/node.py +++ b/browser/node.py @@ -234,6 +234,8 @@ class NodeView(BaseView): name = zapi.getDefaultViewName(target, self.request) targetView = zapi.getMultiAdapter((target, self.request), name=name) + if name == 'index.html' and hasattr(targetView, 'show'): + return targetView.show() return targetView() return u'' diff --git a/browser/node_macros.pt b/browser/node_macros.pt index f3283b7..935d09e 100644 --- a/browser/node_macros.pt +++ b/browser/node_macros.pt @@ -25,22 +25,24 @@
-
- Edit -
-
- Edit -
+ +
+ Edit +
+
+ Edit +
+
+ tal:define="target nocall:item/target">

Title

- + + +
+ +
+ The body +
+
diff --git a/search/README.txt b/search/README.txt index 7213eee..8e7cbf4 100755 --- a/search/README.txt +++ b/search/README.txt @@ -99,5 +99,5 @@ Before accessing the `results` property we have to prepare a catalog. ... return [] >>> component.provideUtility(DummyCat()) - >>> resultsView.results + >>> list(resultsView.results) [] diff --git a/search/browser.py b/search/browser.py index 237d13e..96f0df5 100644 --- a/search/browser.py +++ b/search/browser.py @@ -79,19 +79,25 @@ class SearchResults(BaseView): @Lazy def results(self): request = self.request + type = request.get('search.1.text', 'loops:resource:*') text = request.get('search.2.text') - if not text: + if not text and '*' in type: # there should be some sort of selection... return set() useTitle = request.get('search.2.title') useFull = request.get('search.2.full') - r1 = r2 = set() + r1 = set() cat = component.getUtility(ICatalog) - if useFull: + if useFull and text and not type.startswith('loops:concept:'): criteria = {'loops_resource_textng': {'query': text},} r1 = set(cat.searchResults(**criteria)) - if useTitle: - criteria = {'loops_title': text,} - r2 = set(cat.searchResults(**criteria)) - result = [BaseView(r, request) for r in r1.union(r2)] - return result + if type.endswith('*'): + start = type[:-1] + end = start + '\x7f' + else: + start = end = type + criteria = {'loops_type': (start, end),} + if useTitle and text: + criteria['loops_title'] = text + r2 = set(cat.searchResults(**criteria)) + return self.viewIterator(r1.union(r2)) diff --git a/search/search.pt b/search/search.pt index c1f287c..250a91b 100644 --- a/search/search.pt +++ b/search/search.pt @@ -84,8 +84,12 @@