version 1.51, 2008/04/15 14:25:32
|
version 1.53, 2010/02/15 19:09:00
|
Line 1
|
Line 1
|
#Neue Version Begin 5.4.2004 |
#Neue Version Begin 5.4.2004 |
|
|
|
|
"""Methoden zum hinzufügen von Dokumenten ins Archiv""" |
"""Methoden zum hinzufuegen von Dokumenten ins Archiv""" |
from OSAS_helpers import readArchimedesXML |
from OSAS_helpers import readArchimedesXML |
try: |
try: |
import archive |
import archive |
Line 286 def addPresentation(self,path):
|
Line 286 def addPresentation(self,path):
|
self.REQUEST.SESSION['presentationname']="%02d-presentation"%i |
self.REQUEST.SESSION['presentationname']="%02d-presentation"%i |
self.REQUEST.SESSION['path']=path |
self.REQUEST.SESSION['path']=path |
|
|
tmpTxt="""<?xml version="1.0" encoding="UTF-8"?> |
tmpTxt=u"""<?xml version="1.0" encoding="UTF-8"?> |
<info> |
<info> |
<author>%s</author> |
<author>%s</author> |
<title>%s</title> |
<title>%s</title> |
Line 323 def addPresentation2(self):
|
Line 323 def addPresentation2(self):
|
"""nothing""" |
"""nothing""" |
#print "NAME:",file_name |
#print "NAME:",file_name |
f=open(path+"/"+folder_name+"/"+file_name,"w") |
f=open(path+"/"+folder_name+"/"+file_name,"w") |
f.write(xmlinfo) |
f.write(xmlinfo.encode('utf-8')) |
f.close() |
f.close() |
try: |
try: |
os.chmod(path+"/"+folder_name,0775) |
os.chmod(path+"/"+folder_name,0775) |
Line 396 def addText2(self):
|
Line 396 def addText2(self):
|
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path) |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path) |
|
|
def addTextExternal(self,path,texturl,version): |
def addTextExternal(self,path,texturl,version): |
"""hinzufügen eines externen textes""" |
"""hinzufuegen eines externen textes""" |
try: #neue text version einlesen |
try: #neue text version einlesen |
texttemp=urllib.urlopen(texturl).readlines() |
texttemp=urllib.urlopen(texturl).readlines() |
text="" |
text="" |
Line 406 def addTextExternal(self,path,texturl,ve
|
Line 406 def addTextExternal(self,path,texturl,ve
|
return "ERROR: cannot read: %s"%texturl |
return "ERROR: cannot read: %s"%texturl |
if TextExternalError(text): #kein xml header |
if TextExternalError(text): #kein xml header |
return "ERROR: cannot read: %s"%texturl, "received:",text |
return "ERROR: cannot read: %s"%texturl, "received:",text |
textpath=getNewTextPath(path) #erzeuge neuen Ornder für den Text |
textpath=getNewTextPath(path) #erzeuge neuen Ornder fuer den Text |
splitted=string.split(texturl,"/") |
splitted=string.split(texturl,"/") |
name=splitted[len(splitted)-1] #Name des XML-files |
name=splitted[len(splitted)-1] #Name des XML-files |
try: |
try: |
Line 457 def addTextExternal(self,path,texturl,ve
|
Line 457 def addTextExternal(self,path,texturl,ve
|
try: |
try: |
texttoolnodelist=subnode.getElementsByTagName('text') |
texttoolnodelist=subnode.getElementsByTagName('text') |
|
|
if not len(texttoolnodelist)==0: #texttool tag existiert schon, dann löschen |
if not len(texttoolnodelist)==0: #texttool tag existiert schon, dann loeschen |
subsubnode=subnode.removeChild(texttoolnodelist[0]) |
subsubnode=subnode.removeChild(texttoolnodelist[0]) |
subsubnode.unlink() |
subsubnode.unlink() |
except: |
except: |
Line 571 def readArchimedesXML(folder):
|
Line 571 def readArchimedesXML(folder):
|
|
|
|
|
def combineTextImage2(self,path): |
def combineTextImage2(self,path): |
"""erstellt bzw. ändert texttool meta tag""" |
"""erstellt bzw. aendert texttool meta tag""" |
dom=xml.dom.minidom.parse(path+"/index.meta") |
dom=xml.dom.minidom.parse(path+"/index.meta") |
node=dom.getElementsByTagName('meta')[0] #getNode |
node=dom.getElementsByTagName('meta')[0] #getNode |
|
|
|
|
subnodelist=node.getElementsByTagName('texttool') |
subnodelist=node.getElementsByTagName('texttool') |
if not len(subnodelist)==0: #texttool tag existiert schon, dann löschen |
if not len(subnodelist)==0: #texttool tag existiert schon, dann loeschen |
subnode=node.removeChild(subnodelist[0]) |
subnode=node.removeChild(subnodelist[0]) |
subnode.unlink() |
subnode.unlink() |
|
|
subnode=dom.createElement('texttool') #neu erzeugen |
subnode=dom.createElement('texttool') #neu erzeugen |
|
|
|
|
presentfile=os.listdir(path+"/"+self.REQUEST['presentation'])[0] |
presentfiles=os.listdir(path+"/"+self.REQUEST['presentation']) |
|
for presentfileTmp in presentfiles: |
|
if (presentfileTmp[0]!="."): #schliesse unsichbare DAteien aus. |
|
presentfile=presentfileTmp |
|
|
|
|
displaynode=dom.createElement('display') |
displaynode=dom.createElement('display') |