version 1.41, 2004/10/19 11:24:12
|
version 1.46, 2004/10/28 14:16:00
|
Line 13 from Products.PageTemplates.PageTemplate
|
Line 13 from Products.PageTemplates.PageTemplate
|
from Products.ZSQLMethods.SQL import SQLConnectionIDs |
from Products.ZSQLMethods.SQL import SQLConnectionIDs |
import Shared.DC.ZRDB.DA |
import Shared.DC.ZRDB.DA |
|
|
|
def analyseIntSearch(word): |
|
#analyse integer searches |
|
|
|
splitted=word.split("-") |
|
|
|
if len(splitted)==1: |
|
return "="+splitted[0] |
|
|
|
if splitted[0]=="": |
|
return "< "+splitted[1] |
|
|
|
if splitted[1]=='': |
|
return "> "+splitted[0] |
|
else: |
|
return "BETWEEN "+splitted[0]+" AND "+splitted[1] |
|
|
|
|
|
|
def sql_quote(v): |
def sql_quote(v): |
# quote dictionary |
# quote dictionary |
quote_dict = {"\'": "''", "\\": "\\\\"} |
quote_dict = {"\'": "''", "\\": "\\\\"} |
Line 40 class ZSQLExtendFolder(Folder,Persistent
|
Line 58 class ZSQLExtendFolder(Folder,Persistent
|
"""suche relative haufigkeiten""" |
"""suche relative haufigkeiten""" |
ret={} |
ret={} |
allRecords=len(self.ZSQLSimpleSearch(statement + " where "+wherePart)) |
allRecords=len(self.ZSQLSimpleSearch(statement + " where "+wherePart)) |
print statement + " where "+wherePart |
|
for oneclass in classes: |
for oneclass in classes: |
ret[oneclass]=len(self.ZSQLSimpleSearch(statement + " where ("+wherePart+") and "+ relStatement%oneclass)) |
ret[oneclass]=len(self.ZSQLSimpleSearch(statement + " where ("+wherePart+") and "+ relStatement%oneclass)) |
print statement + " where ("+wherePart+") and "+ relStatement%oneclass |
|
return (ret,allRecords) |
. return (ret,allRecords) |
|
|
def content_html(self): |
def content_html(self): |
"""template fuer content""" |
"""template fuer content""" |
Line 53 class ZSQLExtendFolder(Folder,Persistent
|
Line 71 class ZSQLExtendFolder(Folder,Persistent
|
obj=getattr(self,"ZSQLBibliography_template") |
obj=getattr(self,"ZSQLBibliography_template") |
return obj() |
return obj() |
except: |
except: |
pt=PageTemplateFile('Products/ZSQLExtend/zpt/ZSQLBibliography_template_standard.zpt',content_type='text/htm').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ZSQLBibliography_template_standard.zpt'),content_type='text/html').__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
|
|
return pt() |
return pt() |
Line 86 class ZSQLExtendFolder(Folder,Persistent
|
Line 104 class ZSQLExtendFolder(Folder,Persistent
|
|
|
def changeZSQLExtendForm(self): |
def changeZSQLExtendForm(self): |
"""change folder config""" |
"""change folder config""" |
pt=PageTemplateFile('Products/ZSQLExtend/zpt/changeZSQLExtendForm.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeZSQLExtendForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|
Line 275 class ZSQLExtendFolder(Folder,Persistent
|
Line 293 class ZSQLExtendFolder(Folder,Persistent
|
|
|
def ZSQLSimpleSearch(self,query=None): |
def ZSQLSimpleSearch(self,query=None): |
""" returrn SQLSearch""" |
""" returrn SQLSearch""" |
#print query |
#print "hi",query |
if not query: |
if not query: |
query=self.query |
query=self.query |
if getattr(self,'_v_search',None): |
if getattr(self,'_v_search',None): |
Line 516 class ZSQLExtendFolder(Folder,Persistent
|
Line 534 class ZSQLExtendFolder(Folder,Persistent
|
"""analysieren den QueryString""" |
"""analysieren den QueryString""" |
#print "NO",nostore |
#print "NO",nostore |
lop="AND" # standardsuche mit and |
lop="AND" # standardsuche mit and |
max="ALL" #standard alle auswählen |
max="ALL" #standard alle auswaehlen |
maxstr="" |
maxstr="" |
whereList=[] |
whereList=[] |
sort="" |
sort="" |
op="bw" |
op="bw" |
opfields={} |
opfields={} |
lopfields={} #Verknüpfung bei mehrfachauswahl von einem feld |
lopfields={} #Verknuepfung bei mehrfachauswahl von einem feld |
sortfields={} #order of sortfields |
sortfields={} #order of sortfields |
sortAllFields=None |
sortAllFields=None |
skip="" |
skip="" |
Line 661 class ZSQLExtendFolder(Folder,Persistent
|
Line 679 class ZSQLExtendFolder(Folder,Persistent
|
|
|
tmp=string.join(tmps,' AND ') |
tmp=string.join(tmps,' AND ') |
|
|
|
elif op=="numerical": |
|
term=analyseIntSearch(value) |
|
tmp=(name+" "+term) |
|
elif op=="grep": |
|
tmp=(name+" ~* "+sql_quote(value)) |
|
elif op=="one": |
|
tmps=[] |
|
for word in value.split(" "): |
|
tmps.append(name+" LIKE "+sql_quote("%"+word+"%")) |
|
|
|
tmp=string.join(tmps,' OR ') |
|
|
op="ct" |
op="ct" |
|
|
if (not tableExt) or (namealt.split('.')[0]==tableExt): |
if (not tableExt) or (namealt.split('.')[0]==tableExt): |
Line 786 class ZSQLExtendFolder(Folder,Persistent
|
Line 816 class ZSQLExtendFolder(Folder,Persistent
|
|
|
def nextLink(self,html,storename="foundCount"): |
def nextLink(self,html,storename="foundCount"): |
"""nextLink""" |
"""nextLink""" |
|
|
try: |
try: |
limit=self.REQUEST.SESSION[storename]['rangeSize'] |
limit=self.REQUEST.SESSION[storename]['rangeSize'] |
if int(limit)==0 : |
if int(limit)==0 : |
Line 832 class ZSQLExtendFolder(Folder,Persistent
|
Line 863 class ZSQLExtendFolder(Folder,Persistent
|
newquery.append(query) |
newquery.append(query) |
|
|
newquerystring=string.join(newquery,"&") |
newquerystring=string.join(newquery,"&") |
|
return "<a href='%s'>%s</a>"%(self.REQUEST['URL']+"?"+newquerystring,html) |
|
|
return "<a href='%s'>%s</a>"%(self.actualPath()+"?"+newquerystring,html) |
|
|
|
|
|
def prevLink(self,html,storename="foundCount"): |
def prevLink(self,html,storename="foundCount"): |
"""prev link""" |
"""prev link""" |
|
|
try: |
try: |
limit=self.REQUEST.SESSION[storename]['rangeSize'] |
limit=self.REQUEST.SESSION[storename]['rangeSize'] |
if int(limit)==0 : |
if int(limit)==0 : |
Line 858 class ZSQLExtendFolder(Folder,Persistent
|
Line 890 class ZSQLExtendFolder(Folder,Persistent
|
|
|
if self.REQUEST['QUERY_STRING']=="": |
if self.REQUEST['QUERY_STRING']=="": |
qs=self.REQUEST.SESSION['query'] |
qs=self.REQUEST.SESSION['query'] |
#qs=re.sub(r'_','-',qs) #aendern für query |
#qs=re.sub(r'_','-',qs) #aendern fuer query |
queries=string.split(qs,",") |
queries=string.split(qs,",") |
|
|
|
|
Line 889 class ZSQLExtendFolder(Folder,Persistent
|
Line 921 class ZSQLExtendFolder(Folder,Persistent
|
|
|
newquerystring=string.join(newquery,"&") |
newquerystring=string.join(newquery,"&") |
|
|
return "<a href='%s'>%s</a>"%(self.actualPath()+"?"+newquerystring,html) |
return "<a href='%s'>%s</a>"%(self.REQUEST['URL']+"?"+newquerystring,html) |
|
|
|
|
|
|
Line 1014 class ZSQLBibliography(Folder,ZSQLExtend
|
Line 1046 class ZSQLBibliography(Folder,ZSQLExtend
|
|
|
def changeZSQLBibliographyForm(self): |
def changeZSQLBibliographyForm(self): |
"""change folder config""" |
"""change folder config""" |
pt=PageTemplateFile('Products/ZSQLExtend/zpt/changeZSQLBibliographyForm.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeZSQLBibliographyForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|
Line 1025 class ZSQLBibliography(Folder,ZSQLExtend
|
Line 1057 class ZSQLBibliography(Folder,ZSQLExtend
|
obj=getattr(self,"ZSQLBibliography_template") |
obj=getattr(self,"ZSQLBibliography_template") |
return obj() |
return obj() |
except: |
except: |
pt=PageTemplateFile('Products/ZSQLExtend/zpt/ZSQLBibliography_template_standard.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ZSQLBibliography_template_standard.zpt')).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
Line 1118 class ZSQLBibliography(Folder,ZSQLExtend
|
Line 1150 class ZSQLBibliography(Folder,ZSQLExtend
|
fn=os.path.splitext(self.REQUEST['fn'])[0]+"." |
fn=os.path.splitext(self.REQUEST['fn'])[0]+"." |
self.REQUEST['fn']=fn |
self.REQUEST['fn']=fn |
|
|
pt=PageTemplateFile('Products/ZSQLExtend/zpt/record2.xml').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','record2.xml')).__of__(self) |
pt.content_type="text/xml" |
pt.content_type="text/xml" |
return pt() |
return pt() |
|
|
def getMetaDataXML(self): |
def getMetaDataXML(self): |
"""crate index meta""" |
"""crate index meta""" |
pt=PageTemplateFile('Products/ZSQLExtend/zpt/record.xml').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','record.xml').__of__(self) |
pt.content_type="text/xml" |
pt.content_type="text/xml" |
return pt() |
return pt() |
|
|