version 1.93, 2006/09/16 16:15:24
|
version 1.94, 2006/09/17 10:05:03
|
Line 19 import zLOG
|
Line 19 import zLOG
|
import os.path |
import os.path |
import os |
import os |
import copy |
import copy |
|
import unicodedata |
|
|
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
|
|
|
def getTextFromNode(nodename): |
|
"""get the cdata content of a node""" |
|
if nodename is None: |
|
return "" |
|
nodelist=nodename.childNodes |
|
rc = "" |
|
for node in nodelist: |
|
if node.nodeType == node.TEXT_NODE: |
|
rc = rc + node.data |
|
return rc |
|
|
def analyseIntSearch(word): |
def analyseIntSearch(word): |
#analyse integer searches |
#analyse integer searches |
|
|
Line 713 class ZSQLExtendFolder(Folder,Persistent
|
Line 725 class ZSQLExtendFolder(Folder,Persistent
|
def ZSQLSimpleSearch(self,query=None,max_rows=1000000): |
def ZSQLSimpleSearch(self,query=None,max_rows=1000000): |
"""simple search""" |
"""simple search""" |
|
|
|
#print query |
if not query: |
if not query: |
query=self.query |
query=self.query |
|
|
Line 1100 class ZSQLExtendFolder(Folder,Persistent
|
Line 1112 class ZSQLExtendFolder(Folder,Persistent
|
opfields={} |
opfields={} |
lopfields={} #Verknuepfung bei mehrfachauswahl von einem feld |
lopfields={} #Verknuepfung bei mehrfachauswahl von einem feld |
sortfields={} #order of sortfields |
sortfields={} #order of sortfields |
|
diacritics={} #diacritische zeichen, falls "no", dann werden diese fuer das feld gefiltert. |
sortAllFields=None |
sortAllFields=None |
skip="" |
skip="" |
rangeStart=0 |
rangeStart=0 |
Line 1142 class ZSQLExtendFolder(Folder,Persistent
|
Line 1155 class ZSQLExtendFolder(Folder,Persistent
|
field=name[5:] |
field=name[5:] |
lopfields[field]=lop |
lopfields[field]=lop |
|
|
|
if name[0:11]==iCT+"diacritics": |
|
field=name[12:] |
|
diacritics[field]=value |
|
|
if name[0:10]==iCT+"sortorder": |
if name[0:10]==iCT+"sortorder": |
#sort=value |
#sort=value |
|
|
Line 1167 class ZSQLExtendFolder(Folder,Persistent
|
Line 1184 class ZSQLExtendFolder(Folder,Persistent
|
punktsplit=name.split(".") #sonderfall feld mit punkten(tabelle.suchFeld.ausgewaehltesFeld,feldinoriginal), d.h. suche in anderer tabelle: |
punktsplit=name.split(".") #sonderfall feld mit punkten(tabelle.suchFeld.ausgewaehltesFeld,feldinoriginal), d.h. suche in anderer tabelle: |
|
|
#analysiere alle anderen faelle |
#analysiere alle anderen faelle |
|
|
|
if diacritics.get(name,'yes')=='no': |
|
"""filter diacritische zeichen""" |
|
value=unicodedata.normalize('NFKD', value.decode('utf-8')).encode('ASCII', 'ignore') |
|
|
if name==iCT+"lop": |
if name==iCT+"lop": |
lop=value |
lop=value |
elif name==iCT+"table": |
elif name==iCT+"table": |
Line 1207 class ZSQLExtendFolder(Folder,Persistent
|
Line 1229 class ZSQLExtendFolder(Folder,Persistent
|
op=value |
op=value |
|
|
|
|
|
#sonderfall Name hat das Format: |
|
#TABELLE.SUCHFELD_IN_DIESER_TABELLE.SELECT_FIELD.IDENTIFIER_IN_TABELLE_-table |
|
#i.e. erzeugt wird |
|
#das Statement |
|
#WHERE DENTIFIER_IN_TABELLE_-table in (select from SELECT_FIELD |
|
#where LOWER(UCHFELD_IN_DIESER_TABELLE) something value) |
|
#something is defined by _op_TABELLE.SUCHFELD_IN_DIESER_TABELLE.SELECT_FIELD.IDENTIFIER_IN_TABELLE_-table |
|
|
elif (not name[0]==iCT) and len(punktsplit)==4: |
elif (not name[0]==iCT) and len(punktsplit)==4: |
if opfields.has_key(name): |
if opfields.has_key(name): |
Line 1215 class ZSQLExtendFolder(Folder,Persistent
|
Line 1244 class ZSQLExtendFolder(Folder,Persistent
|
op="ct" |
op="ct" |
namealt=name |
namealt=name |
name="LOWER("+punktsplit[1]+")" |
name="LOWER("+punktsplit[1]+")" |
|
value=value.lower() |
if op=="ct": |
if op=="ct": |
tmp=(name+" LIKE "+sql_quote("%"+value+"%")) |
tmp=(name+" LIKE "+sql_quote("%"+value+"%")) |
elif op=="gt": |
elif op=="gt": |