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):
# reached, therefor 'sort-on' does not happen in the
# context of text index query. This should probably
# sort by relevance first, then the 'sort-on' attribute.
for k, intset in sort_index._index.items():
if type(rs) is IIBType:
intset=rs.intersection(intset)
else:
intset=intset.intersection(rs)
if intset:
append((k,LazyMap(self.__getitem__, intset)))
if len(rs)>len(sort_index._index):
for k, intset in sort_index._index.items():
if type(rs) is IIBType:
intset=rs.intersection(intset)
else:
intset=intset.intersection(rs)
if intset:
append((k,LazyMap(self.__getitem__, intset)))
else:
for r in rs:
append(sort_index._unindex[r],
LazyMap(self.__getitem__,[r]))
return used
......
......@@ -102,11 +102,12 @@ class CatalogAware:
manage_editCatalogerForm=HTMLFile('editCatalogerForm', globals())
def manage_editCataloger(self, default, REQUEST):
def manage_editCataloger(self, default, REQUEST=None):
""" """
self.default_catalog=default
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):
......
......@@ -122,10 +122,10 @@ class Vocabulary(Item, Persistent, Implicit,
manage_options=(
(
{'label': 'Vocabulary', 'action': 'manage_vocabulary',
'target': 'manage_main'},
{'label': 'Vocabulary', 'action': 'manage_main',
'target': 'manage_workspace'},
{'label': 'Query', 'action': 'manage_query',
'target': 'manage_main'},
'target': 'manage_workspace'},
)
+Item.manage_options
+AccessControl.Role.RoleManager.manage_options
......@@ -144,8 +144,7 @@ class Vocabulary(Item, Persistent, Implicit,
## manage_main = HTMLFile('vocab_manage_main', globals())
manage_vocabulary = HTMLFile('manage_vocab', globals())
manage_main = HTMLFile('manage_vocab', globals())
manage_query = HTMLFile('vocab_query', globals())
def __init__(self, id, title='', globbing=None):
......@@ -175,7 +174,7 @@ class Vocabulary(Item, Persistent, Implicit,
self.insert(word)
if RESPONSE:
RESPONSE.redirect(URL1 + '/manage_vocabulary')
RESPONSE.redirect(URL1 + '/manage_main')
def manage_stop_syn(self, stop_syn, REQUEST=None):
pass
......
......@@ -143,7 +143,7 @@ class ZCatalog(Folder, Persistent, Implicit):
meta_type = "ZCatalog"
icon='misc_/ZCatalog/ZCatalog.gif'
manage_options=(
manage_options=Folder.manage_options + (
{'label': 'Cataloged Objects', 'action': 'manage_catalogView',
'target': 'manage_main',
'help':('ZCatalog','ZCatalog_Cataloged-Objects.dtml')},
......@@ -159,7 +159,7 @@ class ZCatalog(Folder, Persistent, Implicit):
{'label': 'Status', 'action': 'manage_catalogStatus',
'target':'manage_main',
'help':('ZCatalog','ZCatalog_Status.dtml')},
)+Folder.manage_options
)
__ac_permissions__=(
......
......@@ -28,10 +28,10 @@ that have one or more keywords specified in a search query.</p>
<form action="<dtml-var URL1>">
<ul>
<dtml-in indexes>
<dtml-in index_objects>
<li>
<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>
</ul>
<br>
......
......@@ -6,20 +6,63 @@
<dtml-var manage_tabs>
<!--
<form action="manage_insert" method="POST">
<input name="word"><br>
<input type="submit" value="Add">
</form>
<br>
-->
<ul>
<dtml-in words>
<li><dtml-var sequence-key> (<dtml-var sequence-item>)</li>
</dtml-in>
</ul>
<dtml-if words>
<dtml-var id> contains
<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>
</html>
......@@ -148,9 +148,9 @@ class Lexicon(Persistent, Implicit):
self.counter = 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):
return self.get(key)
......
......@@ -84,7 +84,7 @@
##############################################################################
"""Simple column indices"""
__version__='$Revision: 1.10 $'[11:-2]
__version__='$Revision: 1.11 $'[11:-2]
from Globals import Persistent
from Acquisition import Implicit
......@@ -111,6 +111,8 @@ def nonEmpty(s):
class UnIndex(Persistent, Implicit):
"""UnIndex object interface"""
meta_type = 'Field Index'
def __init__(self, id=None, ignore_ex=None, call_methods=None):
"""Create an unindex
......
......@@ -2,6 +2,9 @@ from UnIndex import UnIndex, MV, intSet
from types import ListType, TupleType
class UnKeywordIndex(UnIndex):
meta_type = 'Keyword Index'
"""Like an UnIndex only it indexes sequences of items
Searches match any keyword.
......
......@@ -92,7 +92,7 @@ is no longer known.
"""
__version__='$Revision: 1.22 $'[11:-2]
__version__='$Revision: 1.23 $'[11:-2]
from Globals import Persistent
import BTree, IIBTree, IOBTree, OIBTree
......@@ -123,6 +123,8 @@ QueryError='TextIndex.QueryError'
class UnTextIndex(Persistent, Implicit):
meta_type = 'Text Index'
def __init__(self, id=None, ignore_ex=None,
call_methods=None, lexicon=None):
"""Create an index
......@@ -337,7 +339,8 @@ class UnTextIndex(Persistent, Implicit):
if len(src) == 1:
src=src[0]
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 = {}
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