File:  [Repository] / OSAS / OSA_system / Attic / OSAS_add.pyc
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Mon Oct 13 22:24:35 2003 UTC (20 years, 8 months ago) by dwinter
Branches: MAIN
CVS tags: HEAD
verbindung mit archimedes repositorium

-í
R‹?cs™dZdkZdkZdklZdklZ	dkZ
dkZdk	Z
dkZdd„Z#d„Z
.d„ZAd„ZZd	„Zhd
„Zud„Zzd„Z¥d
klZlZ§d„Z«d„ZÌd„Zìd„Zód„Zd„ZWd„Z`d„Zhd„Zod„Z d„Z!›d„Z"¯d„Z#×d„Z$dS(s1Methoden zum hinzufügen von Dokumenten ins ArchivN(sPageTemplateFile(sPageTemplateics¹dddg|_tdƒi|ƒ}|id|iid<|djod|iid<n.|iiidƒo|iid=n|ƒS|iSd	S(
sx Add metadata or metadata and documents to the repository
        no_upload=0 kein upload sonst upload von documententensBooksJournal Articles
Manuscripts Products/OSA_system/OSAS_add_newspathisyess	no_uploadN(	sselfsreferencetypessPageTemplateFiles__of__snewtemplatesREQUESTsSESSIONs	no_uploadshas_key(sselfs	no_uploadsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadds
cs²#$tddƒiƒ}%h}&x}|D&]r}'|iddƒ}(ti|dƒdiddƒ})ti|dƒdiddƒ}+|||<q.W,|SdS(NsA/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/iso639-1.incsrsasciisreplaces	ii(sfiles	readlinessfsretslinerawsencodeslinesstringssplitsvalueskey(skeysretsfslineslinerawsvalue((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysgetISO#s	
	%%csû./|id|_0|i|iid<1hddddddd	d
ddd
ddg
d<dddddddddg	d<dddddddddg	d<|_5|i|i|_6tƒ|_<tdƒi	|ƒ}=|ƒSdS(NsReference Typesreftypesauthorsyearstitles
series editorsseries titles
series volumesnumber of pagesscitys	publisherseditionsnumber of volumess
translators	ISBN ISSNsBooksjournalsvolumesissuespagessalternate journalscall numbersJournal Articleslocations	signatureseditorial remarkssdescriptionskeywordss
Manuscripts$Products/OSA_system/OSAS_add_bibdata(sselfsREQUESTsreftypesSESSIONsbibdatasfieldssgetISOsisolistsPageTemplateFiles__of__snewtemplate(sselfsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadd2.s„cs.ABh}Cd}Dd}Ed}Fd}Gti|ƒ}HxÎ|DH]Ã}I|djoJ|}Kd}Ld}nM|djo#N|||<Od}Pd}n\R|djo!S|djo
Sd}nnU|djo
Ud}nV||}qLWW|||<X|SdS(	Nsskeys=svalues&s+s-s (	squeriesskeysvaluestmpstogglesurllibsunquotesstrsi(sstrstmpstoggleskeysqueriessisvalue((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysparse_query_stringAs0					
			

	


csáZ[\t|idƒ}]||iid<^|dd d|dd d|d}_|idd	ƒ|_`|iiid
ƒo.a|iid|iid<bt|ƒSn#dt	d
ƒi
|ƒ}e|ƒSdS(s
FoldernamesQUERY_STRINGsmetadatasauthoris_stitlesyearsasciisignores	no_uploadspathsfolder_names#Products/OSA_system/OSAS_add_namingN(sparse_query_stringsselfsREQUESTsmetadatasSESSIONsvorschlag_namingsdecodeshas_keysadd5sPageTemplateFiles__of__snewtemplate(sselfsnewtemplatesvorschlag_namingsmetadata((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadd3Zs-csµhitid|iidƒidƒ|_k|id|_m|iidd|id|iid<p|i|iid<qd|_rt	dƒi
|ƒ}s|ƒSdS(Ns
/mpiwg(.*)spathisfolder_names/spageimgsProducts/OSA_system/OSAS_upload(sressearchsselfsREQUESTsSESSIONsgroupspathsfolder_namesimage_folder_namesPageTemplateFiles__of__snewtemplate(sselfsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadd4hs+,cs,uvwtdƒi|ƒ}x|ƒSdS(sADD INDEX.METAs%Products/OSA_system/OSAS_add_metadataN(sPageTemplateFiles__of__sselfsnewtemplate(sselfsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadd5uscs¥z{t|idƒ}|tii|iidƒd|d<~tii|iidƒd|d<d|d<€|iid	|_||iid
<‚||_	ƒ|iid|_„d|_
…xL|iiƒD…]8}†|i
d
|d|i|d|d|_
qÞWˆt
dƒi|ƒ}‰d|_Š|ƒ}‹|iiidƒoŒ|iidd}n$Ž|i	dd|i	dd}t|dƒ}‘|i|ƒ’|iƒ“ti|dƒ”|iiidƒo3—|iii|idd|iidƒSnpštid|i	dƒidƒ|_›t
dƒi|ƒ}žd|_Ÿ|iii ddƒ¢|ƒSdS(NsQUERY_STRINGspathisarchive-pathisfolder_namesscanned documentscontent-typesreftypesadd_metadatasmetadatass<s>s</s>
sProducts/OSA_system/index_metas
text/plains	no_uploads/index.metas/swi¤sURL2s?path=s/mpiwg/online/(.*)sProducts/OSA_system/OSAS_saveds	text/htmlsContent-Type(!sparse_query_stringsselfsREQUESTsmetadatasosspathssplitsSESSIONsreftypesadd_metadatas
metadataprintskeysstagsPageTemplateFiles__of__snewtemplatescontent_types	renderxmlshas_keysmetapathsopensfs
writelinesscloseschmodsresponsesredirectsressearchsgroupsviewpathsnewtemplate2s	setHeader(sselfsfsmetapathsnewtemplate2s	renderxmlstagsnewtemplatesmetadata((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysadd6zs:''
	6#
3((s	localtimesstrftimecs§¨tdtƒƒSdS(Ns%d.%m.%Y(sstrftimes	localtime(sself((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysdate§scsÕ«¬®tiii|dƒ}±y&²ti|idƒdiƒ}Wn,³´ti|idƒdiƒ}nXµti|idƒdiƒ}¶y&·ti|idƒdiƒ}Wnb¸¹y&ºti|idƒdiƒ}Wn,»¼ti|idƒdiƒ}nXnX½d	}¾x,¾t
iid
|ƒo¿|d	7}q9WÀd
||iid<Á||iid<Âd
|||f|iid<Étdƒi|ƒ}Ê|ƒSdS(sadd presentation to the paths/index.metasauthorisAuthorstitlesyearsYearsdateis%02d-presentationspresentationnamespaths_<info>
	<author>%s</author>
	<title>%s</title>
	<date>%s</date>
	<display>yes</display>
</info>sxmlvorschlags#Products/OSA_system/addPresentationN(sxmlsdomsminidomsparsespathsarchivesgetTextsgetElementsByTagNames
childNodessauthorstitlesdatesisossexistssselfsREQUESTsSESSIONsPageTemplateFiles__of__snewtemplate(sselfspathstitlesisauthorsdomsdatesnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddPresentation«s.&&"&&*	 csÌÍÎ|id}Ð|id}Ò|iid}Ô|iidƒoÕ|id}Öd}nFÙ|idi	}Ú|ii
diƒ}Üd}Ý|id}Þyßti
|d|ƒWn
àánXãt|d|d|dƒ}ä|i|ƒå|iƒæti|d|d	ƒçti|d|d|d
ďt|||dĐ|iii|idd
|ƒSdS(sadd presentation sfolder_namescontent_descriptionspaths
fileuploadsxmltextsinfo.xmls/swiíi¤spresentationsURL2s?path=N(sselfsREQUESTsfolder_namescontent_descriptionsSESSIONspathshas_keysxmlinfos	file_namesfilenamesformsreadsossmkdirsopensfswritescloseschmodsaddDirsToIndexMetasRESPONSEsredirect(sselfscontent_descriptionsfolder_names	file_namespathsfsxmlinfo((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddPresentation2Ìs,
	"
#csUìíîdg|iid<ï||iid<ðtdƒi|ƒ}ñ|ƒSdS(sadd fulltext to the pathspageimgsexisting_namesspathsProducts/OSA_system/addTextN(sselfsREQUESTsSESSIONspathsPageTemplateFiles__of__snewtemplate(sselfspathsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddTextìs
cs6óô|id}ö|id}÷|iid}ø|idi}ù|iidi	ƒ}úti|d|ƒût
|d|d|dƒ}ü|i|ƒý|iƒþti|d|dƒÿti|d|d|dƒt|||d	ƒ|iii|id
d|ƒSdS(Nsfolder_namescontent_descriptionspaths
fileuploads/swiíi¤sfulltextsURL2s?path=(sselfsREQUESTsfolder_namescontent_descriptionsSESSIONspathsfilenames	file_namesformsreadsfiledatasossmkdirsopensfswritescloseschmodsaddDirsToIndexMetasRESPONSEsredirect(sselfscontent_descriptionsfolder_names	file_namespathsfiledatasf((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddText2ós"
#csMyIti|ƒiƒ}d}	x|D	]}
||}q7WWnd|SnX
t|ƒod|d|fSnt|ƒ}ti|dƒ}|t|ƒd}y&t|d|d|dƒ}
Wn%d|d|d|SnX|
i|ƒ|
iƒti|d|d|dƒtiii|d	ƒ}|id
ƒd}|idƒ} |id
ƒ}
!|i|ƒ}"|
i!|ƒ#|i!|
ƒ%|idƒ}	&|id|ƒ}'|	i!|ƒ(|i!|	ƒ*|idƒ}+|idƒ},|i!|ƒ-|i!|ƒ/|i!|ƒ1t|d	dƒ}
2|
i|i'ƒi(dƒƒ3|
iƒ6tiii|d	ƒ}7|idƒd}9y:|idƒd}Wn;<dSnX?yT@|idƒ}Bt|ƒdjo'C|i*|dƒ}D|i,ƒnWn
EFnXH|idƒ}I|i|d|ƒ}J|i!|ƒK|i!|ƒNt|d	dƒ}
O|
i|i'ƒi(dƒƒP|
iƒStid|ƒiƒUd|d|SdS(s hinzufügen eines externen textesssERROR: cannot read: %ss	received:s/iswsERROR: cannot write: %si¤s/index.metasresourceisdirsnamesdescriptionsarchimedes text:scontent-typesfulltextsutf-8smetastexttoolsBERROR:no presentation configured yet, user Web Front End to do so!stextsFhttp://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%ssDONE:N(/surllibsurlopenstexturls	readlinesstexttempstextslinesTextExternalErrorsgetNewTextPathspathstextpathsstringssplitssplittedslensnamesfiles	writefileswritesclosesosschmodsxmlsdomsminidomsparsesgetElementsByTagNamesnodes
createElementssubnodesnamenodescreateTextNodesnamenodetextsappendChildsdescriptionnodesversionsdescriptionnodetextscontentnodescontentnodetextstoxmlsencodestexttoolnodelistsremoveChilds
subsubnodesunlinkstextfoldernodestextfoldernodetext(sselfspathstexturlsversionsnodesdescriptionnodetextstextscontentnodestexttoolnodelistsdescriptionnodes	writefilestexttemps
subsubnodesnamenodeslinessubnodestextfoldernodetextstextfoldernodesnamestextpathsdomscontentnodetextssplittedsnamenodetext((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddTextExternals|	
	&
#

csNWX|dd!}Zy[tid|ƒ}Wn\]dSnX^dSdS(Nii
s	.*<?xml.*i(stextsfirstssressearchsmatch(stextsfirstssmatch((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysTextExternalErrorWscs„`ad}bx0btii|d|ƒoc|d7}qWdti|d|ƒeti|d|dƒfd|SdS(Nis/fulltext%iiís
fulltext%i(sisosspathsexistssmkdirschmod(spathsi((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysgetNewTextPath`s	csUhijdg|iid<k||iid<ltdƒi|ƒ}m|ƒSdS(sImagesfolder to the pathspageimgsexisting_namesspaths"Products/OSA_system/OSAS_addImagesN(sselfsREQUESTsSESSIONspathsPageTemplateFiles__of__snewtemplate(sselfspathsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pys	addImageshs
cs¶oq|id|_s|id|_wd|_xt|iid|i|i|iƒytid|iidƒi	dƒ|iid<zt
dƒi|ƒ}{|ƒSdS(Nsfolder_namescontent_descriptionsimagesspaths
/mpiwg(.*)is Products/OSA_system/OSAS_upload2(
sselfsREQUESTsimage_folder_namescontent_descriptionscontent_typesaddDirsToIndexMetasSESSIONsressearchsgroupsPageTemplateFiles__of__snewtemplate(sselfsnewtemplate((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pys
addImages2os)2csitiii|dƒ}‚|idƒd}„|idƒ}
†|idƒ}‡|i
|ƒ}ˆ|i
|ƒ‰|
i
|ƒ‹|idƒ}	Œ|i
|ƒ}|	i
|ƒŽ|
i
|	ƒ|idƒ}‘|i
|ƒ}
’|i
|
ƒ“|
i
|ĥ|i
|
ƒ—t|ddƒ}˜|i|iƒid	ƒƒ™|iƒdS(
Ns/index.metasresourceisdirsnamesdescriptionscontent-typeswsutf-8(sxmlsdomsminidomsparsespathsgetElementsByTagNamesnodes
createElementssubnodesnamenodescreateTextNodesfolder_namesnamenodetextsappendChildsdescriptionnodescontent_descriptionsdescriptionnodetextscontentnodescontent_typescontentnodetextsfiles	writefileswritestoxmlsencodesclose(spathsfolder_namescontent_descriptionscontent_typesnodesdescriptionnodetextsdomsnamenodetextscontentnodesdescriptionnodescontentnodetexts	writefilesnamenodessubnode((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysaddDirsToIndexMetas&csÍ›œtidƒiƒ}Ÿtiii|ƒ} |idƒ}¡h}£xI|D£]>}¥y%¦|idi
||idi
<Wn
¨©nXq[W«|i|ƒo¬||Sn®dSdS(sgib URL aus sPhttp://archimedes.mpiwg-berlin.mpg.de/cgi-bin/toc/toc.cgi?step=xmlcorpusmanifestsitemsurisdirsN(surllibsurlopensreadsXMLsxmlsdomsminidomsparseStringsgetElementsByTagNamesitemssdictsitems
attributessvalueshas_keysfolder(sfoldersXMLsdictsitemsdomsitems((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pysreadArchimedesXML›s	
	%cs¯°±ti|ƒ}³g}´g}µg}·|idƒ}¸t	|t
|ƒdƒ}	ºx”|Dº]‰}¼t
i|d|ƒo½|i|ƒn¿t
i||ƒoÁ|i|ƒnÂt
i||ƒoÃ|i|ƒnqlWÅtiii|dƒ}Æy&Çt
i|idƒdiƒ}WnÈÉd}nXÊtƒ|iid<Ë||iid<Ì||iid	<Í||iid
<Î||iid<Ï||iid<Ð|	|iid
<Òtdƒi|ƒ}
Ó|
ƒSdS(s=gibt input formular zur erstellung des texttools meta tag auss/is/index.metaslangissisolistspathstextssimagefoldersspresentationfolderssfilelanguages	externxmls Products/OSA_system/ImageandTextN(!sosslistdirspathsfilesstextssimagefoldersspresentationfoldersssplitssplittedsreadArchimedesXMLslens	externxmlsfilenamesarchives
isdigilib2sappends
isFullTextsisPresentationsxmlsdomsminidomsparsesgetTextsgetElementsByTagNames
childNodessfilelanguagesgetISOsselfsREQUESTsSESSIONsPageTemplateFiles__of__snewtemplate(sselfspathsfilesspresentationfolderssdomsfilenamesfilelanguagestextsssplitteds	externxmlsnewtemplatesimagefolders((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pyscombineTextImage¯s:			
	&
cs¨×ØÙtiii|dƒ}Ú|idƒd}Ý|idƒ}Þt|ƒdjo'ß|i	|dƒ}à|iƒnâ|idƒ}åt
i|d|idƒd}è|idƒ}é|idƒ}ê|i|ƒë|i|ƒí|iid	ƒoOî|id	ƒ}ï|i|id	ƒ}ð|i|ƒñ|i|ƒnó|iid
ƒo|ôt
i|d|id
ƒd}
õ|id
ƒ}ö|i|id
d|
ƒ}
÷|i|
ƒø|i|ƒnú|iidƒoRû|id
ƒ}ü|i|iidƒ}
ý|i|
ƒþ|i|ƒn|iid
ƒoO|id
ƒ}|i|id
ƒ}	|i|	ƒ|i|ƒn|iidƒoW|idƒ}|i|idd|ƒ}	|i|ƒ
|i|ƒn|i|ƒy@|idƒd}|idƒd}|i	|ƒWn
nXye|idƒd}|idƒ}|i|idƒ}|i|ƒ|i|ƒWn
nXt$|ddƒ}|i&|i'ƒi(dƒƒ|i)ƒ#t*i+d|ƒi,ƒ%t
i-dt.i!dd|idd|id	ƒƒdS(s&erstellt bzw. ändert texttool meta tags/index.metasmetaistexttools/spresentationsdisplaysyessimagestextsexternals	externxmls	pagebreaksbibslangswsutf-8sFhttp://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%sslssh nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 &s
mpiwg/online/sspathN(/sxmlsdomsminidomsparsespathsgetElementsByTagNamesnodessubnodelistslensremoveChildssubnodesunlinks
createElementsosslistdirsselfsREQUESTspresentfilesdisplaynodescreateTextNodesdisplaynodetextsappendChildshas_keysnamenodesnamenodetextstextfilestextfoldernodestextfoldernodetextsSESSIONs
pagebreaknodespagebreaknodetextspresentationnodespresentationnodetextssubsmainstextnodesfiles	writefileswritestoxmlsencodesclosesurllibsurlopens	readlinesspopensre(sselfspathsnodesnamenodetextstextnodes	writefilesdisplaynodesnamenodesdisplaynodetextspagebreaknodetextstextfilespresentfilessubnodestextfoldernodetextssubnodelistsmainspresentationnodessubsdomspresentationnodetexts
pagebreaknodestextfoldernode((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pyscombineTextImage2×sv%%!!
(%s__doc__sarchivesoss'Products.PageTemplates.PageTemplateFilesPageTemplateFiles#Products.PageTemplates.PageTemplatesPageTemplatesstringsurllibsxml.dom.minidomsxmlsresaddsgetISOsadd2sparse_query_stringsadd3sadd4sadd5sadd6stimes	localtimesstrftimesdatesaddPresentationsaddPresentation2saddTextsaddText2saddTextExternalsTextExternalErrorsgetNewTextPaths	addImagess
addImages2saddDirsToIndexMetasreadArchimedesXMLscombineTextImagescombineTextImage2( sgetNewTextPathsstringsparse_query_strings
addImages2saddTextsaddText2saddPresentation2scombineTextImagesaddDirsToIndexMetasdatesarchivesaddPresentationsreadArchimedesXMLsxmlsadd6sadd5sadd4sadd3sadd2saddTextExternalscombineTextImage2s	addImagessurllibsPageTemplatesresaddsPageTemplateFilesgetISOsTextExternalErrorsossstrftimes	localtime((s@/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/OSAS_add.pys?s>
+! S	(

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>