version 1.1.2.27, 2010/06/23 15:01:56
|
version 1.1.2.30, 2011/02/23 17:43:07
|
Line 67 class MPIWGRoot(ZSQLExtendFolder):
|
Line 67 class MPIWGRoot(ZSQLExtendFolder):
|
# types of objects that show up in navigation |
# types of objects that show up in navigation |
nav_meta_types = ['MPIWGTemplate','MPIWGLink','MPIWGFolder'] |
nav_meta_types = ['MPIWGTemplate','MPIWGLink','MPIWGFolder'] |
|
|
|
manage_options = Folder.manage_options+( |
|
{'label':'Update personal homepages','action':'updatePersonalwww_html'}, |
|
{'label':'Reindex catalogs','action':'reindexCatalogs'}, |
|
{'label':'Main config','action':'changeMPIWGRootForm'}, |
|
{'label':'add e-mails','action':'showNewDBEntries'}, |
|
#{'label':'update the institutsbibliography','action':'updateInstitutsbiliography'}, |
|
#{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, |
|
#{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, |
|
) |
|
|
|
|
def getGetNeighbourhood(self,obj, wordStr, length=100,tagging=True): |
def getGetNeighbourhood(self,obj, wordStr, length=100,tagging=True): |
"""finde umgebung um die worte in wordStr, zurueckgegeben wird eine Array mit den Umgebungen von Fundstellen der Worte |
"""finde umgebung um die worte in wordStr, zurueckgegeben wird eine Array mit den Umgebungen von Fundstellen der Worte |
alle Tags werden entfernt, die Fundstellen werden mit <span class="found">XX</span> getaggt, die Umgebungen werden |
alle Tags werden entfernt, die Fundstellen werden mit <span class="found">XX</span> getaggt, die Umgebungen werden |
Line 589 class MPIWGRoot(ZSQLExtendFolder):
|
Line 600 class MPIWGRoot(ZSQLExtendFolder):
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGRootForm')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGRootForm')).__of__(self) |
return pt() |
return pt() |
|
|
def changeMPIWGRoot(self,title,disciplineList,themesList,connection_id,lang=None,RESPONSE=None): |
def changeMPIWGRoot(self,title,disciplineList,themesList,connection_id,lang=None,autocommit=None,RESPONSE=None): |
"""change""" |
"""change""" |
self.title=title |
self.title=title |
self.connection_id=connection_id |
self.connection_id=connection_id |
Line 598 class MPIWGRoot(ZSQLExtendFolder):
|
Line 609 class MPIWGRoot(ZSQLExtendFolder):
|
if lang is not None: |
if lang is not None: |
self.lang = lang |
self.lang = lang |
|
|
|
self.autocommit = (autocommit == "on") |
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
Line 683 class MPIWGRoot(ZSQLExtendFolder):
|
Line 695 class MPIWGRoot(ZSQLExtendFolder):
|
return projects |
return projects |
|
|
|
|
manage_options = Folder.manage_options+( |
|
{'label':'Update personal homepages','action':'updatePersonalwww_html'}, |
|
{'label':'Reindex catalogs','action':'reindexCatalogs'}, |
|
{'label':'Main config','action':'changeMPIWGRootForm'}, |
|
{'label':'add e-mails','action':'showNewDBEntries'}, |
|
{'label':'update the institutsbibliography','action':'updateInstitutsbiliography'}, |
|
#{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, |
|
#{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, |
|
) |
|
|
|
|
|
def updatePublicationDB(self,personId=None): |
def updatePublicationDB(self,personId=None): |
"""updates the publication db, i.e. copy year and type into the main table""" |
"""updates the publication db, i.e. copy year and type into the main table""" |
|
|
Line 786 class MPIWGRoot(ZSQLExtendFolder):
|
Line 787 class MPIWGRoot(ZSQLExtendFolder):
|
|
|
return result,msg |
return result,msg |
|
|
def updatePersonEntry(self,data,ignoreEntries=[]): |
def updatePersonEntry(self,data,ignoreEntries=None): |
"""update an person entry from data. but ignore all fields in ignore Entries""" |
"""update an person entry from data. but ignore all fields in ignore Entries""" |
|
if ignoreEntries is None: |
|
ignoreEntries = [] |
|
|
ignoreEntries.append('current_work') # TODO:updatecurrent work |
ignoreEntries.append('current_work') # TODO:updatecurrent work |
|
logging.debug("updatePersonEntry: data=%s ignoreEntries=%s"%(repr(data),repr(ignoreEntries))) |
|
|
if data['date_to']=="": # wenn date_to leer |
if data['date_to']=="": # wenn date_to leer |
data['date_to']="date_none" |
data['date_to']="date_none" |
Line 803 class MPIWGRoot(ZSQLExtendFolder):
|
Line 807 class MPIWGRoot(ZSQLExtendFolder):
|
|
|
columns=data.keys() |
columns=data.keys() |
for x in ignoreEntries: |
for x in ignoreEntries: |
logging.info("ign rem: %s"%x) |
logging.debug("updatePersonEntry: ignoring %s"%x) |
try: #falls in ignore entries felder sind, die nicht in columns sind, fange den fehler ab |
try: #falls in ignore entries felder sind, die nicht in columns sind, fange den fehler ab |
columns.remove(x) |
columns.remove(x) |
except: |
except: |
Line 837 class MPIWGRoot(ZSQLExtendFolder):
|
Line 841 class MPIWGRoot(ZSQLExtendFolder):
|
resultSet=self.REQUEST.SESSION['personal_www']['resultSet'] |
resultSet=self.REQUEST.SESSION['personal_www']['resultSet'] |
news=self.REQUEST.SESSION['personal_www']['news'] |
news=self.REQUEST.SESSION['personal_www']['news'] |
conflicts=self.REQUEST.SESSION['personal_www']['conflicts'] |
conflicts=self.REQUEST.SESSION['personal_www']['conflicts'] |
|
logging.debug("updatePersonalwww_doIt: args=%s\n resultSet=%s\n news=%s\n conflicts=%s"%(args,resultSet,news,conflicts)) |
|
|
ret="<html><body>" |
ret="<html><body>" |
# generate the new entry |
# generate the new entry |
|
|
Line 844 class MPIWGRoot(ZSQLExtendFolder):
|
Line 850 class MPIWGRoot(ZSQLExtendFolder):
|
ret+="<h2>Hinzugefügt</h2>" |
ret+="<h2>Hinzugefügt</h2>" |
ret+="<p>Neueinträge erscheinen erst auf der Homepage, wenn ihnen eine e-mail Adresse zugeordnet wurde.</p>" |
ret+="<p>Neueinträge erscheinen erst auf der Homepage, wenn ihnen eine e-mail Adresse zugeordnet wurde.</p>" |
ret+="<ul>" |
ret+="<ul>" |
for new in news: |
|
|
|
|
for new in news: |
if args.has_key(self.urlQuote(new.encode('utf-8'))): # entry was selected |
if args.has_key(self.urlQuote(new.encode('utf-8'))): # entry was selected |
result,msg=self.generateNewPersonEntry(resultSet[new]) |
result,msg=self.generateNewPersonEntry(resultSet[new]) |
if not result: |
if not result: |
Line 853 class MPIWGRoot(ZSQLExtendFolder):
|
Line 859 class MPIWGRoot(ZSQLExtendFolder):
|
ret+="<li>ERROR: %s %s"%(new.encode('utf-8'),msg) |
ret+="<li>ERROR: %s %s"%(new.encode('utf-8'),msg) |
else: |
else: |
ret+="<li>OK: %s"%(new.encode('utf-8')) |
ret+="<li>OK: %s"%(new.encode('utf-8')) |
|
|
if news and (len(news)>0): |
if news and (len(news)>0): |
ret+="<p>Neueinträge erscheinen erst auf der Homepage, wenn ihnen eine e-mail Adresse zugeordnet wurde.</p>" |
ret+="<p>Neueinträge erscheinen erst auf der Homepage, wenn ihnen eine e-mail Adresse zugeordnet wurde.</p>" |
ret+="</ul>" |
ret+="</ul>" |
Line 871 class MPIWGRoot(ZSQLExtendFolder):
|
Line 878 class MPIWGRoot(ZSQLExtendFolder):
|
if args[conflict.encode('utf-8')+'_'+cf[0]]=="stored": #use the stored one |
if args[conflict.encode('utf-8')+'_'+cf[0]]=="stored": #use the stored one |
ignoreEntries.append(cf[0]) #so ignore field cf[0] |
ignoreEntries.append(cf[0]) #so ignore field cf[0] |
displayIgnored.append(cf) |
displayIgnored.append(cf) |
|
|
if len(displayIgnored)>0: |
if len(displayIgnored)>0: |
ret+="<h3>%s</h3>"%conflict.encode('utf-8') |
ret+="<h3>%s</h3>"%conflict.encode('utf-8') |
|
|
ret+="<table border='1'>" |
ret+="<table border='1'>" |
for iE in displayIgnored: |
for iE in displayIgnored: |
ret+="<tr><td>%s</td><td>%s</td><td>%s</td>"%(iE[0].encode('utf-8'),iE[1].encode('utf-8'),iE[2].encode('utf-8')) |
ret+="<tr><td>%s</td><td>%s</td><td>%s</td>"%(iE[0].encode('utf-8'),iE[1].encode('utf-8'),iE[2].encode('utf-8')) |