version 1.5, 2004/01/21 16:54:45
|
version 1.6, 2004/01/22 09:18:49
|
Line 32 class ZSQLExtendFolder(Persistent, Impli
|
Line 32 class ZSQLExtendFolder(Persistent, Impli
|
return 1 |
return 1 |
return 0 |
return 0 |
|
|
def ZSQLsearchOptions(self): |
def ZSQLsearchOptions(self,fieldname=""): |
"""return HTML Fragment with search options""" |
"""return HTML Fragment with search options""" |
ret="""<select name="-op"> |
|
|
ret="""<select name="-op_%s"> |
<option value="bw">begins with</option> <!-- begins with / beginnt mit, "Wort*" --> |
<option value="bw">begins with</option> <!-- begins with / beginnt mit, "Wort*" --> |
<option value="ew">ends with</option> |
<option value="ew">ends with</option> |
<option value="cn">contains</option> <!-- contains / enthaellt, "Wort" --> |
<option value="ct">contains</option> <!-- contains / enthaellt, "Wort" --> |
<option value="eq">equals</option> <!-- equals / ist, =Wort --> |
<option value="eq">equals</option> <!-- equals / ist, =Wort --> |
</select>""" |
</select>"""%fieldname |
return ret |
return ret |
|
|
def ZSQLInlineSearch(self,storename=None,**argv): |
def ZSQLInlineSearch(self,storename=None,**argv): |
Line 172 class ZSQLExtendFolder(Persistent, Impli
|
Line 173 class ZSQLExtendFolder(Persistent, Impli
|
else: |
else: |
qs=string.join(qs.split("&"),",") |
qs=string.join(qs.split("&"),",") |
|
|
|
|
qs=re.sub("\\+"," ",qs)# Austauschen da Leerzeichen bei http-get durch + ersetzt wird, generell sollte alles auf post umgeschrieben werden. vom search formular. |
qs=re.sub("\\+"," ",qs)# Austauschen da Leerzeichen bei http-get durch + ersetzt wird, generell sollte alles auf post umgeschrieben werden. vom search formular. |
#print "QS",qs |
#print "QS",qs |
if storename: |
if storename: |
Line 253 class ZSQLExtendFolder(Persistent, Impli
|
Line 255 class ZSQLExtendFolder(Persistent, Impli
|
select="*" |
select="*" |
#print "Q",nostore,qs |
#print "Q",nostore,qs |
#check for op in the case of inline search |
#check for op in the case of inline search |
if iCT=="_": |
|
for q in qs.split(","): |
splitted=qs.split(",") |
|
|
|
|
|
for q in splitted: |
|
|
name=re.sub("r'+'"," ",q.split("=")[0].lower()) |
name=re.sub("r'+'"," ",q.split("=")[0].lower()) |
value=urllib.unquote(q.split("=")[1]) |
value=urllib.unquote(q.split("=")[1]) |
Line 264 class ZSQLExtendFolder(Persistent, Impli
|
Line 269 class ZSQLExtendFolder(Persistent, Impli
|
field=name[4:] |
field=name[4:] |
opfields[field]=op |
opfields[field]=op |
|
|
|
#print opfieldsa |
#now analyse the querystring |
#now analyse the querystring |
for q in qs.split(","): |
for q in qs.split(","): |
|
|
Line 301 class ZSQLExtendFolder(Persistent, Impli
|
Line 307 class ZSQLExtendFolder(Persistent, Impli
|
|
|
|
|
elif (not name[0]==iCT) and (not len(value)==0): |
elif (not name[0]==iCT) and (not len(value)==0): |
name="LOWER("+name+")" |
|
|
#print "OP",op,name |
value=value.lower() |
value=value.lower() |
if opfields.has_key(name): |
if opfields.has_key(name): |
op=opfields[name] |
op=opfields[name] |
|
else: |
|
op="ct" |
|
name="LOWER("+name+")" |
if op=="ct": |
if op=="ct": |
whereList.append(name+" LIKE "+libpq.PgQuoteString("%"+value+"%")) |
whereList.append(name+" LIKE "+libpq.PgQuoteString("%"+value+"%")) |
elif op=="gt": |
elif op=="gt": |
Line 360 class ZSQLExtendFolder(Persistent, Impli
|
Line 370 class ZSQLExtendFolder(Persistent, Impli
|
self.REQUEST.SESSION[storename]['rangeEnd']=int(rangeStart)+int(limit) |
self.REQUEST.SESSION[storename]['rangeEnd']=int(rangeStart)+int(limit) |
self.REQUEST.SESSION[storename]['rangeSize']=limit |
self.REQUEST.SESSION[storename]['rangeSize']=limit |
|
|
|
print query |
return self.search(var=query) |
return self.search(var=query) |
|
|
def ZSQLSearch(self): |
def ZSQLSearch(self): |