Commit b4c65aa6 authored by Michel Pelletier's avatar Michel Pelletier

Fixed bugs and cosmetic enhancments

parent 27948bbf
...@@ -523,13 +523,18 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -523,13 +523,18 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# reached, therefor 'sort-on' does not happen in the # reached, therefor 'sort-on' does not happen in the
# context of text index query. This should probably # context of text index query. This should probably
# sort by relevance first, then the 'sort-on' attribute. # sort by relevance first, then the 'sort-on' attribute.
for k, intset in sort_index._index.items(): if len(rs)>len(sort_index._index):
if type(rs) is IIBType: for k, intset in sort_index._index.items():
intset=rs.intersection(intset) if type(rs) is IIBType:
else: intset=rs.intersection(intset)
intset=intset.intersection(rs) else:
if intset: intset=intset.intersection(rs)
append((k,LazyMap(self.__getitem__, intset))) if intset:
append((k,LazyMap(self.__getitem__, intset)))
else:
for r in rs:
append(sort_index._unindex[r],
LazyMap(self.__getitem__,[r]))
return used return used
......
...@@ -102,11 +102,12 @@ class CatalogAware: ...@@ -102,11 +102,12 @@ class CatalogAware:
manage_editCatalogerForm=HTMLFile('editCatalogerForm', globals()) manage_editCatalogerForm=HTMLFile('editCatalogerForm', globals())
def manage_editCataloger(self, default, REQUEST): def manage_editCataloger(self, default, REQUEST=None):
""" """ """ """
self.default_catalog=default self.default_catalog=default
message = "Your changes have been saved" message = "Your changes have been saved"
return self.manage_main(self, REQUEST, manage_tabs_message=message) if REQUEST is not None:
return self.manage_main(self, REQUEST, manage_tabs_message=message)
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
......
...@@ -122,10 +122,10 @@ class Vocabulary(Item, Persistent, Implicit, ...@@ -122,10 +122,10 @@ class Vocabulary(Item, Persistent, Implicit,
manage_options=( manage_options=(
( (
{'label': 'Vocabulary', 'action': 'manage_vocabulary', {'label': 'Vocabulary', 'action': 'manage_main',
'target': 'manage_main'}, 'target': 'manage_workspace'},
{'label': 'Query', 'action': 'manage_query', {'label': 'Query', 'action': 'manage_query',
'target': 'manage_main'}, 'target': 'manage_workspace'},
) )
+Item.manage_options +Item.manage_options
+AccessControl.Role.RoleManager.manage_options +AccessControl.Role.RoleManager.manage_options
...@@ -144,8 +144,7 @@ class Vocabulary(Item, Persistent, Implicit, ...@@ -144,8 +144,7 @@ class Vocabulary(Item, Persistent, Implicit,
## manage_main = HTMLFile('vocab_manage_main', globals()) manage_main = HTMLFile('manage_vocab', globals())
manage_vocabulary = HTMLFile('manage_vocab', globals())
manage_query = HTMLFile('vocab_query', globals()) manage_query = HTMLFile('vocab_query', globals())
def __init__(self, id, title='', globbing=None): def __init__(self, id, title='', globbing=None):
...@@ -175,7 +174,7 @@ class Vocabulary(Item, Persistent, Implicit, ...@@ -175,7 +174,7 @@ class Vocabulary(Item, Persistent, Implicit,
self.insert(word) self.insert(word)
if RESPONSE: if RESPONSE:
RESPONSE.redirect(URL1 + '/manage_vocabulary') RESPONSE.redirect(URL1 + '/manage_main')
def manage_stop_syn(self, stop_syn, REQUEST=None): def manage_stop_syn(self, stop_syn, REQUEST=None):
pass pass
......
...@@ -143,7 +143,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -143,7 +143,7 @@ class ZCatalog(Folder, Persistent, Implicit):
meta_type = "ZCatalog" meta_type = "ZCatalog"
icon='misc_/ZCatalog/ZCatalog.gif' icon='misc_/ZCatalog/ZCatalog.gif'
manage_options=( manage_options=Folder.manage_options + (
{'label': 'Cataloged Objects', 'action': 'manage_catalogView', {'label': 'Cataloged Objects', 'action': 'manage_catalogView',
'target': 'manage_main', 'target': 'manage_main',
'help':('ZCatalog','ZCatalog_Cataloged-Objects.dtml')}, 'help':('ZCatalog','ZCatalog_Cataloged-Objects.dtml')},
...@@ -159,7 +159,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -159,7 +159,7 @@ class ZCatalog(Folder, Persistent, Implicit):
{'label': 'Status', 'action': 'manage_catalogStatus', {'label': 'Status', 'action': 'manage_catalogStatus',
'target':'manage_main', 'target':'manage_main',
'help':('ZCatalog','ZCatalog_Status.dtml')}, 'help':('ZCatalog','ZCatalog_Status.dtml')},
)+Folder.manage_options )
__ac_permissions__=( __ac_permissions__=(
......
...@@ -28,10 +28,10 @@ that have one or more keywords specified in a search query.</p> ...@@ -28,10 +28,10 @@ that have one or more keywords specified in a search query.</p>
<form action="<dtml-var URL1>"> <form action="<dtml-var URL1>">
<ul> <ul>
<dtml-in indexes> <dtml-in index_objects>
<li> <li>
<input type="checkbox" name="names:list" value="<dtml-var sequence-item html_quote>"> <input type="checkbox" name="names:list" value="<dtml-var sequence-item html_quote>">
<dtml-var sequence-item></li> <dtml-var id> (<i><dtml-var meta_type></i>)</li>
</dtml-in> </dtml-in>
</ul> </ul>
<br> <br>
......
...@@ -6,20 +6,63 @@ ...@@ -6,20 +6,63 @@
<dtml-var manage_tabs> <dtml-var manage_tabs>
<!--
<form action="manage_insert" method="POST">
<input name="word"><br>
<input type="submit" value="Add">
</form>
<br>
-->
<ul> <dtml-if words>
<dtml-in words>
<li><dtml-var sequence-key> (<dtml-var sequence-item>)</li>
</dtml-in> <dtml-var id> contains
</ul> <em><dtml-var words fmt=collection-length thousands_commas></em>
word(s).<BR><BR>
<dtml-in words previous size=20 start=query_start >
<a href="<dtml-var URL>?query_start=<dtml-var previous-sequence-start-number>">
[Previous <dtml-var previous-sequence-size> entries]
</a>
</dtml-in>
<dtml-in words next size=20 start=query_start >
<a href="<dtml-var URL>?query_start=<dtml-var next-sequence-start-number>">
[Next <dtml-var next-sequence-size> entries]
</a>
</dtml-in>
<table>
<dtml-in words size=20 start=query_start >
<tr valign=top>
<td valign="top" align="left">
<dtml-var sequence-item> (<dtml-var sequence-key>)
</td>
</tr>
</dtml-in>
</table>
<dtml-in words previous size=20 start=query_start >
<a href="<dtml-var URL>?query_start=<dtml-var previous-sequence-start-number>">
[Previous <dtml-var previous-sequence-size> entries]
</a>
</dtml-in>
<dtml-in words next size=20 start=query_start >
<a href="<dtml-var URL>?query_start=<dtml-var next-sequence-start-number>">
[Next <dtml-var next-sequence-size> entries]
</a>
</dtml-in>
<dtml-else>
<P>There are no words in the Vocabulary.</P>
</dtml-if>
</body> </body>
</html> </html>
...@@ -148,9 +148,9 @@ class Lexicon(Persistent, Implicit): ...@@ -148,9 +148,9 @@ class Lexicon(Persistent, Implicit):
self.counter = self.counter + 1 self.counter = self.counter + 1
return self.counter - 1 return self.counter - 1
def get(self, key): def get(self, key, default=None):
""" """ """ """
return [self._lexicon[key]] return [self._lexicon.get(key, default)]
def __getitem__(self, key): def __getitem__(self, key):
return self.get(key) return self.get(key)
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Simple column indices""" """Simple column indices"""
__version__='$Revision: 1.10 $'[11:-2] __version__='$Revision: 1.11 $'[11:-2]
from Globals import Persistent from Globals import Persistent
from Acquisition import Implicit from Acquisition import Implicit
...@@ -111,6 +111,8 @@ def nonEmpty(s): ...@@ -111,6 +111,8 @@ def nonEmpty(s):
class UnIndex(Persistent, Implicit): class UnIndex(Persistent, Implicit):
"""UnIndex object interface""" """UnIndex object interface"""
meta_type = 'Field Index'
def __init__(self, id=None, ignore_ex=None, call_methods=None): def __init__(self, id=None, ignore_ex=None, call_methods=None):
"""Create an unindex """Create an unindex
......
...@@ -2,6 +2,9 @@ from UnIndex import UnIndex, MV, intSet ...@@ -2,6 +2,9 @@ from UnIndex import UnIndex, MV, intSet
from types import ListType, TupleType from types import ListType, TupleType
class UnKeywordIndex(UnIndex): class UnKeywordIndex(UnIndex):
meta_type = 'Keyword Index'
"""Like an UnIndex only it indexes sequences of items """Like an UnIndex only it indexes sequences of items
Searches match any keyword. Searches match any keyword.
......
...@@ -92,7 +92,7 @@ is no longer known. ...@@ -92,7 +92,7 @@ is no longer known.
""" """
__version__='$Revision: 1.22 $'[11:-2] __version__='$Revision: 1.23 $'[11:-2]
from Globals import Persistent from Globals import Persistent
import BTree, IIBTree, IOBTree, OIBTree import BTree, IIBTree, IOBTree, OIBTree
...@@ -123,6 +123,8 @@ QueryError='TextIndex.QueryError' ...@@ -123,6 +123,8 @@ QueryError='TextIndex.QueryError'
class UnTextIndex(Persistent, Implicit): class UnTextIndex(Persistent, Implicit):
meta_type = 'Text Index'
def __init__(self, id=None, ignore_ex=None, def __init__(self, id=None, ignore_ex=None,
call_methods=None, lexicon=None): call_methods=None, lexicon=None):
"""Create an index """Create an index
...@@ -337,7 +339,8 @@ class UnTextIndex(Persistent, Implicit): ...@@ -337,7 +339,8 @@ class UnTextIndex(Persistent, Implicit):
if len(src) == 1: if len(src) == 1:
src=src[0] src=src[0]
if src[:1]=='"' and src[-1:]=='"': return self[src] if src[:1]=='"' and src[-1:]=='"': return self[src]
r = self._index.get(self.getLexicon(self._lexicon)[word][0],None) r = self._index.get(self.getLexicon(self._lexicon).get(word)[0],
None)
if r is None: r = {} if r is None: r = {}
return ResultList(r, (word,), self) return ResultList(r, (word,), self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment