new admin templates! with many thanks to init...
authorzapata <zapata>
Wed, 9 Apr 2003 02:06:06 +0000 (02:06 +0000)
committerzapata <zapata>
Wed, 9 Apr 2003 02:06:06 +0000 (02:06 +0000)
143 files changed:
bundles/admin.properties [deleted file]
bundles/admin_ay.properties [deleted file]
bundles/admin_de.properties
bundles/admin_en.properties
bundles/admin_es.properties
bundles/admin_eu.properties
bundles/admin_gn.properties [deleted file]
bundles/admin_nl.properties
bundles/admin_pt.properties
bundles/admin_qu.properties [deleted file]
bundles/admin_sv.properties
bundles/admin_tr.properties
bundles/admin_zh.properties
source/Mir.java
source/OpenMir.java
source/default.properties
source/mir/entity/Entity.java
source/mir/entity/EntityBrowser.java
source/mir/entity/adapter/EntityAdapterModel.java
source/mir/generator/FreemarkerGenerator.java
source/mir/log/Log.java
source/mir/log/log4j/LoggerImpl.java
source/mir/misc/FileUtil.java
source/mir/misc/HTMLTemplateProcessor.java
source/mir/misc/MessageMethodModel.java [deleted file]
source/mir/misc/WebdbImage.java
source/mir/producer/ExpandedAssignmentProducerNode.java
source/mir/producer/RSSProducerNode.java
source/mir/producer/reader/DefaultProducerNodeBuilders.java
source/mir/producer/reader/ProducerConfigReader.java
source/mir/rss/RSSData.java
source/mir/rss/RSSReader.java
source/mir/rss/RSSToMapConverter.java
source/mir/servlet/ServletModule.java
source/mir/servlet/ServletModuleShow.java
source/mir/storage/Database.java
source/mir/storage/store/ObjectStore.java
source/mir/storage/store/StoreContainerType.java
source/mir/storage/store/StoreIdentifier.java
source/mir/util/FileFunctions.java
source/mir/util/HTMLRoutines.java
source/mir/util/HTTPRequestParser.java
source/mir/util/PropertiesManipulator.java
source/mir/util/ResourceBundleGeneratorFunction.java
source/mir/util/SimpleParser.java
source/mir/util/XMLReader.java
source/mircoders/entity/EntityAudio.java
source/mircoders/entity/EntityOther.java
source/mircoders/entity/EntityVideo.java
source/mircoders/global/Abuse.java
source/mircoders/localizer/MirDataModelLocalizer.java
source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java
source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java
source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java
source/mircoders/media/MediaHandlerImagesExtern.java
source/mircoders/media/MediaHandlerVideo.java
source/mircoders/module/ModuleUsers.java
source/mircoders/servlet/ServletHelper.java
source/mircoders/servlet/ServletModuleAbuse.java
source/mircoders/servlet/ServletModuleAdmin.java
source/mircoders/servlet/ServletModuleBreaking.java
source/mircoders/servlet/ServletModuleComment.java
source/mircoders/servlet/ServletModuleCommentStatus.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleFileEdit.java
source/mircoders/servlet/ServletModuleHidden.java
source/mircoders/servlet/ServletModuleLinksImcs.java
source/mircoders/servlet/ServletModuleLocalizer.java
source/mircoders/servlet/ServletModuleMessage.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mircoders/servlet/ServletModuleProducer.java
source/mircoders/storage/DatabaseArticleType.java
source/mircoders/storage/DatabaseAudio.java
source/mircoders/storage/DatabaseComment.java
source/mircoders/storage/DatabaseCommentStatus.java
source/mircoders/storage/DatabaseContentToMedia.java
source/mircoders/storage/DatabaseContentToTopics.java
source/mircoders/storage/DatabaseImageColor.java
source/mircoders/storage/DatabaseImageFormat.java
source/mircoders/storage/DatabaseImageLayout.java
source/mircoders/storage/DatabaseImageType.java
source/mircoders/storage/DatabaseImages.java
source/mircoders/storage/DatabaseLanguage.java
source/mircoders/storage/DatabaseLinksImcs.java
source/mircoders/storage/DatabaseMessages.java
source/mircoders/storage/DatabaseOther.java
source/mircoders/storage/DatabaseRights.java
source/mircoders/storage/DatabaseTopics.java
source/mircoders/storage/DatabaseUploadedMedia.java
source/mircoders/storage/DatabaseUsers.java
source/mircoders/storage/DatabaseVideo.java
source/tool/BundleTool.java
templates/admin/FUNCTIONS.template [new file with mode: 0755]
templates/admin/FUNCTIONS_media.template [new file with mode: 0755]
templates/admin/abuse.filters.template
templates/admin/abuse.log.template
templates/admin/abuse.template
templates/admin/articletype.template
templates/admin/articletypelist.template
templates/admin/audio.template
templates/admin/audiolist.template
templates/admin/breaking.template
templates/admin/breakinglist.template
templates/admin/comment.template
templates/admin/commentlist.template
templates/admin/commentstatus.template
templates/admin/commentstatuslist.template
templates/admin/confirm.template
templates/admin/content.template
templates/admin/contentlist.template
templates/admin/error.template
templates/admin/fileedit.template
templates/admin/fileeditlist.template
templates/admin/foot.template
templates/admin/head.template
templates/admin/head_nonavi.template
templates/admin/hiddenlist.template
templates/admin/image.template
templates/admin/imagelist.template
templates/admin/infomessage.template
templates/admin/language.template
templates/admin/languagelist.template
templates/admin/linksimcslist.template
templates/admin/login.template
templates/admin/media.template
templates/admin/mediafolder.template
templates/admin/mediafolderlist.template
templates/admin/medialist.template
templates/admin/message.template
templates/admin/messagelist.template
templates/admin/producerqueue.template
templates/admin/start_admin.template
templates/admin/superusermenu.template
templates/admin/topic.template
templates/admin/topiclist.template
templates/admin/user.template
templates/admin/usererror.template
templates/admin/userlist.template
templates/admin/video.template
templates/admin/videolist.template
templates/error.template [deleted file]
templates/usererror.template [deleted file]
web/style/admin.css

diff --git a/bundles/admin.properties b/bundles/admin.properties
deleted file mode 100755 (executable)
index 934648a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# you can replace this file with a link to your default language admin bundle
-htmlcharset=utf-8
diff --git a/bundles/admin_ay.properties b/bundles/admin_ay.properties
deleted file mode 100755 (executable)
index 3dffa24..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-########## admin ##########\r
-# language: aymara
-
-languagename=Aymara
-\r
-# general\r
-yes=sí\r
-no=no\r
-dontcare=no importa\r
-all=todo\r
-\r
-# actions\r
-insert=insertar\r
-save=guardar\r
-edit=editar\r
-delete=borrar\r
-add=añadir\r
-filter=filtrar\r
-attach=vincular\r
-list=mostrar lista\r
-back=atrás\r
-cancel=cancelar\r
-\r
-# records\r
-records=registros\r
-show_from_to=mostrando entradas desde {0} hasta {1}\r
-no_matches_found=No se encontraron resultados!\r
-list.next=siguiente\r
-list.previous=anterior\r
-\r
-# media - used by image, audio, video and other media\r
-media.created=creado\r
-media.changed=cambiado\r
-media.published=publicado\r
-media.format=Formato\r
-media.rights=Copyright\r
-media.type=Tipo\r
-media.mediafolder=Carpeta de recursos mediáticos\r
-media.title=Título\r
-media.description=Descripción\r
-media.date=Fecha\r
-media.location=Lugar de origen\r
-media.creator=Creador\r
-media.keywords=Palabras clave\r
-media.comment=Comentario\r
-media.source=Origen\r
-media.is_published=Disponible para publicación\r
-media.icon=Icono\r
-media.nr_of_media=Número de recursos mediáticos
-media.nr_of_media.submit=Anzahl festlegen
-medialist.search_text_in=Buscar texto en\r
-\r
-# image\r
-image.htmltitle=imagen\r
-imagelist.htmltitle=lista de imagenes\r
-\r
-# audio\r
-audio.htmltitle=audio\r
-audiolist.htmltitle=lista de audio\r
-\r
-# video\r
-video.htmltitle=video\r
-videolist.htmltitle=lista de video\r
-\r
-# other\r
-other_media.htmltitle=otros recursos mediáticos\r
-other_media.htmltitle=lista de recursos mediáticos\r
-\r
-# breaking\r
-breaking.htmltitle=últimas noticias\r
-breakinglist.htmltitle=listado de últimas noticias\r
-breaking.textinfo=(max. 5 líneas / 250 caracteres)\r
-breaking.text=texto\r
-breaking.date=fecha\r
-\r
-\r
-# comment\r
-comment.htmltitle=commentario\r
-comment.date=fecha\r
-comment.title=título\r
-comment.published=publicado\r
-comment.text=texto-del-comentario\r
-comment.address=dirección\r
-comment.phone=teléfono\r
-comment.email=email\r
-comment.url=url\r
-comment.creator=autor\r
-comment.article=del artículo\r
-comment.html=HTML?
-comment.status=Status # needs translation 
-\r
-commentlist.htmltitle=lista de comentarios\r
-commentlist.published=publicado\r
-commentlist.hidden=oculto\r
-commentlist.search=buscar!
-
-commentlist.order.datedesc= date (desc.)                  # needs translation
-commentlist.order.dateasc= date (asc.)                    # needs translation
-commentlist.order.articletitle= article title             # needs translation
-\r
-\r
-# confirm\r
-confirm.htmltitle=confirmar borrado\r
-confirm.really_delete=Desea borrar esta entrada?\r
-\r
-# content\r
-content.htmltitle=contenido\r
-content.owner=Propietario\r
-content.topic=Tema\r
-content.feature=Característica\r
-content.title=titulo largo\r
-content.subtitle=subtítulo/título de contexto\r
-content.location=Lugar de origen\r
-content.creator=autor\r
-content.creator.email=Email\r
-content.creator.url=Web\r
-content.creator.address=Dirección\r
-content.creator.telephone=Teléfono\r
-content.abstract=Descripción breve\r
-content.content=Contenido\r
-content.html=es HTML?\r
-content.comment=Comentario interno\r
-content.internal=(propósito interno)\r
-content.attachments=Vínculos\r
-content.images=Imágenes\r
-content.audio=Audio\r
-content.video=Video\r
-content.other=Otros recursos mediáticos\r
-content.media=Recursos mediáticos\r
-content.addimage=añadir imagen\r
-content.addaudio=añadir audio\r
-content.addvideo=añadir video\r
-content.addother=añadir otros recursos mediáticos\r
-content.creationdate=fecha\r
-content.modificationdate=último cambio\r
-content.status=Estado\r
-content.type=Tipo de artículo\r
-content.published=publicado
-content.comments=Comentarios\r
-\r
-contentlist.htmltitle=lista de contenidos\r
-\r
-# language\r
-language.htmltitle=idiomas\r
-language.name=idioma\r
-language.code=Código del idioma\r
-\r
-languagelist.htmltitle=lista de idiomas\r
-\r
-# imcs\r
-linkimcs.htmltitle=Enlaces a IMCs\r
-linkimcs.name=Nombre\r
-linkimcs.continent=Continente\r
-linkimcs.new_parent=Nuevo Ancestro\r
-linkimcs.url=URL\r
-linkimcs.sort_by=Criterio de orden\r
-linkimcs.language=Idioma\r
-linkimcs.parent=ancestro\r
-\r
-linkimcslist.htmltitle=Lista de enlaces a IMCs\r
-linkimcslist.search_in=Buscar texto en\r
-\r
-# login\r
-login.htmltitle=registro\r
-login.info=Esta zona es accesible exclusivamente a grupos autorizados. Si desea colaborar como editor, por favor contacte con nosotros en {0}\r
-login.title=login\r
-login.name=Login\r
-login.password=Password\r
-login.language=Idioma
-login.submit=  Envíar\r
-\r
-# mediafolder\r
-mediafolder.htmltitle=carpeta de recursos mediáticos\r
-mediafolder.date=fecha\r
-mediafolder.name=nombre\r
-mediafolder.location=lugar de origen\r
-mediafolder.keywords=palabras clave\r
-mediafolder.comment=commentario\r
-\r
-mediafolderlist.htmltitle=lista de carpetas de recursos mediáticos\r
-\r
-# message\r
-message.htmltitle=mensajes\r
-message.date=fecha\r
-message.title=título\r
-message.creator=Autor\r
-message.text=texto\r
-message.textinfo=(max. 5 líneas / 250 caracteres)\r
-\r
-messagelist.htmltitle=lista de mensajes\r
-\r
-# feature\r
-feature.htmltitle=presentación\r
-feature.title=Título\r
-feature.published=publicado\r
-feature.is_published=está publicado\r
-feature.is_not_published=no está publicado\r
-feature.filename=Nombre del fichero\r
-feature.abstract=Descripción breve\r
-feature.link=Enlace\r
-\r
-featurelist.htmltitle=lista de presentaciones\r
-\r
-# admin start page\r
-start.htmltitle=administración\r
-start.openpostings.title=ENVÍOSABIERTOS\r
-start.comments.title=COMENTARIOS\r
-start.breaking.title=ÚLTIMAS NOTICIAS\r
-start.breaking.new=últimas noticias recientes\r
-start.content.title=ARTICULOS\r
-start.content.new=nuevos artículos\r
-start.show=mostrar\r
-start.content.newswire=newswire\r
-start.content.feature=presentación\r
-start.content.topicspecial=especiales-por-tema\r
-start.content.startspecial=especiales-página-de-inicio\r
-start.content.not_published=artículos aun sin publicar\r
-start.content.with_media=con recursos mediáticos\r
-start.content.last_changes=últimos cambios\r
-start.content.with_comments=con comentarios de propósito interno
-start.content.all=todos\r
-start.content.search=buscar\r
-start.generate.title=GENERAR MANUALMENTE\r
-start.generate.all.title=todas las areas\r
-start.generate.all.new=todo nuevo (estándar, actualización en la web > 5min.)\r
-start.generate.parts.title=partes específicas del website\r
-start.generate.startpages.new=nueva página de inicio\r
-start.generate.all_forced=todos (forzado)\r
-start.generate.all_sync=todos (forzado y sincronizado)\r
-start.generate.content.new=nuevo contenido\r
-start.generate.topics.new=nuevos temas\r
-start.generate.postings.new=nuevos envios abiertos\r
-start.generate.images.new=nuevas imágenes\r
-start.generate.audio.new=nuevos ficheros de audio\r
-start.generate.video.new=nuevos ficheros de video\r
-start.generate.other.new=otros recursos mediáticos nuevos\r
-start.generate.navigation=navegación\r
-start.coverage.title=COBERTURA\r
-start.topics.title=TEMAS\r
-start.images.title=MATERIAL GRAFICO\r
-start.mediafolder.title=CARPETA DE RECURSOS MEDIATICOS\r
-start.languages.title=TÍTULO\r
-start.imcs.title=IMCS\r
-start.messageboard.title=Mensajería Interna\r
-start.messageboard.no_messages=no hay mensajes
-
-start.superusermenu=Superuser menu (use with care!) # needs translation\r
-\r
-# topic\r
-topic.htmltitle=tema\r
-topic.title=Nombre\r
-topic.description=descripción\r
-topic.filename=Nombre del fichero\r
-topic.main_url=página de información principal\r
-topic.archive_url=URL del archivo\r
-\r
-topiclist.htmltitle=lista de temas
-
-articletype.htmltitle=Article type  # needs translation
-articletype.id=id  # needs translation
-articletype.name=Name  # needs translation
-
-articletypelist.htmltitle=Article types  # needs translation
-
-commentstatus.htmltitle=Comment status  # needs translation
-commentstatus.id=id  # needs translation
-commentstatus.name=Name  # needs translation
-
-commentstatuslist.htmltitle=Comment status values  # needs translation
-
-
-superusermenu.htmltitle = Super-user functions                  # needs translation\r
-superusermenu.topics = Manage topics                            # needs translation\r
-superusermenu.articletypes = Manage article types               # needs translation  \r
-superusermenu.comment_statuses = Manage comment status values   # needs translation\r
-superusermenu.users = Manage users                              # needs translation\r
-superusermenu.languages = Manage languages                      # needs translation \r
-superusermenu.imcs = Manage IMCS (obsolete)                     # needs translation\r
-\r
-\r
-# users\r
-user.htmltitle=usuario\r
-user.login=login\r
-user.password=password\r
-user.admin=administrador\r
-\r
-userlist.htmltitle=lista de usuarios\r
-\r
-# head\r
-head.start=inicio\r
-head.logout=salir\r
-head.help=ayuda\r
-head.search=buscar\r
-head.logged_in=estás registrado\r
-\r
-# foot\r
-foot.top=arriba\r
-\r
-\r
-########## error ##########\r
-\r
-error.htmltitle=error\r
-error.title=oi! oi! oi!\r
-error.text=El siguiente mensaje puede que no le sea de mucha ayuda, pero seguramente lo será para <a href="mailto:{0}">{1}</a>:\r
-error.text2=Por favor envíe un mensaje con el <font color="Red">texto que aparece en rojo</font> y una descripción detallada a la siguiente dirección <a href="mailto:{0}">{1}</a>. Gracias!\r
-\r
-\r
-usererror.htmltitle=error de datos\r
-usererror.title=oi! oi! oi!\r
-usererror.text=Los datos que ha introducido han causado el siguiente error:\r
-usererror.what_to_do=Por favor, pulse el botón para volver e intentelo de nuevo
-htmlcharset=utf-8
index 24044ce..ef099c1 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: deutsch / german
-# $Id: admin_de.properties,v 1.26 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_de.properties,v 1.27 2003/04/09 02:06:06 zapata Exp $
 
 languagename=Deutsch
 
@@ -9,30 +9,43 @@ yes=ja
 no=nein
 dontcare=egal
 all=alle
-year=Jahr
 month=Monat
+year=Jahr
 file=Datei
+new=neu
+by=von 
+help=Hilfe
+
 
 # actions
 insert=einf&uuml;gen
 save=speichern
 edit=bearbeiten
 delete=l&ouml;schen
-add=hinzuf&uuml;gen
-filter=filter
-attach=attach
-list=browse
+add=neu
+filter=filtern
+attach=anh&auml;ngen
+list=auflisten
 back=zur&uuml;ck
 cancel=abbrechen
 preview=Vorschau
+reset=reset
+administer=administrieren
+search=suchen
+
+
+# special
+fileedit=Dateien bearbeiten
+
 
 # records
-records=Datens&auml;tze
-show_from_to=Anzeige von {0} bis {1}
-no_matches_found=Noch keine passenden Eintr&auml;ge gefunden!
+records=Eintr&auml;ge
+show_from_to=zeige von {0} bis {1}
+no_matches_found=(noch) keine Eintr&auml;ge gefunden
 list.next=weiter
 list.previous=zur&uuml;ck
 
+
 # media - used by image, audio, video and other media
 media.created=erzeugt
 media.changed=letzte &auml;nderung
@@ -55,23 +68,28 @@ media.icon=Icon
 media.nr_of_media=Anzahl der Medien (max 20)
 media.nr_of_media.submit=Anzahl festlegen
 
-medialist.search_text_in=Text suchen in
+medialist.search_text_in=Search text in
+
 
 # image
-image.htmltitle=image
-imagelist.htmltitle=imagelist
+image.htmltitle=Bilder
+imagelist.htmltitle=Bilder Liste
+
 
 # audio
-audio.htmltitle=audio
-audiolist.htmltitle=audiolist
+audio.htmltitle=Audio
+audiolist.htmltitle=Audio Liste
+
 
 # video
-video.htmltitle=video
-videolist.htmltitle=videolist
+video.htmltitle=Video
+videolist.htmltitle=Video Liste
+
 
 # other
-other_media.htmltitle=other media
-other_media.htmltitle=other medialist
+other_media.htmltitle=andere Medien
+other_medialist.htmltitle=andere Medien Liste
+
 
 # breaking
 breaking.htmltitle=breaking news
@@ -79,10 +97,11 @@ breaking.textinfo=(max. 5 Zeilen / 250 Zeichen)
 breaking.text=Text
 breaking.date=Datum
 
-breakinglist.htmltitle=breaking new list
+breakinglist.htmltitle=Breaking news Liste
+
 
 # comment
-comment.htmltitle=comment
+comment.htmltitle=Erg&auml;nzungen
 comment.date=Datum
 comment.title=Titel
 comment.published=publiziert
@@ -92,72 +111,142 @@ comment.phone=Telefon
 comment.email=Email
 comment.url=Url
 comment.creator=Uhrheber
-comment.article=zu artikel
+comment.article=zu Artikel
 comment.html=HTML?
-comment.status=Status # needs translation 
+comment.status=Status 
 comment.language=Sprache
 
-commentlist.htmltitle=commentlist
-commentlist.published=publiziert
+comment.operation.hide=verstecken
+comment.operation.unhide=zeigen
+
+
+#commentlist
+commentlist.htmltitle=Kommentare Liste
+commentlist.published=sichtbar
 commentlist.hidden=versteckt
 commentlist.search=go!
+commentlist.activate = &Auml;nderungen aktivieren
+commentlist.order = Reihenfolge
+commentlist.order.datedesc= Datum (abst.)
+commentlist.order.dateasc= Datum (aufst.)
+commentlist.order.articletitle= Artikel Titel
 
-commentsearch.order.datedesc= date (desc.)                  # needs translation
-contentsearch.order.dateasc= date (asc.)                    # needs translation
-contentsearch.order.articletitle= article title             # needs translation
+commentsearch.field = Suchen 
+commentsearch.field.title = Title
+commentsearch.field.creator = Author
+commentsearch.field.description = Beschreibung
+commentsearch.value = Feld
+
+commentsearch.publishedstate = Publish Status
+commentsearch.publishedstate.hidden = versteckt
+commentsearch.publishedstate.published = sichtbar
+
+commentsearch.status = Status
+
+commentsearch.order = Reihenfolge
+commentsearch.order.datedesc= Datum (abst.)
+commentsearch.order.dateasc= Datum (aufst.)
+commentsearch.order.articletitle= Artikeltitel
+
+commentsearch.searchbutton = suchen
 
 
 # confirm
-confirm.htmltitle=confirm delete
-confirm.really_delete=Datensatz wirklich l&ouml;schen?
+confirm.htmltitle=L&ouml;schen best&auml;tigen
+confirm.really_delete=Eintrag wirklich l&ouml;schen?
+confirm.text=Der Eintrag wird endg&uuml;ltig aus der Datenbank entfernt!
+
 
 # content
-content.htmltitle=content
-content.owner=Datensatz geh&ouml;rt
-content.topic=Thema
-content.feature=Feature
-content.title=Langer Titel
-content.subtitle=Kurztitel/Kontexttitel
+content.htmltitle=Artikel
+content.owner=Eigner
+content.language=Sprache
+content.articletype=Artikel Typ
+content.topic=Topic
+content.title=Titel
+content.subtitle=Subtitel / Kontenttitek
 content.location=Ort
 content.creator=Autor
-content.creator.email=Email
+content.creator.email=E-mail
 content.creator.url=Web
 content.creator.address=Adresse
 content.creator.telephone=Telefon
 content.abstract=Abstract
 content.content=Inhalt
-content.html=HTML?
-content.comment=Internes Kommentar
+content.html=HTML
+content.comment=interne Bemerkung
 content.internal=(intern)
+
 content.attachments=Attachments
 content.images=Bilder
 content.audio=Audio
 content.video=Video
-content.other=Sonstiges
+content.other=Andere Medien
 content.media=Medien
-content.addimage=Bild hinzuf&uuml;gen
-content.addaudio=Audio hinzuf&uuml;gen
-content.addvideo=Video hinzuf&uuml;gen
-content.addother=Sonstiges medien hinzuf&uuml;gen
-content.creationdate=date
-content.modificationdate=last change
+content.addimage=Bild anh&auml;ngen
+content.uploadimage=Bild hochladen
+content.addaudio=Audio anh&auml;ngen
+content.uploadaudio=Audio hochladen
+content.addvideo=Video anh&auml;ngen
+content.uploadvideo=Video hochladen
+content.addother=Medien anh&auml;ngen
+content.uploadother=Andere Medien hochladen
+
+content.creationdate=Datum
+content.modificationdate=letzte &Auml;nderung
 content.status=Status
-content.type=articletype
-content.import_date=Importiert
-content.lastchange_date=zuletzt geäendert
-content.create_date=Datum
-content.published=publiziert
-content.comments=Ergänzungen
+content.type=Artikeltyp
+content.import_date=Einf&uuml;gedatum 
+content.lastchange_date=letzte &Auml;nderung
+content.create_date=Datum 
+content.published=ver&ouml;ffentlicht
+content.comments=Erg&auml;nzungen
+
+content.family=Kinder & Eltern
+content.children=Kind
+content.viewchildren=zeigen
+content.parent=Mutter
+content.viewparent=zeigen
+content.clearparent=l&ouml;sen
+content.selectparent=w&auml;hlen
+
+content.operation.hide=verstecken
+content.operation.unhide=zeigen
+content.operation.newswire=Newswire
+
+contentsearch.value = suchen:
+contentsearch.field = Feld
+contentsearch.field.title = Titel
+contentsearch.field.creator = Autor
+contentsearch.field.contents=Inhalt
+
+contentsearch.publishedstate = Status
+contentsearch.publishedstate.hidden=versteckt
+contentsearch.publishedstate.published=sichtbar
+
+contentsearch.articletype = Artikeltyp
+
+contentsearch.order = sortieren nach
+contentsearch.order.datedesc=Neue zuerst
+contentsearch.order.dateasc=Alte zuerst
+contentsearch.order.title=nach Titel
+contentsearch.order.creator=nach Autor
+contentsearch.searchbutton=suchen
+
+
+#contentlist
+contentlist.htmltitle=Artikel Liste
+contentlist.comments=Erg&auml;nzungen
+contentlist.select=w&auml;hlen
 
-contentlist.htmltitle=contentlist
-contentlist.comments=ergänzungen
 
 # language
-language.htmltitle=languages
+language.htmltitle=Sprache
 language.name=Sprache
-language.code=Ländercode
+language.code=Language code
+
+languagelist.htmltitle=Sprachen
 
-languagelist.htmltitle=languages list
 
 # imcs
 linkimcs.htmltitle=LinksImcs
@@ -172,6 +261,7 @@ linkimcs.parent=parent
 linkimcslist.htmltitle=LinksImcsList
 linkimcslist.search_in=Text suchen in
 
+
 # login
 login.htmltitle=login
 login.info=Dieser Bereich steht nur authorisierten Gruppen zur Verfügung. Wenn ihr aktuelle Nachrichten einspielen wollt, so koennt ihr als Redaktionsgruppe teilnehmen. Bitte meldet Euch bei der {0}.
@@ -182,152 +272,216 @@ login.language=Sprache
 login.submit=  OK
 
 # mediafolder
-mediafolder.htmltitle=mediafolder
-mediafolder.date=datum
-mediafolder.name=name
-mediafolder.location=ort
-mediafolder.keywords=stichworte
-mediafolder.comment=kommentar
+mediafolder.htmltitle=Mediafolder
+mediafolder.date=Datum
+mediafolder.name=Name
+mediafolder.location=Ort
+mediafolder.keywords=Stichworte
+mediafolder.comment=Kommentar
+
+mediafolderlist.htmltitle=Mediafolderlist
 
-mediafolderlist.htmltitle=mediafolderlist
 
 # message
-message.htmltitle=messages
-message.date=datum
-message.title=titel
-message.creator=autor
-message.text=text
-message.textinfo=(max. 5 zeilen / 250 zeichen)
-
-messagelist.htmltitle=message list
-
-# feature
-feature.htmltitle=feature
-feature.title=Titel
-feature.published=frei
-feature.is_published=freigeschaltet
-feature.is_not_published=nicht freigesch.
-feature.filename=Filename
-feature.abstract=Abstract
-feature.link=Link
-
-featurelist.htmltitle=featurelist
+message.htmltitle=Messages
+message.date=Datum 
+message.title=Titel
+message.creator=Autor
+message.text=Text
+message.textinfo=(max. 5 Zeilen / 250 Zeichen)
+
+messagelist.htmltitle=Messages Liste
 
 # admin start page
-start.htmltitle=admin
+start.htmltitle=Admin-Startpage
+
+start.breaking.new=neue breaking news
+start.content.new=neuer Artikel
+start.show=zeigen
+start.open_by_id=id &ouml;ffnen
+
+start.content.comments=Erg&auml;nzungen
+start.content.hidden=alle versteckten eines Monats
+start.content.not_published=(noch) nicht ver&ouml;ffentlicht
+start.content.with_media=mit Medien
+start.content.last_changes=letzte &Auml;nderungen
+start.content.with_comments=mit internen Kommentaren
+start.content.all=Alle Artikel
+start.content.search=suchen
+
+start.allarticlesoftype={0}
+
+start.producers.title=MANUELL GENERIEREN
+start.producers.produceAllNew=alle neuen generieren
+start.producers.advanced=extra Optionen (Vorsicht!)
+
 start.openpostings.title=OPENPOSTINGS
-start.comments.title=KOMMENTARE
-start.breaking.title=BREAKING NEWS
-start.breaking.new=neue nachricht
-start.content.title=BEITR&Auml;GE
-start.content.new=neue nachricht
-start.show=anzeigen
-start.content.newswire=newswire
-start.content.feature=feature
-start.content.topicspecial=themenspecials
-start.content.startspecial=startspecials
-start.content.not_published=nicht veröffentlichte nachrichten
-start.content.hidden=versteckte Artikel
-start.content.with_media=mit medien
-start.content.last_changes=letzte &auml;nderungen
-start.content.with_comments=mit internen kommentaren
-start.content.all=alle
-start.content.search=Suche
-
-start.allarticlesoftype=alle Artikel vom Typ {0}
-
-start.generate.title=MANUELL GENERIEREN
-start.generate.all.title=Alle Bereiche
-start.generate.all.new=alles neue (standard, update auf www > 5min.)
-start.generate.parts.title=Folgende sind Teilbereiche
-start.generate.startpages.new=neue startseiten
-start.generate.all_forced=alle (forced)
-start.generate.all_sync=alle (forced + sync)
-start.generate.content.new=neuer content
-start.generate.topics.new=neue themen
-start.generate.postings.new=neue openpostings
-start.generate.images.new=neue bilder
-start.generate.audio.new=neue audio dateien
-start.generate.video.new=neue video dateien
-start.generate.other.new=neue andere medien
-start.generate.navigation=Navigation
-start.coverage.title=SCHWERPUNKTEs
-start.topics.title=THEMEN
-start.images.title=BILDER
-start.audio.title=AUDIO
-start.video.title=VIDEO
-start.other_media.title=ANDERE MEDIEN
-start.mediafolder.title=MEDIAFOLDER
+start.comments.title=ERG&Auml;NZUNGEN
+start.breaking.title=breaking news
+start.content.title=ARTIKEL
+start.administer.title=AUFR&Auml;UMEN
+start.list.title=LIST
+start.fileedit.title=Includes editieren
+start.addandedit.title=NEU / &Auml;NDERN
+start.extra.title=EXTRA
+start.search.title=SUCHEN
+start.topics.title=TOPICS
+start.other_media.title=andere Medien
+start.images.title=Bilder
+start.video.title=Video
+start.audio.title=Audio
+start.media.title=MEDIA
+start.mediafolder.title=Media-Mappen
 start.languages.title=SPRACHEN
 start.imcs.title=IMCS
-start.messageboard.title=Internes Messageboard
-start.messageboard.no_messages=keine nachrichten
+start.messageboard.title=MESSAGEBOARD
+start.messageboard.no_messages=keine Nachrichten
 
-start.superusermenu=Superuser menu (use with care!) # needs translation\r
+start.superusermenu=Mehr Funktionen (Vorsicht!)
 
 
 # topic
-topic.htmltitle=topic
+topic.htmltitle=Themen
 topic.title=Name
-topic.description=beschreibung
-topic.filename=Filename
-topic.main_url=Hauptinfoseite
-topic.archive_url=Archiv url
+topic.description=Beschreibung
+topic.filename=Dateiname
+topic.main_url=Haupt Infoseite
+topic.archive_url=ArchivURL
+
+topiclist.htmltitle=Themenliste
 
-topiclist.htmltitle=topiclist
 
-articletype.htmltitle=Article type                              # needs translation
-articletype.id=id                                               # needs translation
-articletype.name=Name                                           # needs translation
+# users
+user.htmltitle=BenutzerInnen
+user.login=Login
+user.password=Password
+user.password2=Password (best&auml;tigen)
+user.admin=Admin
 
-articletypelist.htmltitle=Article types                         # needs translation
+userlist.htmltitle=BenutzerInnen
 
-commentstatus.htmltitle=Comment status                          # needs translation
-commentstatus.id=id                                             # needs translation
-commentstatus.name=Name                                         # needs translation
 
-commentstatuslist.htmltitle=Comment status values               # needs translation
+#articletype
+articletype.htmltitle=Artikeltyp
+articletype.id=id
+articletype.name=Name
 
+articletypelist.htmltitle=Artikeltyp Liste
 
-superusermenu.htmltitle = Super-user functions                  # needs translation\r
-superusermenu.topics = Manage topics                            # needs translation\r
-superusermenu.articletypes = Manage article types               # needs translation  \r
-superusermenu.comment_statuses = Manage comment status values   # needs translation\r
-superusermenu.users = Manage users                              # needs translation\r
-superusermenu.languages = Manage languages                      # needs translation \r
-superusermenu.imcs = Manage IMCS (obsolete)                     # needs translation\r
 
 
-# users
-user.htmltitle=user
-user.login=login
-user.password=password
-user.admin=admin
+#commentstatus
+commentstatus.htmltitle=Comment status
+commentstatus.id=id
+commentstatus.name=Name
+
+commentstatuslist.htmltitle=Comment status Werte
+
+
+
+#file editing
+fileedit.htmltitle = Datei bearbeiten
+fileedit.filename = Dateiname
+fileedit.subdirectory = Unterverzeichnis
+
+fileeditlist.htmltitle = editierbare Dateien
+fileeditlist.filename = Dateiname
+fileeditlist.dirname = Unterverzeichnis
+
+
+#producers
+producer.producer = Producer Name
+producer.verb.name = Task Name
+producer.verb.description = Task Beschreibung
+producer.verb.enqueue = produzieren
+
+producer.job.name = Job
+producer.job.status = Status
+producer.job.date = seit:
+producer.job.cancel = cancel
+producer.job.abort = abort
+producer.job.empty = Nix zu tun ;-)
+
+producer.jobqueue.title = Laufende Jobs
+producer.jobqueue.refresh = neu laden
+producer.producerlist.title = neuer Job
+
+producerqueue.htmltitle = manuell generieren
+
+
+#superusermenu
+superusermenu.htmltitle = Extra-Funktionen
+superusermenu.manage = BEARBEITEN
+superusermenu.topics = Topics
+superusermenu.articletypes =  Artikeltypen
+superusermenu.comment_statuses =  comment status Werte
+superusermenu.users =  BenutzerInnen
+superusermenu.languages =  Sprachen
+superusermenu.abuse = Spamabwehr
+superusermenu.imcs =  IMCS (nicht aktiv)
+
+
+#abuse
+abuse.htmltitle = Spam abwehr
+
+abuse.setting = Einstellungen 
+abuse.value = Werte
+
+abuse.disableopenpostings=Openposting abschalten
+abuse.openpostingpassword=Passwort f&uuml;r Openposting
+abuse.logpostings=IPs f&uuml;r Openposting listen
+abuse.logsize=wieviele IPs listen
+abuse.cookies=Cookies f&uuml;r geblockte Nutzer
+abuse.articleaction=Aktion f&uuml;r geblockte Artikel
+abuse.commentaction=Aktion f&uuml;r geblockte Erg&auml;nzungen
+
+abuse.showlog=IP-Liste zeigen
+abuse.showfilters=Filter bearbeiten
+
+abuse.log.time=Zeit
+abuse.log.address=IP-Nummer
+abuse.log.object=Objekt
+abuse.log.browser=Browser
+
+abuse.filters = Filter
+abuse.filter.type = Type
+abuse.filtertype.ip = IP Nummer
+abuse.filtertype.regexp = Regular expression
+abuse.filter.expression = Expression
 
-userlist.htmltitle=userlist
 
 # head
 head.start=start
 head.logout=logout
-head.help=hilfe
-head.search=suche
+head.help=help
+head.search=search
 head.logged_in=logged in
 
 # foot
 foot.top=top
 
 
-# article types
-articletypes.openposting=Open posting
+########## dynamic values ##########
+
+# (users can add new types, how to translate these)
+# suggestion if not in bundle use value as Text
+
+
+# Article types
+articletypes.openposting=open posting
 articletypes.newswire=Newswire
 articletypes.feature=Feature
-articletypes.topicspecial=Themen special
-articletypes.startspecial=Startpage special
+articletypes.topicspecial=Topic-Special
+articletypes.startspecial=Startpage-Special
 
+# Comment status values
+commentstatus.normal=normal
+commentstatus.good=gut
+commentstatus.bad=b&ouml;se
 
 
-########## error ##########
 
+########## error ##########
 error.htmltitle=das system ist der fehler
 error.title=OOPS!
 error.text=Nunja, kann passieren! Wahrscheinlich wird Dir der folgende Fehlertext nichts sagen, koennte aber sein, da&szlig; <a href="mailto:{0}">{1}</a>damit was anfangen kann:
@@ -338,6 +492,13 @@ usererror.title=OOPS!
 usererror.text=Bei der Eingabe hat es folgende fehler gegeben:
 usererror.what_to_do=Also, bitte druecke die zurueck taste und versuche es nochmal
 
+media.error.unsupportedformat=Das Format der hochgeladenen Mediendatei wird nicht unterst&uuml;tzt.
+user.error.missingpasswords=Das neue Passwort muss zwei mal eingegeben werden.
+user.error.passwordmismatch=Die Passwörterstimmen nicht überein.
+user.error.missingpassword=Bitte ein Passwort angebenn.
+
 
+########## infomessages ##########
+infomessage.htmltitle = zu Ihrer Information
+infomessage.produceAllNewAddedToQueue = Der Vorgang wird bearbeitet.
 
-htmlcharset=utf-8
index 9b35416..a64e2cf 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.41 2003/03/27 20:13:44 zapata Exp $
+# $Id: admin_en.properties,v 1.42 2003/04/09 02:06:06 zapata Exp $
 
 languagename=English
 
@@ -12,6 +12,10 @@ all=all
 month=month
 year=year
 file=file
+new=new
+by=by
+help=help
+
 
 # actions
 insert=insert
@@ -26,10 +30,14 @@ back=back
 cancel=cancel
 preview=preview
 reset=reset
+administer=administer
+search=search
+
 
 # special
 fileedit=fileEdit
 
+
 # records
 records=entries
 show_from_to=showing from {0} to {1}
@@ -37,6 +45,7 @@ no_matches_found=No matching entries!
 list.next=next
 list.previous=previous
 
+
 # media - used by image, audio, video and other media
 media.created=created
 media.changed=last modification
@@ -61,22 +70,27 @@ media.nr_of_media.submit=define number
 
 medialist.search_text_in=Search text in
 
+
 # image
 image.htmltitle=Image
-imagelist.htmltitle=Images
+imagelist.htmltitle=Images overview
+
 
 # audio
 audio.htmltitle=Audio
 audiolist.htmltitle=Audio overview
 
+
 # video
 video.htmltitle=Video
 videolist.htmltitle=Video overview
 
+
 # other
 other_media.htmltitle=Other media
 other_medialist.htmltitle=Other media overview
 
+
 # breaking
 breaking.htmltitle=Breaking news
 breaking.textinfo=(max. 5 lines / 250 characters)
@@ -85,6 +99,7 @@ breaking.date=date
 
 breakinglist.htmltitle=Breaking news overview
 
+
 # comment
 comment.htmltitle=Comment
 comment.date=Date
@@ -97,19 +112,27 @@ comment.email=Email
 comment.url=Url
 comment.creator=Author
 comment.article=For article
-comment.html=HTML?
+comment.html=HTML
 comment.status=Status 
 comment.language=Language
 
-comment.hidden=Hidden
+comment.operation.hide=hide
+comment.operation.unhide=unhide
 
-comment.operation.hide=Hide
-comment.operation.unhide=Unhide
 
-commentlist.htmltitle=Comments
-commentlist.allcomments=All comments
+#commentlist
+commentlist.htmltitle=comments
+commentlist.published=published
+commentlist.hidden=hidden
+commentlist.allcomments=All comments for this article
+commentlist.search=go!
+commentlist.activate = activate changes
+commentlist.order = order
+commentlist.order.datedesc= date (desc.)
+commentlist.order.dateasc= date (asc.)
+commentlist.order.articletitle= article title
 
-commentsearch.field = Field
+commentsearch.field = Search
 commentsearch.field.title = Title
 commentsearch.field.creator = Author
 commentsearch.field.description = Description
@@ -129,18 +152,18 @@ commentsearch.order.articletitle= article title
 commentsearch.searchbutton = Search
 
 
-
 # confirm
 confirm.htmltitle=confirm delete
 confirm.really_delete=Do you really want to delete this entry?
+confirm.text=This will erase the entry from the database unrecoverably.
+
 
 # content
-content.id=Article number
 content.htmltitle=Article
 content.owner=Owner
 content.language=Language
 content.articletype=Article type
-content.topic=Topics
+content.topic=Topic
 content.title=Long title
 content.subtitle=Sub title / context title
 content.location=Location
@@ -151,9 +174,10 @@ content.creator.address=Address
 content.creator.telephone=Phone
 content.abstract=Abstract
 content.content=Content
-content.html=HTML?
+content.html=HTML
 content.comment=Internal Comment
 content.internal=(internal)
+
 content.attachments=Attachments
 content.images=Images
 content.audio=Audio
@@ -168,6 +192,7 @@ content.addvideo=add video
 content.uploadvideo=upload video
 content.addother=add other media
 content.uploadother=upload other media
+
 content.creationdate=date
 content.modificationdate=last change
 content.status=Status
@@ -176,7 +201,7 @@ content.import_date=Import date
 content.lastchange_date=Last modified
 content.create_date=Date
 content.published=published
-content.comments=Comments
+content.comments=comments
 
 content.family=Children & Parents
 content.children=Children
@@ -186,12 +211,11 @@ content.viewparent=view
 content.clearparent=de-select
 content.selectparent=select
 
-content.operation.hide=Hide
-content.operation.unhide=Unhide
-content.operation.newswire=Newswire
-
+content.operation.hide=hide
+content.operation.unhide=unhide
+content.operation.newswire=newswire
 
-contentsearch.value = value
+contentsearch.value = search
 contentsearch.field = field
 contentsearch.field.title = Title
 contentsearch.field.creator = Author
@@ -208,9 +232,10 @@ contentsearch.order.datedesc=Newest first
 contentsearch.order.dateasc=Oldest first
 contentsearch.order.title=Title
 contentsearch.order.creator=Author
-
 contentsearch.searchbutton=Search
 
+
+#contentlist
 contentlist.htmltitle=Articles
 contentlist.comments=Comments
 contentlist.select=Select
@@ -223,6 +248,7 @@ language.code=Language code
 
 languagelist.htmltitle=Languages
 
+
 # imcs
 linkimcs.htmltitle=LinksImcs
 linkimcs.name=Name
@@ -236,6 +262,7 @@ linkimcs.parent=parent
 linkimcslist.htmltitle=LinksImcsList
 linkimcslist.search_in=Search text in
 
+
 # login
 login.htmltitle=login
 login.info=This area is only accessible to authorized groups. If you want to join as an editorial group, please contact us at the {0}.
@@ -245,6 +272,7 @@ login.password=Password
 login.language=Language
 login.submit=  OK
 
+
 # mediafolder
 mediafolder.htmltitle=mediafolder
 mediafolder.date=date
@@ -255,11 +283,12 @@ mediafolder.comment=comment
 
 mediafolderlist.htmltitle=media folder list
 
+
 # message
 message.htmltitle=messages
 message.date=date
 message.title=title
-message.creator=Author
+message.creator=author
 message.text=text
 message.textinfo=(max. 5 lines / 250 characters)
 
@@ -267,15 +296,14 @@ messagelist.htmltitle=message list
 
 # admin start page
 start.htmltitle=admin
-start.openpostings.title=OPENPOSTINGS
-start.comments.title=COMMENTS
-start.breaking.title=BREAKING NEWS
+
 start.breaking.new=add breaking news
-start.content.title=ARTICLES
 start.content.new=new article
 start.show=show
+start.open_by_id=open id
 
-start.content.hidden=hidden articles
+start.content.comments=comments
+start.content.hidden=produce all hidden articles
 start.content.not_published=not (yet) published articles
 start.content.with_media=with media
 start.content.last_changes=latest changes
@@ -283,42 +311,48 @@ start.content.with_comments=with internal comments
 start.content.all=all articles
 start.content.search=search
 
-start.allarticlesoftype=View all "{0}" articles
-
+start.allarticlesoftype={0}
 
 start.producers.title=GENERATE MANUALLY
-start.producers.produceAllNew=Generate all new
-start.producers.advanced=Advanced page (use with care!)
-
-
-
+start.producers.produceAllNew=generate all new
+start.producers.advanced=advanced page (use with care!)
 
+start.openpostings.title=OPENPOSTINGS
+start.comments.title=COMMENTS
+start.breaking.title=breaking news
+start.content.title=ARTICLES
+start.administer.title=ADMINISTER
+start.list.title=LIST
+start.fileedit.title=edit include files
+start.addandedit.title=ADD / EDIT
+start.extra.title=EXTRA
+start.search.title=SEARCH
 start.topics.title=TOPICS
-start.other_media.title=OTHER MEDIA
-start.images.title=PICTURES
-start.video.title=VIDEO
-start.audio.title=AUDIO
-start.mediafolder.title=MEDIAFOLDER
+start.other_media.title=other media
+start.images.title=pictures
+start.video.title=video
+start.audio.title=audio
+start.media.title=MEDIA
+start.mediafolder.title=mediafolder
 start.languages.title=LANGUAGES
 start.imcs.title=IMCS
-start.messageboard.title=Internal Messageboard
+start.messageboard.title=MESSAGEBOARD
 start.messageboard.no_messages=no messages
 
-start.superusermenu=Super-user functions (use with care!)
+start.superusermenu=super-user functions (use with care!)
 
-start.editfiles.title=EDIT FILES
-start.editfiles.include=Include files
 
 # topic
 topic.htmltitle=topic
-topic.title=Name
+topic.title=name
 topic.description=description
-topic.filename=Filename
+topic.filename=filename
 topic.main_url=main infopage
-topic.archive_url=Archive url
+topic.archive_url=archive url
 
 topiclist.htmltitle=topiclist
 
+
 # users
 user.htmltitle=User
 user.login=Login
@@ -329,12 +363,16 @@ user.admin=Admin
 userlist.htmltitle=Users
 
 
+#articletype
 articletype.htmltitle=Article type
 articletype.id=id
 articletype.name=Name
 
 articletypelist.htmltitle=Article types
 
+
+
+#commentstatus
 commentstatus.htmltitle=Comment status
 commentstatus.id=id
 commentstatus.name=Name
@@ -342,11 +380,15 @@ commentstatus.name=Name
 commentstatuslist.htmltitle=Comment status values
 
 
+
 #file editing
+fileedit.htmltitle = Edit file
+fileedit.filename = Filename
+fileedit.subdirectory = Subdirectory
+
 fileeditlist.htmltitle = Editable files
 fileeditlist.filename = Filename
-fileedit.filename = Filename
-fileedit.htmltitle = Edit file
+fileeditlist.dirname = Subdirectory
 
 
 #producers
@@ -360,6 +402,7 @@ producer.job.status = Status
 producer.job.date = Last change
 producer.job.cancel = cancel
 producer.job.abort = abort
+producer.job.empty = Queue is empty
 
 producer.jobqueue.title = Current jobs
 producer.jobqueue.refresh = refresh
@@ -368,15 +411,20 @@ producer.producerlist.title = Add a new job
 producerqueue.htmltitle = Generate manually
 
 
-superusermenu.htmltitle = Super-user functions\r
-superusermenu.topics = Manage topics\r
-superusermenu.articletypes = Manage article types\r
-superusermenu.comment_statuses = Manage comment status values\r
-superusermenu.users = Manage users\r
-superusermenu.languages = Manage languages
-superusermenu.abuse = Apply anti-abuse measures\r
-superusermenu.imcs = Manage IMCS (obsolete)
+#superusermenu
+superusermenu.htmltitle = Super-user functions
+superusermenu.manage = MANAGE
+superusermenu.topics = topics
+superusermenu.articletypes =  article types
+superusermenu.comment_statuses =  comment status values
+superusermenu.users =  users
+superusermenu.languages =  languages
+superusermenu.abuse = apply anti-abuse measures
+superusermenu.imcs =  IMCS (obsolete)
+
 
+#abuse
+abuse.htmltitle = anti-abuse measures
 
 abuse.setting = Setting
 abuse.value = Value
@@ -404,7 +452,6 @@ abuse.filtertype.regexp = Regular expression
 abuse.filter.expression = Expression
 
 
-
 # head
 head.start=start
 head.logout=logout
@@ -416,6 +463,12 @@ head.logged_in=logged in
 foot.top=top
 
 
+########## dynamic values ##########
+
+# (users can add new types, how to translate these)
+# suggestion if not in bundle use value as Text
+
+
 # Article types
 articletypes.openposting=Open posting
 articletypes.newswire=Newswire
@@ -424,29 +477,32 @@ articletypes.topicspecial=Topic-special
 articletypes.startspecial=Startpage-special
 
 # Comment status values
-commentstatus.normal=Normal
-
+commentstatus.normal=normal
+commentstatus.good=good
+commentstatus.bad=bad
 
 
 
 ########## error ##########
-
 error.htmltitle=the system caused an error
 error.title=The system caused an error
-error.text=This can happen. Even if the following error message is not be comprehensible for you, it might be helpful to <a href="mailto:{0}">{1}</a>:
+error.text=This can happen. Even if the following error message is not be comprehensible for you, <br>it might be helpful to <a href="mailto:{0}">{1}</a>:
 error.text2=So please send an e-mail with the <font color="Red">red text</font> and detailed information regarding the events that led to this error to <a href="mailto:{0}">{1}</a>. Thanks!
 
-usererror.htmltitle=User error
-usererror.title=User error
+usererror.htmltitle=validation error
+usererror.title=Validation error
 usererror.text=Your input caused the following error:
 usererror.what_to_do=Please press the back button and try it again
 
-media.error.unsupportedformat=The format of the media you uploaded is not supported\r
-user.error.missingpasswords=The new password must be entered twice\r
+media.error.unsupportedformat=The format of the media you uploaded is not supported
+user.error.missingpasswords=The new password must be entered twice
 user.error.passwordmismatch=The passwords are not equal
-user.error.missingpassword=A password must be entered\r
+user.error.missingpassword=A password must be entered
+
 
+########## infomessages ##########
 infomessage.htmltitle = Information
 infomessage.produceAllNewAddedToQueue = Your request has been added to the queue.
 
+########## HTML-charset ##########
 htmlcharset=utf-8
index a813d5f..f5a0cfd 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: espanol / spanish
-# $Id: admin_es.properties,v 1.22 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_es.properties,v 1.23 2003/04/09 02:06:06 zapata Exp $
 
 languagename=Español
 
@@ -142,9 +142,9 @@ content.status=Estado
 content.type=Tipo de artículo
 content.published=publicado
 content.comments=Comentarios
-content.import_date=fecha de importación\r
-content.lastchange_date=último cambio\r
-content.create_date=fecha\r
+content.import_date=fecha de importación
+content.lastchange_date=último cambio
+content.create_date=fecha
 
 contentlist.htmltitle=lista de contenidos
 contentlist.comments=comentarios
@@ -371,4 +371,3 @@ usererror.text=Los datos que ha introducido han causado el siguiente error:
 usererror.what_to_do=Por favor, pulse el botón para volver e intentelo de nuevo
 
 
-htmlcharset=utf-8
index ba67237..7df359d 100755 (executable)
 ########## admin ##########
 # language: euskera / basque
-# $Id: admin_eu.properties,v 1.8 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_eu.properties,v 1.9 2003/04/09 02:06:06 zapata Exp $
 
-languagename=Euskera
+languagename = Euskera
 
 # general
-yes=bai
-no=ez
-dontcare=ez du axola
-all=dena
+yes = bai
+no = ez
+dontcare = ez du axola
+all = dena
+# missing (master value = "month")
+month = 
+# missing (master value = "year")
+year = 
+# missing (master value = "file")
+file = 
+# missing (master value = "new")
+new = 
+# missing (master value = "by")
+by = 
+# missing (master value = "help")
+help = 
+
 
 # actions
-insert=sartu
-save=gorde
-edit=aldatu
-delete=ezabatu
-add=gehitu
-filter=iragazi
-attach=atxeki
-list=zerrenda erakutsi
-back=atzera
-cancel=utzi
-preview=aurrebista
-reset=berrasieratu
+insert = sartu
+save = gorde
+edit = aldatu
+delete = ezabatu
+add = gehitu
+filter = iragazi
+attach = atxeki
+list = zerrenda erakutsi
+back = atzera
+cancel = utzi
+preview = aurrebista
+reset = berrasieratu
+# missing (master value = "administer")
+administer = 
+# missing (master value = "search")
+search = 
+
+
+# special
+# missing (master value = "fileEdit")
+fileedit = 
+
 
 # records
-records=sarrerak
-show_from_to={0}(e)tik {1}(e)ra bitarteko sarrerak erakusten
-no_matches_found=Ez da horrelako sarrerarik aurkitu!
-list.next=hurrengoa
-list.previous=aurrekoa
+records = sarrerak
+show_from_to = {0}(e)tik {1}(e)ra bitarteko sarrerak erakusten
+no_matches_found = Ez da horrelako sarrerarik aurkitu!
+list.next = hurrengoa
+list.previous = aurrekoa
+
 
 # media - used by image, audio, video and other media
-media.created=sortua
-media.changed=aldatua
-media.published=argitaratua
-media.format=Formatua
-media.rights=Egile eskubideak
-media.type=Mota
-media.mediafolder=Baliabide mediatikoen karpeta
-media.title=Izenburua
-media.size=Tamaina
-media.description=Deskripzioa
-media.date=Data
-media.location=Jatorrizko lekua
-media.creator=Egilea
-media.keywords=Hitz gakoak
-media.comment=Komentarioa
-media.source=Jatorria
-media.is_published=Argitaratzeko prest
-media.icon=Ikonoa
-medialist.search_text_in=Testua non bilatu
-media.nr_of_media=Baliabide mediatikoen kopurua
-media.nr_of_media.submit=Aldatu kopurua
+media.created = sortua
+media.changed = aldatua
+media.published = argitaratua
+media.format = Formatua
+media.rights = Egile eskubideak
+media.type = Mota
+media.mediafolder = Baliabide mediatikoen karpeta
+media.title = Izenburua
+media.size = Tamaina
+media.description = Deskripzioa
+media.date = Data
+media.location = Jatorrizko lekua
+media.creator = Egilea
+media.keywords = Hitz gakoak
+media.comment = Komentarioa
+media.source = Jatorria
+media.is_published = Argitaratzeko prest
+media.icon = Ikonoa
+media.nr_of_media = Baliabide mediatikoen kopurua
+media.nr_of_media.submit = Aldatu kopurua
+
+medialist.search_text_in = Testua non bilatu
+
 
 # image
-image.htmltitle=Indymedia Euskal Herria | Irudia
-imagelist.htmltitle=Indymedia Euskal Herria | Irudien zerrenda
+image.htmltitle = Irudia
+imagelist.htmltitle = Irudien zerrenda
+
 
 # audio
-audio.htmltitle=Indymedia Euskal Herria | Audioa
-audiolist.htmltitle=Indymedia Euskal Herria | Audio zerrenda
+audio.htmltitle = Audioa
+audiolist.htmltitle = Audio zerrenda
+
 
 # video
-video.htmltitle=Indymedia Euskal Herria | Bideoa
-videolist.htmltitle=Indymedia Euskal Herria | Bideo zerrenda
+video.htmltitle = Bideoa
+videolist.htmltitle = Bideo zerrenda
+
 
 # other
-other_media.htmltitle=Indymedia Euskal Herria | Beste baliabide mediatikoak
-other_media.htmltitle=Indymedia Euskal Herria | Baliabide mediatikoen zerrenda
+other_media.htmltitle = Baliabide mediatikoen zerrenda
+# missing (master value = "Other media overview")
+other_medialist.htmltitle = 
+
 
 # breaking
-breaking.htmltitle=Indymedia Euskal Herria | Azken albisteak
-breakinglist.htmltitle=Indymedia Euskal Herria | Azken albisteen zerrenda
-breaking.textinfo=(gehienez 5 lerrro / 250 letra)
-breaking.text=testua
-breaking.date=data
+breaking.htmltitle = Azken albisteak
+breaking.textinfo = (gehienez 5 lerrro / 250 letra)
+breaking.text = testua
+breaking.date = data
+
+breakinglist.htmltitle = Azken albisteen zerrenda
+
 
 # comment
-comment.htmltitle=Indymedia Euskal Herria | Komentarioa
-comment.date=data
-comment.title=izenburua
-comment.published=argitaratuta
-comment.text=komentarioaren testua
-comment.address=helbidea
-comment.phone=telefonoa
-comment.email=posta elektronikoa
-comment.url=URL
-comment.creator=egilea
-comment.article=hurrengo artikuluarena
-comment.html=HTML da?
-comment.status=Egoera
-comment.language=Hizkuntza
-
-commentlist.htmltitle=Indymedia Euskal Herria | Komentarioen zerrenda
-commentlist.produced=ekoiztua
-commentlist.hidden=izkutua
-commentlist.search=bilatu!
-
-commentsearch.order.datedesc= data (behera)
-commentsearch.order.dateasc= data (gora)
-commentsearch.order.articletitle= artikuluaren titulua
+comment.htmltitle = Komentarioa
+comment.date = data
+comment.title = izenburua
+comment.published = argitaratuta
+comment.text = komentarioaren testua
+comment.address = helbidea
+comment.phone = telefonoa
+comment.email = posta elektronikoa
+comment.url = URL
+comment.creator = egilea
+comment.article = hurrengo artikuluarena
+comment.html = HTML da?
+comment.status = Egoera
+comment.language = Hizkuntza
+
+# missing (master value = "hide")
+comment.operation.hide = 
+# missing (master value = "unhide")
+comment.operation.unhide = 
+
+
+#commentlist
+commentlist.htmltitle = Komentarioen zerrenda
+# missing (master value = "published")
+commentlist.published = 
+commentlist.hidden = izkutua
+# missing (master value = "All comments for this article")
+commentlist.allcomments = 
+commentlist.search = bilatu!
+# missing (master value = "activate changes")
+commentlist.activate = 
+# missing (master value = "order")
+commentlist.order = 
+# missing (master value = "date (desc.)")
+commentlist.order.datedesc = 
+# missing (master value = "date (asc.)")
+commentlist.order.dateasc = 
+# missing (master value = "article title")
+commentlist.order.articletitle = 
+
+# missing (master value = "Search")
+commentsearch.field = 
+# missing (master value = "Title")
+commentsearch.field.title = 
+# missing (master value = "Author")
+commentsearch.field.creator = 
+# missing (master value = "Description")
+commentsearch.field.description = 
+# missing (master value = "Value")
+commentsearch.value = 
+
+# missing (master value = "Published state")
+commentsearch.publishedstate = 
+# missing (master value = "Hidden")
+commentsearch.publishedstate.hidden = 
+# missing (master value = "Published")
+commentsearch.publishedstate.published = 
+
+# missing (master value = "Status")
+commentsearch.status = 
+
+# missing (master value = "Order")
+commentsearch.order = 
+commentsearch.order.datedesc = data (behera)
+commentsearch.order.dateasc = data (gora)
+commentsearch.order.articletitle = artikuluaren titulua
+
+# missing (master value = "Search")
+commentsearch.searchbutton = 
+
 
 # confirm
-confirm.htmltitle=Indymedia Euskal Herria | Ezabaketa baieztatu
-confirm.really_delete=Sarrera hau ezabatu nahi duzu?
+confirm.htmltitle = Ezabaketa baieztatu
+confirm.really_delete = Sarrera hau ezabatu nahi duzu?
+# missing (master value = "This will erase the entry from the database unrecoverably.")
+confirm.text = 
+
 
 # content
-content.htmltitle=Indymedia Euskal Herria | Edukia
-content.owner=Jabea
-content.topic=Gaia
-content.feature=Berezitasuna
-content.title=Izenburu luzea
-content.subtitle=Azpi-izenburua/testuinguru izenburua
-content.location=Jatorrizko lekua
-content.creator=Egilea
-content.creator.email=Posta elektronikoa
-content.creator.url=Web
-content.creator.address=Helbidea
-content.creator.telephone=Telefonoa
-content.abstract=Deskripzio laburra
-content.content=Edukia
-content.html=HTML da?
-content.comment=Barne komentarioa
-content.internal=(barne xederako)
-content.attachments=Atxekiak
-content.images=Irudiak
-content.audio=Audioa
-content.video=Bideoa
-content.other=Beste baliabide mediatikoak
-content.media=Baliabide mediatikoak
-content.addimage=irudia gehitu
-content.addaudio=audio gehitu
-content.addvideo=bideoa gehitu
-content.addother=beste baliabide mediatikoa gehitu
-content.creationdate=data
-content.modificationdate=azken aldaketa
-content.status=Egoera
-content.type=Artikulu mota
-content.published=argitaratua
-content.comments=Komentarioak
-
-content.import_date=sarreraren data\r
-content.lastchange_date=azken aldaketa\r
-content.create_date=data\r
-
-contentlist.htmltitle=Indymedia Euskal Herria | Edukien zerrenda
-contentlist.comments=komentarioak
+content.htmltitle = Edukia
+content.owner = Jabea
+# missing (master value = "Language")
+content.language = 
+# missing (master value = "Article type")
+content.articletype = 
+content.topic = Gaia
+content.title = Izenburu luzea
+content.subtitle = Azpi-izenburua/testuinguru izenburua
+content.location = Jatorrizko lekua
+content.creator = Egilea
+content.creator.email = Posta elektronikoa
+content.creator.url = Web
+content.creator.address = Helbidea
+content.creator.telephone = Telefonoa
+content.abstract = Deskripzio laburra
+content.content = Edukia
+content.html = HTML da?
+content.comment = Barne komentarioa
+content.internal = (barne xederako)
+
+content.attachments = Atxekiak
+content.images = Irudiak
+content.audio = Audioa
+content.video = Bideoa
+content.other = Beste baliabide mediatikoak
+content.media = Baliabide mediatikoak
+content.addimage = irudia gehitu
+# missing (master value = "upload image")
+content.uploadimage = 
+content.addaudio = audio gehitu
+# missing (master value = "upload audio")
+content.uploadaudio = 
+content.addvideo = bideoa gehitu
+# missing (master value = "upload video")
+content.uploadvideo = 
+content.addother = beste baliabide mediatikoa gehitu
+# missing (master value = "upload other media")
+content.uploadother = 
+
+content.creationdate = data
+content.modificationdate = azken aldaketa
+content.status = Egoera
+content.type = Artikulu mota
+content.import_date = sarreraren data
+content.lastchange_date = azken aldaketa
+content.create_date = data
+content.published = argitaratua
+content.comments = Komentarioak
+
+# missing (master value = "Children & Parents")
+content.family = 
+# missing (master value = "Children")
+content.children = 
+# missing (master value = "view")
+content.viewchildren = 
+# missing (master value = "Parent")
+content.parent = 
+# missing (master value = "view")
+content.viewparent = 
+# missing (master value = "de-select")
+content.clearparent = 
+# missing (master value = "select")
+content.selectparent = 
+
+# missing (master value = "hide")
+content.operation.hide = 
+# missing (master value = "unhide")
+content.operation.unhide = 
+# missing (master value = "newswire")
+content.operation.newswire = 
+
+# missing (master value = "search")
+contentsearch.value = 
+# missing (master value = "field")
+contentsearch.field = 
+# missing (master value = "Title")
+contentsearch.field.title = 
+# missing (master value = "Author")
+contentsearch.field.creator = 
+# missing (master value = "Contents")
+contentsearch.field.contents = 
+
+# missing (master value = "publication state")
+contentsearch.publishedstate = 
+# missing (master value = "hidden")
+contentsearch.publishedstate.hidden = 
+# missing (master value = "published")
+contentsearch.publishedstate.published = 
+
+# missing (master value = "article type")
+contentsearch.articletype = 
+
+# missing (master value = "order by")
+contentsearch.order = 
+# missing (master value = "Newest first")
+contentsearch.order.datedesc = 
+# missing (master value = "Oldest first")
+contentsearch.order.dateasc = 
+# missing (master value = "Title")
+contentsearch.order.title = 
+# missing (master value = "Author")
+contentsearch.order.creator = 
+# missing (master value = "Search")
+contentsearch.searchbutton = 
+
+
+#contentlist
+contentlist.htmltitle = Edukien zerrenda
+contentlist.comments = komentarioak
+# missing (master value = "Select")
+contentlist.select = 
+
 
 # language
-language.htmltitle=Indymedia Euskal Herria | Hizkuntza
-language.name=hizkuntza
-language.code=Hizkuntza kodea
+language.htmltitle = Hizkuntza
+language.name = hizkuntza
+language.code = Hizkuntza kodea
+
+languagelist.htmltitle = Hizkuntzen zerrenda
 
-languagelist.htmltitle=Indymedia Euskal Herria | Hizkuntzen zerrenda
 
 # imcs
-linkimcs.htmltitle=Indymedia Euskal Herria | MIGen loturak
-linkimcs.name=Izena
-linkimcs.continent=Kontinentea
-linkimcs.new_parent=Aita berria
-linkimcs.url=URL
-linkimcs.sort_by=Hurrenkera irizpidea
-linkimcs.language=Hizkuntza
-linkimcs.parent=Aita
-
-linkimcslist.htmltitle=Indymedia Euskal Herria | MIGen loturen zerrenda
-linkimcslist.search_in=Testua non bilatu
+linkimcs.htmltitle = MIGen loturak
+linkimcs.name = Izena
+linkimcs.continent = Kontinentea
+linkimcs.new_parent = Aita berria
+linkimcs.url = URL
+linkimcs.sort_by = Hurrenkera irizpidea
+linkimcs.language = Hizkuntza
+linkimcs.parent = Aita
+
+linkimcslist.htmltitle = MIGen loturen zerrenda
+linkimcslist.search_in = Testua non bilatu
+
 
 # login
-login.htmltitle=Indymedia Euskal Herria | Sarrera
-login.info=Eremu hau baimendutako taldeentzat bakarrik da. Editore lanetan lagundu nahi baduzu, jar zaitez gurekin kontaktuan <a href="mailto:imc-euskalherria-editorial@lists.indymedia.org">imceuskalherria-editorial@lists.indymedia.org</a> helbidean mesedez.
-login.title=erabiltzailea
-login.name=Erabiltzailea
-login.password=Pasahitza
-login.language=Hizkuntza
-login.language.ay=Aymara
-login.language.de=Deutsch
-login.language.en=English
-login.language.es=Español
-login.language.eu=Euskera
-login.language.gn=Guaran\92
-login.language.qu=Quechua
-login.language.tr=Turkish
-login.submit=Ados
+login.htmltitle = Sarrera
+login.info = Eremu hau baimendutako taldeentzat bakarrik da. Editore lanetan lagundu nahi baduzu, jar zaitez gurekin kontaktuan <a href="mailto:imc-euskalherria-editorial@lists.indymedia.org">imceuskalherria-editorial@lists.indymedia.org</a> helbidean mesedez.
+login.title = erabiltzailea
+login.name = Erabiltzailea
+login.password = Pasahitza
+login.language = Hizkuntza
+login.submit = Ados
+
 
 # mediafolder
-mediafolder.htmltitle=Indymedia Euskal Herria | Baliabide mediatikoen karpeta
-mediafolder.date=data
-mediafolder.name=izena
-mediafolder.location=jatorrizko lekua
-mediafolder.keywords=hitz gakoak
-mediafolder.comment=komentarioa
+mediafolder.htmltitle = Baliabide mediatikoen karpeta
+mediafolder.date = data
+mediafolder.name = izena
+mediafolder.location = jatorrizko lekua
+mediafolder.keywords = hitz gakoak
+mediafolder.comment = komentarioa
+
+mediafolderlist.htmltitle = Baliabide mediatikoen karpeten zerrenda
 
-mediafolderlist.htmltitle=Indymedia Euskal Herria | Baliabide mediatikoen karpeten zerrenda
 
 # message
-message.htmltitle=Indymedia Euskal Herria | Mezuak
-message.date=data
-message.title=izenburua
-message.creator=Egilea
-message.text=testua
-message.textinfo=(gehienez 5 lerrro / 250 letra)
-
-messagelist.htmltitle=Indymedia Euskal Herria | Mezuen zerrenda
-
-# feature
-feature.htmltitle=Indymedia Euskal Herria | Lehen-orrikoak
-feature.title=Izenburua
-feature.published=argitaratua
-feature.is_published=argitaratua dago
-feature.is_not_published=argitaratu gabe dago
-feature.filename=Fitxategiaren izena
-feature.abstract=Deskripzio laburra
-feature.link=lotura
-
-featurelist.htmltitle=Indymedia Euskal Herria | Lehen-orrikoen zerrenda
+message.htmltitle = Mezuak
+message.date = data
+message.title = izenburua
+message.creator = Egilea
+message.text = testua
+message.textinfo = (gehienez 5 lerrro / 250 letra)
+
+messagelist.htmltitle = Mezuen zerrenda
 
 # admin start page
-start.htmltitle=Indymedia Euskal Herria | Administrazioa
-start.openpostings.title=BIDALKETA IREKIAK
-start.comments.title=KOMENTARIOAK
-start.breaking.title=AZKEN ALBISTRAK
-start.breaking.new=azken albiste berriak
-start.content.title=ARTIKULUAK
-start.content.new=artikulu berriak
-start.show=Erakutsi
-start.content.newswire=newswire
-start.content.feature=lehen-orrikoak
-start.content.topicspecial=bereziak gaika
-start.content.startspecial=lehen-orriko bereziak
-start.content.not_published=argitaratzeke dauden artikuluak
-start.content.with_media=baliabide mediatikoekin
-start.content.last_changes=azken aldaketak
-start.content.with_comments=barne xederako komentarioekin
-start.content.search=bilatu
-
-start.producers.title=Euskuz ekoiztu
-start.producers.produceAllNew=Dena berria ekoiztu
-start.producers.advanced=Aukera arreratuak (kontuz honekin!)
-
-start.coverage.title=ESTALDURA
-start.topics.title=GAIAK
-start.images.title=IRUDIAK
-start.audio.title=AUDIO FITXATEGIAK
-start.video.title=BIDEO FITXATEGIAK
-start.other_media.title=BESTE MEDIOEN FITXATEGIAK
-start.mediafolder.title=BALIABIDE MEDIATIKOEN ZERRENDA
-start.languages.title=IZENBURUA
-start.imcs.title=MIGak
-start.messageboard.title=Barneko mezuak
-start.messageboard.no_messages=ez dago mezurik
-
-start.content.hidden=aritukulu ezkutukoak
-start.content.all=Artikulu guztiak
-
-start.editfiles.title=Fitxategiak aldatu
-start.editfiles.include=Fitxategiak sartu
-
-start.superusermenu=Aukera aurreratuak (kontuz honekin!)
-
-start.allarticlesoftype={0} motatako artikulu guztiak
-
-
-# article types
-articletypes.feature=azalakoa
-articletypes.newswire=newswire
-articletypes.openposting=bidalitako mezu ireki bat
-articletypes.topicspecial=gaiaz berezia
-articletypes.startspecial=berezia
+start.htmltitle = Administrazioa
+
+start.breaking.new = azken albiste berriak
+start.content.new = artikulu berriak
+start.show = Erakutsi
+# missing (master value = "open id")
+start.open_by_id = 
+
+# missing (master value = "comments")
+start.content.comments = 
+start.content.hidden = aritukulu ezkutukoak
+start.content.not_published = argitaratzeke dauden artikuluak
+start.content.with_media = baliabide mediatikoekin
+start.content.last_changes = azken aldaketak
+start.content.with_comments = barne xederako komentarioekin
+start.content.all = Artikulu guztiak
+start.content.search = bilatu
+
+start.allarticlesoftype = {0} motatako artikulu guztiak
+
+start.producers.title = Euskuz ekoiztu
+start.producers.produceAllNew = Dena berria ekoiztu
+start.producers.advanced = Aukera arreratuak (kontuz honekin!)
+
+start.openpostings.title = BIDALKETA IREKIAK
+start.comments.title = KOMENTARIOAK
+start.breaking.title = AZKEN ALBISTRAK
+start.content.title = ARTIKULUAK
+# missing (master value = "ADMINISTER")
+start.administer.title = 
+# missing (master value = "LIST")
+start.list.title = 
+# missing (master value = "edit include files")
+start.fileedit.title = 
+# missing (master value = "ADD / EDIT")
+start.addandedit.title = 
+# missing (master value = "EXTRA")
+start.extra.title = 
+# missing (master value = "SEARCH")
+start.search.title = 
+start.topics.title = GAIAK
+start.other_media.title = BESTE MEDIOEN FITXATEGIAK
+start.images.title = IRUDIAK
+start.video.title = BIDEO FITXATEGIAK
+start.audio.title = AUDIO FITXATEGIAK
+# missing (master value = "MEDIA")
+start.media.title = 
+start.mediafolder.title = BALIABIDE MEDIATIKOEN ZERRENDA
+start.languages.title = IZENBURUA
+start.imcs.title = MIGak
+start.messageboard.title = Barneko mezuak
+start.messageboard.no_messages = ez dago mezurik
+
+start.superusermenu = Aukera aurreratuak (kontuz honekin!)
+
 
 # topic
-topic.htmltitle=Indymedia Euskal Herria | Gaia
-topic.title=Izena
-topic.description=deskripzioa
-topic.filename=Fitxategiaren izena
-topic.main_url=Informazio nagusiko orria
-topic.archive_url=Fitxategiaren URLa
+topic.htmltitle = Gaia
+topic.title = Izena
+topic.description = deskripzioa
+topic.filename = Fitxategiaren izena
+topic.main_url = Informazio nagusiko orria
+topic.archive_url = Fitxategiaren URLa
 
-topiclist.htmltitle=Indymedia Euskal Herria | Gaien zerrenda
+topiclist.htmltitle = Gaien zerrenda
 
-articletype.htmltitle=Indymedia Euskal Herria | Artikuluen motak
-articletype.id=ID
-articletype.name=Izena
 
-articletypelist.htmltitle=Indymedia Euskal Herria | Artikuluen mota zerrenda
+# users
+user.htmltitle = Erabiltzailea
+user.login = erabiltzailea
+user.password = pasahitza
+# missing (master value = "Password (confirmation)")
+user.password2 = 
+user.admin = administratzailea
 
-commentstatus.htmltitle=Indymedia Euskal Herria | Komentarioen egoera
-commentstatus.id=ID
-commentstatus.name=Izena
+userlist.htmltitle = Erabiltzaileen zerrenda
 
-commentstatuslist.htmltitle=Indymedia Euskal Herria | Komentarioen egoeraren zerrenda
 
+#articletype
+articletype.htmltitle = Artikuluen motak
+articletype.id = ID
+articletype.name = Izena
 
-# users
-user.htmltitle=Indymedia Euskal Herria | Erabiltzailea
-user.login=erabiltzailea
-user.password=pasahitza
-user.admin=administratzailea
+articletypelist.htmltitle = Artikuluen mota zerrenda
+
+
+
+#commentstatus
+commentstatus.htmltitle = Komentarioen egoera
+commentstatus.id = ID
+commentstatus.name = Izena
+
+commentstatuslist.htmltitle = Komentarioen egoeraren zerrenda
+
+
+
+#file editing
+fileedit.htmltitle = Fitxategia aldatu
+fileedit.filename = Fitxategiaren izena
+# missing (master value = "Subdirectory")
+fileedit.subdirectory = 
+
+fileeditlist.htmltitle = Fitxategien aldaketak
+fileeditlist.filename = Fitxategiaren izena
+# missing (master value = "Subdirectory")
+fileeditlist.dirname = 
 
-userlist.htmltitle=Indymedia Euskal Herria | Erabiltzaileen zerrenda
 
 #producers
 producer.producer = Ekoizlearen izena
@@ -312,6 +477,8 @@ producer.job.status = Egoera
 producer.job.date = azken aldaketa
 producer.job.cancel = ezeztatu
 producer.job.abort = utzi
+# missing (master value = "Queue is empty")
+producer.job.empty = 
 
 producer.jobqueue.title = Oraingo lanak
 producer.jobqueue.refresh = birkargatu
@@ -319,51 +486,128 @@ producer.producerlist.title = Lan berri bat gehitu
 
 producerqueue.htmltitle = Eskuz ekoiztu
 
-infomessage.produceAllNewAddedToQueue=Lana zerrendan sartuta
-infomessage.htmltitle=Oharra
-
 
-superusermenu.htmltitle = Indymedia Euskal Herria | Aukera aurreratuak
+#superusermenu
+superusermenu.htmltitle = Aukera aurreratuak
+# missing (master value = "MANAGE")
+superusermenu.manage = 
 superusermenu.topics = Gaien kudeaketa
 superusermenu.articletypes = Artiukuluen moten kudeaketa
 superusermenu.comment_statuses = Komentarioen egoeraren kudeaketa
 superusermenu.users = Erabiltzailen kudeaketa
 superusermenu.languages = Hizkuntzen kudeaketa
+# missing (master value = "apply anti-abuse measures")
+superusermenu.abuse = 
 superusermenu.imcs = MIGen zerrendaren kudeaketa (zaharkitua)
 
 
-#file editing
-fileeditlist.htmltitle = Indymedia Euskal Herria | Fitxategien aldaketak
-fileeditlist.filename = Fitxategiaren izena
-fileedit.filename = Fitxategiaren izena
-fileedit.htmltitle = Fitxategia aldatu
-
+#abuse
+# missing (master value = "anti-abuse measures")
+abuse.htmltitle = 
+
+# missing (master value = "Setting")
+abuse.setting = 
+# missing (master value = "Value")
+abuse.value = 
+
+# missing (master value = "Turn off open posting")
+abuse.disableopenpostings = 
+# missing (master value = "Require a password for open postings")
+abuse.openpostingpassword = 
+# missing (master value = "Log IPs for open postings")
+abuse.logpostings = 
+# missing (master value = "Logging buffer size")
+abuse.logsize = 
+# missing (master value = "Use cookies for blocked users")
+abuse.cookies = 
+# missing (master value = "Action for blocked article")
+abuse.articleaction = 
+# missing (master value = "Action for blocked comment")
+abuse.commentaction = 
+
+# missing (master value = "Show the IP log")
+abuse.showlog = 
+# missing (master value = "Manage filters")
+abuse.showfilters = 
+
+# missing (master value = "Time")
+abuse.log.time = 
+# missing (master value = "IP number")
+abuse.log.address = 
+# missing (master value = "Object")
+abuse.log.object = 
+# missing (master value = "Browser")
+abuse.log.browser = 
+
+# missing (master value = "Filters")
+abuse.filters = 
+# missing (master value = "Type")
+abuse.filter.type = 
+# missing (master value = "IP Number")
+abuse.filtertype.ip = 
+# missing (master value = "Regular expression")
+abuse.filtertype.regexp = 
+# missing (master value = "Expression")
+abuse.filter.expression = 
 
 
 # head
-head.start=hasiera
-head.logout=irten
-head.help=laguntza
-head.search=bilatu
-head.logged_in=erregistraturik zaude
+head.start = hasiera
+head.logout = irten
+head.help = laguntza
+head.search = bilatu
+head.logged_in = erregistraturik zaude
 
 # foot
-foot.top=gora
+foot.top = gora
 
 
+########## dynamic values ##########
 
+# (users can add new types, how to translate these)
+# suggestion if not in bundle use value as Text
 
 
-########## error ##########
+# Article types
+articletypes.openposting = bidalitako mezu ireki bat
+articletypes.newswire = newswire
+articletypes.feature = azalakoa
+articletypes.topicspecial = gaiaz berezia
+articletypes.startspecial = berezia
 
-error.htmltitle=Indymedia Euskal Herria | Errakuntza
-error.title=Iep! Errakuntza bat gertatu da
-error.text=Ondoren datorren mezak agian ez dizu askorik lagunduko, baina seguraski <a href="mailto:{0}">{1}</a>koei bai.
-error.text2=Mesedez, mezu bat bidali <a href="mailto:{0}">{1}</a>ra <font color="Red">gorriz agertzen den testuarekin</font> eta egiten ari zinenaren azalpen zehatzarekin. Eskerrik asko!
+# Comment status values
+# missing (master value = "normal")
+commentstatus.normal = 
+# missing (master value = "good")
+commentstatus.good = 
+# missing (master value = "bad")
+commentstatus.bad = 
 
-usererror.htmltitle=Indymedia Euskal Herria | Errakuntza datuetan
-usererror.title=Arranopola! Errakuntza bat gertatu da
-usererror.text=Sartu dituzun datuek ondoko errakuntza sortarazi dute:
-usererror.what_to_do=Mesedez, sakatu atzera botoia eta saiatu berriz
 
-htmlcharset=utf-8
+
+########## error ##########
+error.htmltitle = Errakuntza
+error.title = Iep! Errakuntza bat gertatu da
+error.text = Ondoren datorren mezak agian ez dizu askorik lagunduko, baina seguraski <a href="mailto:{0}">{1}</a>koei bai.
+error.text2 = Mesedez, mezu bat bidali <a href="mailto:{0}">{1}</a>ra <font color="Red">gorriz agertzen den testuarekin</font> eta egiten ari zinenaren azalpen zehatzarekin. Eskerrik asko!
+
+usererror.htmltitle = Errakuntza datuetan
+usererror.title = Arranopola! Errakuntza bat gertatu da
+usererror.text = Sartu dituzun datuek ondoko errakuntza sortarazi dute:
+usererror.what_to_do = Mesedez, sakatu atzera botoia eta saiatu berriz
+
+# missing (master value = "The format of the media you uploaded is not supported")
+media.error.unsupportedformat = 
+# missing (master value = "The new password must be entered twice")
+user.error.missingpasswords = 
+# missing (master value = "The passwords are not equal")
+user.error.passwordmismatch = 
+# missing (master value = "A password must be entered")
+user.error.missingpassword = 
+
+
+########## infomessages ##########
+infomessage.htmltitle = Oharra
+infomessage.produceAllNewAddedToQueue = Lana zerrendan sartuta
+
+########## HTML-charset ##########
diff --git a/bundles/admin_gn.properties b/bundles/admin_gn.properties
deleted file mode 100755 (executable)
index cac890c..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-########## admin ##########
-# language: guarani
-
-languagename=Guaran\92
-
-
-# general
-yes=sí
-no=no
-dontcare=no importa
-all=todo
-
-# actions
-insert=insertar
-save=guardar
-edit=editar
-delete=borrar
-add=añadir
-filter=filtrar
-attach=vincular
-list=mostrar lista
-back=atrás
-cancel=cancelar
-
-# records
-records=registros
-show_from_to=mostrando entradas desde {0} hasta {1}
-no_matches_found=No se encontraron resultados!
-list.next=siguiente
-list.previous=anterior
-
-# media - used by image, audio, video and other media
-media.created=creado
-media.changed=cambiado
-media.published=publicado
-media.format=Formato
-media.rights=Copyright
-media.type=Tipo
-media.size=Tamaño
-media.mediafolder=Carpeta de recursos mediáticos
-media.title=Título
-media.description=Descripción
-media.date=Fecha
-media.location=Lugar de origen
-media.creator=Creador
-media.keywords=Palabras clave
-media.comment=Comentario
-media.source=Origen
-media.is_published=Disponible para publicación
-media.icon=Icono
-media.nr_of_media=Número de recursos mediáticos
-media.nr_of_media.submit=define number
-medialist.search_text_in=Buscar texto en
-
-# image
-image.htmltitle=imagen
-imagelist.htmltitle=lista de imagenes
-
-# audio
-audio.htmltitle=audio
-audiolist.htmltitle=lista de audio
-
-# video
-video.htmltitle=video
-videolist.htmltitle=lista de video
-
-# other
-other_media.htmltitle=otros recursos mediáticos
-other_media.htmltitle=lista de recursos mediáticos
-
-# breaking
-breaking.htmltitle=últimas noticias
-breakinglist.htmltitle=listado de últimas noticias
-breaking.textinfo=(max. 5 líneas / 250 caracteres)
-breaking.text=texto
-breaking.date=fecha
-
-
-# comment
-comment.htmltitle=commentario
-comment.date=fecha
-comment.title=título
-comment.published=publicado
-comment.text=texto-del-comentario
-comment.address=dirección
-comment.phone=teléfono
-comment.email=email
-comment.url=url
-comment.creator=autor
-comment.article=del artículo
-comment.html=es HTML?
-comment.status=Status # needs translation 
-comment.language=Lengua
-
-commentlist.htmltitle=lista de comentarios
-commentlist.published=publicado
-commentlist.hidden=oculto
-commentlist.search=buscar!
-
-commentlist.order.datedesc= date (desc.)                  # needs translation
-commentlist.order.dateasc= date (asc.)                    # needs translation
-commentlist.order.articletitle= article title             # needs translation
-
-
-# confirm
-confirm.htmltitle=confirmar borrado
-confirm.really_delete=Desea borrar esta entrada?
-
-# content
-content.htmltitle=contenido
-content.owner=Propietario
-content.topic=Tema
-content.feature=Característica
-content.title=titulo largo
-content.subtitle=subtítulo/título de contexto
-content.location=Lugar de origen
-content.creator=autor
-content.creator.email=Email
-content.creator.url=Web
-content.creator.address=Dirección
-content.creator.telephone=Teléfono
-content.abstract=Descripción breve
-content.content=Contenido
-content.html=es HTML?
-content.comment=Comentario interno
-content.internal=(propósito interno)
-content.attachments=Vínculos
-content.images=Imágenes
-content.audio=Audio
-content.video=Video
-content.other=Otros recursos mediáticos
-content.media=Recursos mediáticos
-content.addimage=añadir imagen
-content.addaudio=añadir audio
-content.addvideo=añadir video
-content.addother=añadir otros recursos mediáticos
-content.creationdate=fecha
-content.modificationdate=último cambio
-content.status=Estado
-content.type=Tipo de artículo
-content.published=publicado
-content.comments=Comentarios
-
-contentlist.htmltitle=lista de contenidos
-
-# language
-language.htmltitle=idiomas
-language.name=idioma
-language.code=Código del idioma
-
-languagelist.htmltitle=lista de idiomas
-
-# imcs
-linkimcs.htmltitle=Enlaces a IMCs
-linkimcs.name=Nombre
-linkimcs.continent=Continente
-linkimcs.new_parent=Nuevo Ancestro
-linkimcs.url=URL
-linkimcs.sort_by=Criterio de orden
-linkimcs.language=Idioma
-linkimcs.parent=ancestro
-
-linkimcslist.htmltitle=Lista de enlaces a IMCs
-linkimcslist.search_in=Buscar texto en
-
-# login
-login.htmltitle=registro
-login.info=Esta zona es accesible exclusivamente a grupos autorizados. Si desea colaborar como editor, por favor contacte con nosotros en {0}.
-login.title=login
-login.name=Login
-login.password=Password
-login.language=Idioma
-login.submit=  Envíar
-
-# mediafolder
-mediafolder.htmltitle=carpeta de recursos mediáticos
-mediafolder.date=fecha
-mediafolder.name=nombre
-mediafolder.location=lugar de origen
-mediafolder.keywords=palabras clave
-mediafolder.comment=commentario
-
-mediafolderlist.htmltitle=lista de carpetas de recursos mediáticos
-
-# message
-message.htmltitle=mensajes
-message.date=fecha
-message.title=título
-message.creator=Autor
-message.text=texto
-message.textinfo=(max. 5 líneas / 250 caracteres)
-
-messagelist.htmltitle=lista de mensajes
-
-# feature
-feature.htmltitle=presentación
-feature.title=Título
-feature.published=publicado
-feature.is_published=está publicado
-feature.is_not_published=no está publicado
-feature.filename=Nombre del fichero
-feature.abstract=Descripción breve
-feature.link=Enlace
-
-featurelist.htmltitle=lista de presentaciones
-
-# admin start page
-start.htmltitle=administración
-start.openpostings.title=ENVÍOSABIERTOS
-start.comments.title=COMENTARIOS
-start.breaking.title=ÚLTIMAS NOTICIAS
-start.breaking.new=últimas noticias recientes
-start.content.title=ARTICULOS
-start.content.new=nuevos artículos
-start.show=mostrar
-start.content.newswire=newswire
-start.content.feature=presentación
-start.content.topicspecial=especiales-por-tema
-start.content.startspecial=especiales-página-de-inicio
-start.content.not_published=artículos aun sin publicar
-start.content.with_media=con recursos mediáticos
-start.content.last_changes=últimos cambios
-start.content.with_comments=con comentarios de propósito interno
-start.content.all=todos
-start.content.search=buscar
-start.generate.title=GENERAR MANUALMENTE
-start.generate.all.title=todas las areas
-start.generate.all.new=todo nuevo (estándar, actualización en la web > 5min.)
-start.generate.parts.title=partes específicas del website
-start.generate.startpages.new=nueva página de inicio
-start.generate.all_forced=todos (forzado)
-start.generate.all_sync=todos (forzado y sincronizado)
-start.generate.content.new=nuevo contenido
-start.generate.topics.new=nuevos temas
-start.generate.postings.new=nuevos envios abiertos
-start.generate.images.new=nuevas imágenes
-start.generate.audio.new=nuevos ficheros de audio
-start.generate.video.new=nuevos ficheros de video
-start.generate.other.new=otros recursos mediáticos nuevos
-start.generate.navigation=navegación
-start.coverage.title=COBERTURA
-start.topics.title=TEMAS
-start.images.title=MATERIAL GRAFICO
-start.mediafolder.title=CARPETA DE RECURSOS MEDIATICOS
-start.languages.title=TÍTULO
-start.imcs.title=IMCS
-start.messageboard.title=Mensajería Interna
-start.messageboard.no_messages=no hay mensajes
-
-start.superusermenu=Superuser menu (use with care!) # needs translation\r
-
-
-# topic
-topic.htmltitle=tema
-topic.title=Nombre
-topic.description=descripción
-topic.filename=Nombre del fichero
-topic.main_url=página de información principal
-topic.archive_url=URL del archivo
-
-topiclist.htmltitle=lista de temas
-
-articletype.htmltitle=Article type  # needs translation
-articletype.id=id  # needs translation
-articletype.name=Name  # needs translation
-
-articletypelist.htmltitle=Article types  # needs translation
-
-commentstatus.htmltitle=Comment status  # needs translation
-commentstatus.id=id  # needs translation
-commentstatus.name=Name  # needs translation
-
-commentstatuslist.htmltitle=Comment status values  # needs translation
-
-
-superusermenu.htmltitle = Super-user functions                  # needs translation\r
-superusermenu.topics = Manage topics                            # needs translation\r
-superusermenu.articletypes = Manage article types               # needs translation  \r
-superusermenu.comment_statuses = Manage comment status values   # needs translation\r
-superusermenu.users = Manage users                              # needs translation\r
-superusermenu.languages = Manage languages                      # needs translation \r
-superusermenu.imcs = Manage IMCS (obsolete)                     # needs translation\r
-
-
-# users
-user.htmltitle=usuario
-user.login=login
-user.password=password
-user.admin=administrador
-
-userlist.htmltitle=lista de usuarios
-
-# head
-head.start=inicio
-head.logout=salir
-head.help=ayuda
-head.search=buscar
-head.logged_in=estás registrado
-
-# foot
-foot.top=arriba
-
-
-########## error ##########
-
-error.htmltitle=error
-error.title=oi! oi! oi!
-error.text=El siguiente mensaje puede que no le sea de mucha ayuda, pero seguramente lo será para <a href="mailto:{0}">{1}</a>:
-error.text2=Por favor envíe un mensaje con el <font color="Red">texto que aparece en rojo</font> y una descripción detallada a la siguiente dirección <a href="mailto:{0}">{1}</a>. Gracias!
-
-
-usererror.htmltitle=error de datos
-usererror.title=oi! oi! oi!
-usererror.text=Los datos que ha introducido han causado el siguiente error:
-usererror.what_to_do=Por favor, pulse el botón para volver e intentelo de nuevo
-
-
-
-
-htmlcharset=utf-8
index 489c8ae..5fe8908 100755 (executable)
 ########## admin ##########
 # language: dutch
-# $Id: admin_nl.properties,v 1.4 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_nl.properties,v 1.5 2003/04/09 02:06:06 zapata Exp $
 
-languagename=Nederlands
+languagename = Nederlands
 
 # general
-yes=ja
-no=nee
-dontcare=maakt niet uit
-all=allemaal
-month=maand
-year=jaar
-file=bestand
+yes = ja
+no = nee
+dontcare = maakt niet uit
+all = allemaal
+month = maand
+year = jaar
+file = bestand
+new = nieuw
+by = door
+help = help
+
 
 # actions
-insert=Toevoegen
-save=Bewaren
-edit=Bewerken
-delete=Wissen
-add=Toevoegen
-filter=Filtreren
-attach=Attach
-list=Bladeren
-back=Terug
-cancel=Ongedaan maken
-preview=Preview
-reset=Herstellen
+insert = Toevoegen
+save = Bewaren
+edit = Bewerken
+delete = Wissen
+add = Toevoegen
+filter = Filtreren
+attach = Attach
+list = Bladeren
+back = Terug
+cancel = Ongedaan maken
+preview = Preview
+reset = Herstellen
+administer = Opruimen
+search = zoeken
+
 
 # special
-fileedit=Bestand bewerken
+fileedit = Bestand bewerken
+
 
 # records
-records=items
-show_from_to=van {0} to {1}
-no_matches_found=Geen items gevonden!
-list.next=volgende
-list.previous=vorige
+records = items
+show_from_to = van {0} to {1}
+no_matches_found = Geen items gevonden!
+list.next = volgende
+list.previous = vorige
+
 
 # media - used by image, audio, video and other media
-media.created=aangemaakt
-media.changed=laatste wijziging
-media.published=gepubliceerd
-media.format=formaat
-media.rights=status auteursrecht
-media.type=soort
-media.mediafolder=Media map
-media.title=Titel
-media.size=Grootte
-media.description=Omschrijving
-media.date=Datum
-media.location=Locatie
-media.creator=Auteur
-media.keywords=Sleutelwoorden
-media.comment=Aantekeningen (voor intern gebruik)
-media.source=Bron
-media.is_published=Gepubliceerd
-media.icon=Pictogram
-media.nr_of_media=Aantal media items
-media.nr_of_media.submit=Stel in
-
-medialist.search_text_in=Zoek tekst in
+media.created = aangemaakt
+media.changed = laatste wijziging
+media.published = gepubliceerd
+media.format = formaat
+media.rights = status auteursrecht
+media.type = soort
+media.mediafolder = Media map
+media.title = Titel
+media.size = Grootte
+media.description = Omschrijving
+media.date = Datum
+media.location = Locatie
+media.creator = Auteur
+media.keywords = Sleutelwoorden
+media.comment = Aantekeningen (voor intern gebruik)
+media.source = Bron
+media.is_published = Gepubliceerd
+media.icon = Pictogram
+media.nr_of_media = Aantal media items
+media.nr_of_media.submit = Stel in
+
+medialist.search_text_in = Zoek tekst in
+
 
 # image
-image.htmltitle=Afbeelding
-imagelist.htmltitle=Overzicht afbeeldingen
+image.htmltitle = Afbeelding
+imagelist.htmltitle = Overzicht afbeeldingen
+
 
 # audio
-audio.htmltitle=Geluidsfragmenten
-audiolist.htmltitle=Overzicht geluidsfragmenten
+audio.htmltitle = Geluidsfragmenten
+audiolist.htmltitle = Overzicht geluidsfragmenten
+
 
 # video
-video.htmltitle=Beeldfragment
-videolist.htmltitle=Overzicht beeldfragmenten
+video.htmltitle = Beeldfragment
+videolist.htmltitle = Overzicht beeldfragmenten
+
 
 # other
-other_media.htmltitle=Andere multi-media
-other_medialist.htmltitle=Overzicht andere multi-media
+other_media.htmltitle = Andere multi-media
+other_medialist.htmltitle = Overzicht andere multi-media
+
 
 # breaking
-breaking.htmltitle=Breaking news
-breaking.textinfo=(max. 5 regels en 250 karakters)
-breaking.text=Tekst
-breaking.date=Datum
+breaking.htmltitle = Breaking news
+breaking.textinfo = (max. 5 regels en 250 karakters)
+breaking.text = Tekst
+breaking.date = Datum
+
+breakinglist.htmltitle = Overzicht breaking news 
 
-breakinglist.htmltitle=Overzicht breaking news 
 
 # comment
-comment.htmltitle=Commentaar
-comment.date=Datum  
-comment.title=Titel
-comment.published=Gepubliceerd
-comment.text=Commetaar tekst
-comment.address=Adres
-comment.phone=Telefoon
-comment.email=E-mail
-comment.url=Homepage
-comment.creator=Auteur
-comment.article=Voor artikel
-comment.html=HTML?
-comment.status=Status 
-comment.language=Taal
-
-commentlist.htmltitle=Overzicht commentaren
-commentlist.published=Gepubliceerd
-commentlist.hidden=Verborgen
-commentlist.search=Zoek
-
-commentsearch.order.datedesc= Datum (nieuwste eerst)
-commentsearch.order.dateasc= Datum (oudste eerst)
-commentsearch.order.articletitle= Titel artikel
+comment.htmltitle = Commentaar
+comment.date = Datum  
+comment.title = Titel
+comment.published = Gepubliceerd
+comment.text = Commetaar tekst
+comment.address = Adres
+comment.phone = Telefoon
+comment.email = E-mail
+comment.url = Homepage
+comment.creator = Auteur
+comment.article = Voor artikel
+comment.html = HTML?
+comment.status = Status 
+comment.language = Taal
+
+comment.operation.hide = verbergen
+comment.operation.unhide = zichtbaar maken
+
+
+#commentlist
+commentlist.htmltitle = Overzicht commentaren
+commentlist.published = Gepubliceerd
+commentlist.hidden = Verborgen
+commentlist.allcomments = Alle commentaren van dit artikel
+commentlist.search = Zoek
+commentlist.activate = activeer veranderingen
+commentlist.order = sortering
+commentlist.order.datedesc = datum (aflopend)
+commentlist.order.dateasc = datum (oplopend)
+commentlist.order.articletitle = titel
+
+commentsearch.field = Zoeken
+commentsearch.field.title = Titel
+commentsearch.field.creator = Auteur
+commentsearch.field.description = Inhoud
+commentsearch.value = Waarde
+
+commentsearch.publishedstate = Publicatie status
+commentsearch.publishedstate.hidden = Ongepubliceerd
+commentsearch.publishedstate.published = Gepubliceerd
+
+commentsearch.status = Status
+
+commentsearch.order = Sortering
+commentsearch.order.datedesc = Datum (nieuwste eerst)
+commentsearch.order.dateasc = Datum (oudste eerst)
+commentsearch.order.articletitle = Titel artikel
+
+commentsearch.searchbutton = Zoeken
+
 
 # confirm
-confirm.htmltitle=Bevestigen
-confirm.really_delete=Weet je zeker dat je dit item wilt deleten?
+confirm.htmltitle = Bevestigen
+confirm.really_delete = Weet je zeker dat je dit item wilt deleten?
+confirm.text = Deze operatie kan niet ongedaan gemaakt worden
+
 
 # content
-content.htmltitle=Artikel
-content.owner=Eigenaar
-content.topic=Onderwerp
-content.feature=Feature
-content.title=Titel
-content.subtitle=Onder titel / Context titel
-content.location=Locatie
-content.creator=Auteur
-content.creator.email=E-mail
-content.creator.url=Homepage
-content.creator.address=Adres
-content.creator.telephone=Telefoon
-content.abstract=Inleiding
-content.content=Tekst
-content.html=HTML?
-content.comment=Aantekeningen
-content.internal=(voor intern gebruik)
-content.attachments=Attachments
-content.images=Afbeeldingen
-content.audio=Geluidsfragmenten
-content.video=Beeldfragmenten
-content.other=Andere multi-media
-content.media=Multi-media
-content.addimage=Afbeelding bijvoegen
-content.addaudio=Geluidsfragment bijvoegen
-content.addvideo=Beeldmateriaal bijvoegen
-content.addother=Andere multi-media bijvoegen
-content.creationdate=Aanmaak datum
-content.modificationdate=Datum laatste wijziging
-content.status=Status
-content.type=Soort artikel 
-content.import_date=Import datum
-content.lastchange_date=Datum laatste wijziging
-content.create_date=Aanmaak datum
-content.published=Gepubliceerd
-content.comments=Commentaren
-
-
-contentlist.htmltitle=Overzicht Artikelen
-contentlist.comments=Commentaren
+content.htmltitle = Artikel
+content.owner = Eigenaar
+content.language = Taal
+content.articletype = Artikel soort
+content.topic = Onderwerp
+content.title = Titel
+content.subtitle = Onder titel / Context titel
+content.location = Locatie
+content.creator = Auteur
+content.creator.email = E-mail
+content.creator.url = Homepage
+content.creator.address = Adres
+content.creator.telephone = Telefoon
+content.abstract = Inleiding
+content.content = Tekst
+content.html = HTML?
+content.comment = Aantekeningen
+content.internal = (voor intern gebruik)
+
+content.attachments = Attachments
+content.images = Afbeeldingen
+content.audio = Geluidsfragmenten
+content.video = Beeldfragmenten
+content.other = Andere multi-media
+content.media = Multi-media
+content.addimage = Afbeelding bijvoegen
+content.uploadimage = Afbeelding uploaden
+content.addaudio = Geluidsfragment bijvoegen
+content.uploadaudio = Geluidsfragment uploaden
+content.addvideo = Beeldmateriaal bijvoegen
+content.uploadvideo = Beeldmateriaal uploaden
+content.addother = Andere multi-media bijvoegen
+content.uploadother = Andere multi-media uploaden
+
+content.creationdate = Aanmaak datum
+content.modificationdate = Datum laatste wijziging
+content.status = Status
+content.type = Soort artikel 
+content.import_date = Import datum
+content.lastchange_date = Datum laatste wijziging
+content.create_date = Aanmaak datum
+content.published = Gepubliceerd
+content.comments = Commentaren
+
+content.family = Dochter / moeder artikelen
+content.children = Dochters
+content.viewchildren = Tonen
+content.parent = Moeder
+content.viewparent = Tonen
+content.clearparent = De-selecteren
+content.selectparent = Selecteren
+
+content.operation.hide = Verbergen
+content.operation.unhide = Zichtbaar maken
+content.operation.newswire = Newslijn
+
+contentsearch.value = Zoeken
+contentsearch.field = Veld
+contentsearch.field.title = Titel
+contentsearch.field.creator = Auteur
+contentsearch.field.contents = Inhoud
+
+contentsearch.publishedstate = Publicatie status
+contentsearch.publishedstate.hidden = Ongepubliceerd
+contentsearch.publishedstate.published = Gepubliceerd
+
+contentsearch.articletype = Artikel type
+
+contentsearch.order = Sortering
+contentsearch.order.datedesc = Nieuwste eerst
+contentsearch.order.dateasc = Oudste eerst
+contentsearch.order.title = Titel
+contentsearch.order.creator = Auteur
+contentsearch.searchbutton = Zoeken
+
+
+#contentlist
+contentlist.htmltitle = Overzicht Artikelen
+contentlist.comments = Commentaren
+contentlist.select = Selecteren
+
 
 # language
-language.htmltitle=Taal
-language.name=Taal
-language.code=Taal code
+language.htmltitle = Taal
+language.name = Taal
+language.code = Taal code
+
+languagelist.htmltitle = Overzicht talen
 
-languagelist.htmltitle=Overzicht talen
 
 # imcs
-linkimcs.htmltitle=LinksImcs
-linkimcs.name=Name
-linkimcs.continent=Continent
-linkimcs.new_parent=New Parent
-linkimcs.url=URL
-linkimcs.sort_by=Sortcriteria
-linkimcs.language=Language
-linkimcs.parent=parent
-
-linkimcslist.htmltitle=LinksImcsList
-linkimcslist.search_in=Search text in
+linkimcs.htmltitle = LinksImcs
+linkimcs.name = Name
+linkimcs.continent = Continent
+linkimcs.new_parent = New Parent
+linkimcs.url = URL
+linkimcs.sort_by = Sortcriteria
+linkimcs.language = Language
+linkimcs.parent = parent
+
+linkimcslist.htmltitle = LinksImcsList
+linkimcslist.search_in = Search text in
+
 
 # login
-login.htmltitle=Aanmelden
-login.info=Deze website is niet toegankelijk voor onbevoegden. Neem contact op met {0} voor meer informatie. 
-login.title=Aanmelden
-login.name=Gebruikersnaam
-login.password=Wachtwoord
-login.language=Taalkeuze
-login.submit=Aanmelden 
+login.htmltitle = Aanmelden
+login.info = Deze website is niet toegankelijk voor onbevoegden. Neem contact op met {0} voor meer informatie. 
+login.title = Aanmelden
+login.name = Gebruikersnaam
+login.password = Wachtwoord
+login.language = Taalkeuze
+login.submit = Aanmelden 
+
 
 # mediafolder
-mediafolder.htmltitle=Multi-media map
-mediafolder.date=Datum
-mediafolder.name=Naam
-mediafolder.location=Locatie
-mediafolder.keywords=Sleutelwoorden
-mediafolder.comment=Aantekeningen
+mediafolder.htmltitle = Multi-media map
+mediafolder.date = Datum
+mediafolder.name = Naam
+mediafolder.location = Locatie
+mediafolder.keywords = Sleutelwoorden
+mediafolder.comment = Aantekeningen
+
+mediafolderlist.htmltitle = Overzicht multi-media mappen
 
-mediafolderlist.htmltitle=Overzicht multi-media mappen
 
 # message
-message.htmltitle=Intern prikbord
-message.date=Datum
-message.title=Titel
-message.creator=Auteur
-message.text=Tekst
-message.textinfo=(max. 5 regels / 250 karakters)
+message.htmltitle = Intern prikbord
+message.date = Datum
+message.title = Titel
+message.creator = Auteur
+message.text = Tekst
+message.textinfo = (max. 5 regels / 250 karakters)
 
-messagelist.htmltitle=Overzicht intern prikbord
+messagelist.htmltitle = Overzicht intern prikbord
 
 # admin start page
-start.htmltitle=Beheer
-start.openpostings.title=Open postings
-start.comments.title=Commentaren
-start.breaking.title=Breaking news
-start.breaking.new=Breaking news toevoegen
-start.content.title=Artikelen
-start.content.new=Artikel aanmaken
-start.show=bekijken
-
-start.content.hidden=Ongepubliceerde artikelen
-start.content.not_published=Ongepubliceerde artikelen
-start.content.with_media=Artikelen met multi-media
-start.content.last_changes=Laatst gewijzigde artikelen
-start.content.with_comments=Artikelen met interne opmerkingen
-start.content.all=Alle artikelen
-start.content.search=Zoeken
-
-start.allarticlesoftype=Alle "{0}" artikelen
-
-
-start.producers.title=Handmatig genereren
-start.producers.produceAllNew=Alle nieuwe pagina's genereren
-start.producers.advanced=Geavanceerde functies (niet zomaar gebruiken!)
-
-start.topics.title=Onderwerpen
-start.other_media.title=Andere multi-media
-start.images.title=Afbeeldingen
-start.video.title=Beeldfragmenten
-start.audio.title=Geluidsfragmenten
-start.mediafolder.title=Multi-media map
-start.languages.title=Talen
-start.imcs.title=IMCS
-start.messageboard.title=Intern prikbord
-start.messageboard.no_messages=Geen berichten
-
-start.superusermenu=Super-gebruiker functies (niet zomaar gebruiken!)
-
-start.editfiles.title=Bestanden bewerken
-start.editfiles.include=Bewerken
+start.htmltitle = Beheer
+
+start.breaking.new = Breaking news toevoegen
+start.content.new = Artikel aanmaken
+start.show = bekijken
+start.open_by_id = open nummer
+
+start.content.comments = Commentaren
+start.content.hidden = Ongepubliceerde artikelen
+start.content.not_published = Ongepubliceerde artikelen
+start.content.with_media = Artikelen met multi-media
+start.content.last_changes = Laatst gewijzigde artikelen
+start.content.with_comments = Artikelen met interne opmerkingen
+start.content.all = Alle artikelen
+start.content.search = Zoeken
+
+start.allarticlesoftype = Alle "{0}" artikelen
+
+start.producers.title = Handmatig genereren
+start.producers.produceAllNew = Alle nieuwe pagina's genereren
+start.producers.advanced = Geavanceerde functies (niet zomaar gebruiken!)
+
+start.openpostings.title = Open postings
+start.comments.title = Commentaren
+start.breaking.title = Breaking news
+start.content.title = Artikelen
+start.administer.title = OPRUIMEN
+start.list.title = LIJST
+start.fileedit.title = Include bestanden bewerken
+start.addandedit.title = VOEG TOE / BEWERK
+start.extra.title = EXTRA
+start.search.title = ZOEKEN
+start.topics.title = Onderwerpen
+start.other_media.title = Andere multi-media
+start.images.title = Afbeeldingen
+start.video.title = Beeldfragmenten
+start.audio.title = Geluidsfragmenten
+start.media.title = MEDIA
+start.mediafolder.title = Multi-media map
+start.languages.title = Talen
+start.imcs.title = IMCS
+start.messageboard.title = Intern prikbord
+start.messageboard.no_messages = Geen berichten
+
+start.superusermenu = Super-gebruiker functies (niet zomaar gebruiken!)
+
 
 # topic
-topic.htmltitle=Onderwerp
-topic.title=Naam
-topic.description=Omschrijving
-topic.filename=Bestandsnaam
-topic.main_url=Hoofd pagina
-topic.archive_url=Archief pagina
+topic.htmltitle = Onderwerp
+topic.title = Naam
+topic.description = Omschrijving
+topic.filename = Bestandsnaam
+topic.main_url = Hoofd pagina
+topic.archive_url = Archief pagina
+
+topiclist.htmltitle = Overzicht onderwerpen
 
-topiclist.htmltitle=Overzicht onderwerpen
 
 # users
-user.htmltitle=Gebruiker
-user.login=Gebruikersnaam
-user.password=Wachtwoord
-user.admin=Beheerder?
+user.htmltitle = Gebruiker
+user.login = Gebruikersnaam
+user.password = Wachtwoord
+user.password2 = Wachtwoord (bevestiging)
+user.admin = Beheerder?
+
+userlist.htmltitle = Overzicht gebruikers
 
-userlist.htmltitle=Overzicht gebruikers
 
+#articletype
+articletype.htmltitle = Artikelsoort
+articletype.id = Nummer
+articletype.name = Naam
 
-articletype.htmltitle=Artikelsoort
-articletype.id=Nummer
-articletype.name=Naam
+articletypelist.htmltitle = Overzicht artikel-soorten
 
-articletypelist.htmltitle=Overzicht artikel-soorten
 
-commentstatus.htmltitle=Commentaar status waarde
-commentstatus.id=Nummer
-commentstatus.name=Naam
 
-commentstatuslist.htmltitle=Overzicht commentaar status waarden
+#commentstatus
+commentstatus.htmltitle = Commentaar status waarde
+commentstatus.id = Nummer
+commentstatus.name = Naam
+
+commentstatuslist.htmltitle = Overzicht commentaar status waarden
+
 
 
 #file editing
+fileedit.htmltitle = Bestand bewerken
+fileedit.filename = Bestandsnaam
+fileedit.subdirectory = Map
+
 fileeditlist.htmltitle = Bewerkbare bestanden
 fileeditlist.filename = Bestandsnaam
-fileedit.filename = Bestandsnaam
-fileedit.htmltitle = Bestand bewerken
+fileeditlist.dirname = Map
+
 
 #producers
 producer.producer = Producer naam
@@ -290,11 +397,12 @@ producer.verb.name = Opdracht naam
 producer.verb.description = Opdracht omschrijving
 producer.verb.enqueue = uitvoeren
 
-producer.job.name= Taak
-producer.job.status= Status
-producer.job.date= Laatste wijziging
-producer.job.cancel= opheffen
-producer.job.abort= afbreken
+producer.job.name = Taak
+producer.job.status = Status
+producer.job.date = Laatste wijziging
+producer.job.cancel = opheffen
+producer.job.abort = afbreken
+producer.job.empty = wachtrij is leeg
 
 producer.jobqueue.title = Overzicht huidige opdrachten
 producer.jobqueue.refresh = Overzicht verversen
@@ -303,49 +411,101 @@ producer.producerlist.title = Nieuwe opdracht toevoegen
 producerqueue.htmltitle = Handmatig generen
 
 
-superusermenu.htmltitle = Super-user functies\r
-superusermenu.topics = Onderwerpen beheren\r
-superusermenu.articletypes = Artikel-soorten beheren\r
-superusermenu.comment_statuses = Commentaar status waarden beheren\r
-superusermenu.users = Gebruikers beheren\r
-superusermenu.languages = Talen beheren\r
-superusermenu.imcs = Manage IMCS (obsolete)\r
+#superusermenu
+superusermenu.htmltitle = Super-user functies
+superusermenu.manage = BEHEER
+superusermenu.topics = Onderwerpen beheren
+superusermenu.articletypes = Artikel-soorten beheren
+superusermenu.comment_statuses = Commentaar status waarden beheren
+superusermenu.users = Gebruikers beheren
+superusermenu.languages = Talen beheren
+superusermenu.abuse = Misbruik preventie 
+superusermenu.imcs = Manage IMCS (obsolete)
+
+
+#abuse
+abuse.htmltitle = Misbruik preventie
+
+abuse.setting = Instelling
+abuse.value = Waarde
+
+abuse.disableopenpostings = Open posting uitzetten
+abuse.openpostingpassword = Wachtwoord beveiliging voor open postings aanzetten
+abuse.logpostings = IP-nummers loggen
+abuse.logsize = IP-nummer log grootte
+abuse.cookies = "Cookies" gebruiken tegen misbruik
+abuse.articleaction = Actie voor een geblokkeerd artikel
+abuse.commentaction = Actie voor een geblokkeerd commentaar
+
+abuse.showlog = IP log bekijken
+abuse.showfilters = Filters beheren
+
+abuse.log.time = Tijdstip
+abuse.log.address = IP nummer
+abuse.log.object = Object
+abuse.log.browser = Browser
+
+abuse.filters = Filters
+abuse.filter.type = Type
+abuse.filtertype.ip = IP Nummer
+abuse.filtertype.regexp = Reguliere Expressie
+abuse.filter.expression = Expressie
 
 
 # head
-head.start=menu
-head.logout=uitloggen
-head.help=help
-head.search=zoeken
-head.logged_in=ingelogd
+head.start = menu
+head.logout = uitloggen
+head.help = help
+head.search = zoeken
+head.logged_in = ingelogd
 
 # foot
-foot.top=bovenkant
+foot.top = bovenkant
+
+
+########## dynamic values ##########
+
+# (users can add new types, how to translate these)
+# suggestion if not in bundle use value as Text
 
 
 # Article types
-articletypes.openposting=Open posting
-articletypes.newswire=Nieuwslijn
-articletypes.feature=Feature
-articletypes.topicspecial=Topic-special
-articletypes.startspecial=Startpagina-special
+articletypes.openposting = Open posting
+articletypes.newswire = Nieuwslijn
+articletypes.feature = Feature
+articletypes.topicspecial = Topic-special
+articletypes.startspecial = Startpagina-special
 
 # Comment status values
-commentstatus.normal=Normaal
+commentstatus.normal = Normaal
+# missing (master value = "good")
+commentstatus.good = 
+# missing (master value = "bad")
+commentstatus.bad = 
+
+
 
 ########## error ##########
+error.htmltitle = Mir heeft een fout gemaakt
+error.title = Mir heeft een fout gemaakt
+error.text = Dit can gebeuren. Gelieve de volgende tekst te kopieren en naar <a href="mailto:{0}">{1}</a> op te sturen:
+error.text2 = Gelieve de volgende <font color="Red">rode tekst</font> en een gedetailleerde omschrijving van de gebeurtenissen die tot deze fout geleid hebben op te sturen aan <a href="mailto:{0}">{1}</a>. Bij voorbaat dank!
+
+usererror.htmltitle = Validatie fout
+usererror.title = Validatie fout
+usererror.text = Jouw invoer heeft de volgende fout:
+usererror.what_to_do = Druk op de back-toets en probeer het opnieuw!
 
-error.htmltitle=Mir heeft een fout gemaakt
-error.title=Mir heeft een fout gemaakt
-error.text=Dit can gebeuren. Gelieve de volgende tekst te kopieren en naar <a href="mailto:{0}">{1}</a> op te sturen:
-error.text2=Gelieve de volgende de <font color="Red">rode tekst</font> en een gedetailleerde omschrijving van de gebeurtenissen die tot deze fout geleid hebben op te sturen aan <a href="mailto:{0}">{1}</a>. Bij voorbaat dank!
+media.error.unsupportedformat = Het formaat van het multi-media bestand dat je ge-upload hebt, wordt niet ondersteund
+user.error.missingpasswords = Het nieuwe wachtwoord moet tweemaal ingevuld worden
+user.error.passwordmismatch = De wachtwoorden zijn verschillend
+user.error.missingpassword = Er moet een wachtwoord worden ingevuld
 
-usererror.htmltitle=Validatie fout
-usererror.title=Validatie fout
-usererror.text=Jouw invoer heeft de volgende fout:
-usererror.what_to_do=Druk op de back-toets en probeer het opnieuw!
 
+########## infomessages ##########
 infomessage.htmltitle = Mededeling
 infomessage.produceAllNewAddedToQueue = Je opdracht wordt zo snel mogelijk uitgevoerd
 
-htmlcharset=utf-8
+########## HTML-charset ##########
+# missing (master value = "utf-8")
+htmlcharset = 
index c633789..e9e43bf 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: portuguese
-# $Id: admin_pt.properties,v 1.3 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_pt.properties,v 1.4 2003/04/09 02:06:06 zapata Exp $
 
 languagename=Português
 
@@ -307,13 +307,13 @@ producer.producerlist.title = Add a new job
 producerqueue.htmltitle = Generate manually
 
 
-superusermenu.htmltitle = funções dos super-usuários\r
-superusermenu.topics = Manutenção dos assuntos\r
-superusermenu.articletypes = Manutenção dos tipos de artigos\r
-superusermenu.comment_statuses = Manutenção comment status values\r
-superusermenu.users = Manutenção de usuários\r
-superusermenu.languages = Manutenção de línguas\r
-superusermenu.imcs = Manutenção de CMIs (absoleto)\r
+superusermenu.htmltitle = funções dos super-usuários
+superusermenu.topics = Manutenção dos assuntos
+superusermenu.articletypes = Manutenção dos tipos de artigos
+superusermenu.comment_statuses = Manutenção comment status values
+superusermenu.users = Manutenção de usuários
+superusermenu.languages = Manutenção de línguas
+superusermenu.imcs = Manutenção de CMIs (absoleto)
 
 
 
@@ -353,4 +353,3 @@ usererror.what_to_do=Por favor pressione a tecla de retorno e tente novamente
 infomessage.title = Informação
 infoanguage codeQueue = O seu pedido foi adicionada à fila de pedidos.
 
-htmlcharset=utf-8
diff --git a/bundles/admin_qu.properties b/bundles/admin_qu.properties
deleted file mode 100755 (executable)
index 972d2f4..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-########## admin ##########
-# language: quechua
-
-languagename=Quechua
-
-# general
-yes=sí
-no=no
-dontcare=no importa
-all=todo
-
-# actions
-insert=insertar
-save=guardar
-edit=editar
-delete=borrar
-add=añadir
-filter=filtrar
-attach=vincular
-list=mostrar lista
-back=atrás
-cancel=cancelar
-
-# records
-records=registros
-show_from_to=mostrando entradas desde {0} hasta {1}
-no_matches_found=No se encontraron resultados!
-list.next=siguiente
-list.previous=anterior
-
-# media - used by image, audio, video and other media
-media.created=creado
-media.changed=cambiado
-media.published=publicado
-media.format=Formato
-media.rights=Copyright
-media.type=Tipo
-media.mediafolder=Carpeta de recursos mediáticos
-media.title=Título
-media.size=Tamaño
-media.description=Descripción
-media.date=Fecha
-media.location=Lugar de origen
-media.creator=Creador
-media.keywords=Palabras clave
-media.comment=Comentario
-media.source=Origen
-media.is_published=Disponible para publicación
-media.icon=Icono
-media.nr_of_media=Número de recursos mediáticos
-media.nr_of_media.submit=define number
-medialist.search_text_in=Buscar texto en
-
-# image
-image.htmltitle=imagen
-imagelist.htmltitle=lista de imagenes
-
-# audio
-audio.htmltitle=audio
-audiolist.htmltitle=lista de audio
-
-# video
-video.htmltitle=video
-videolist.htmltitle=lista de video
-
-# other
-other_media.htmltitle=otros recursos mediáticos
-other_media.htmltitle=lista de recursos mediáticos
-
-# breaking
-breaking.htmltitle=últimas noticias
-breakinglist.htmltitle=listado de últimas noticias
-breaking.textinfo=(max. 5 líneas / 250 caracteres)
-breaking.text=texto
-breaking.date=fecha
-
-
-# comment
-comment.htmltitle=commentario
-comment.date=fecha
-comment.title=título
-comment.published=publicado
-comment.text=texto-del-comentario
-comment.address=dirección
-comment.phone=teléfono
-comment.email=email
-comment.url=url
-comment.creator=autor
-comment.article=del artículo
-comment.html=es HTML?
-comment.status=Status # needs translation 
-comment.language=Lengua
-
-commentlist.htmltitle=lista de comentarios
-commentlist.published=publicado
-commentlist.hidden=oculto
-commentlist.search=buscar!
-
-commentlist.order.datedesc= date (desc.)                  # needs translation
-commentlist.order.dateasc= date (asc.)                    # needs translation
-commentlist.order.articletitle= article title             # needs translation
-
-
-# confirm
-confirm.htmltitle=confirmar borrado
-confirm.really_delete=Desea borrar esta entrada?
-
-# content
-content.htmltitle=contenido
-content.owner=Propietario
-content.topic=Tema
-content.feature=Característica
-content.title=titulo largo
-content.subtitle=subtítulo/título de contexto
-content.location=Lugar de origen
-content.creator=autor
-content.creator.email=Email
-content.creator.url=Web
-content.creator.address=Dirección
-content.creator.telephone=Teléfono
-content.abstract=Descripción breve
-content.content=Contenido
-content.html=es HTML?
-content.comment=Comentario interno
-content.internal=(propósito interno)
-content.attachments=Vínculos
-content.images=Imágenes
-content.audio=Audio
-content.video=Video
-content.other=Otros recursos mediáticos
-content.media=Recursos mediáticos
-content.addimage=añadir imagen
-content.addaudio=añadir audio
-content.addvideo=añadir video
-content.addother=añadir otros recursos mediáticos
-content.creationdate=fecha
-content.modificationdate=último cambio
-content.status=Estado
-content.type=Tipo de artículo
-content.published=publicado
-content.comments=Comentarios
-
-contentlist.htmltitle=lista de contenidos
-
-# language
-language.htmltitle=idiomas
-language.name=idioma
-language.code=Código del idioma
-
-languagelist.htmltitle=lista de idiomas
-
-# imcs
-linkimcs.htmltitle=Enlaces a IMCs
-linkimcs.name=Nombre
-linkimcs.continent=Continente
-linkimcs.new_parent=Nuevo Ancestro
-linkimcs.url=URL
-linkimcs.sort_by=Criterio de orden
-linkimcs.language=Idioma
-linkimcs.parent=ancestro
-
-linkimcslist.htmltitle=Lista de enlaces a IMCs
-linkimcslist.search_in=Buscar texto en
-
-# login
-login.htmltitle=registro
-login.info=Esta zona es accesible exclusivamente a grupos autorizados. Si desea colaborar como editor, por favor contacte con nosotros en {0}.
-login.title=login
-login.name=Login
-login.password=Password
-login.language=Idioma
-login.submit=Envíar
-
-# mediafolder
-mediafolder.htmltitle=carpeta de recursos mediáticos
-mediafolder.date=fecha
-mediafolder.name=nombre
-mediafolder.location=lugar de origen
-mediafolder.keywords=palabras clave
-mediafolder.comment=commentario
-
-mediafolderlist.htmltitle=lista de carpetas de recursos mediáticos
-
-# message
-message.htmltitle=mensajes
-message.date=fecha
-message.title=título
-message.creator=Autor
-message.text=texto
-message.textinfo=(max. 5 líneas / 250 caracteres)
-
-messagelist.htmltitle=lista de mensajes
-
-# feature
-feature.htmltitle=presentación
-feature.title=Título
-feature.published=publicado
-feature.is_published=está publicado
-feature.is_not_published=no está publicado
-feature.filename=Nombre del fichero
-feature.abstract=Descripción breve
-feature.link=Enlace
-
-featurelist.htmltitle=lista de presentaciones
-
-# admin start page
-start.htmltitle=administración
-start.openpostings.title=ENVÍOSABIERTOS
-start.comments.title=COMENTARIOS
-start.breaking.title=ÚLTIMAS NOTICIAS
-start.breaking.new=últimas noticias recientes
-start.content.title=ARTICULOS
-start.content.new=nuevos artículos
-start.show=mostrar
-start.content.newswire=newswire
-start.content.feature=presentación
-start.content.topicspecial=especiales-por-tema
-start.content.startspecial=especiales-página-de-inicio
-start.content.not_published=artículos aun sin publicar
-start.content.with_media=con recursos mediáticos
-start.content.last_changes=últimos cambios
-start.content.with_comments=con comentarios de propósito interno
-start.content.all=todos
-start.content.search=buscar
-start.generate.title=GENERAR MANUALMENTE
-start.generate.all.title=todas las areas
-start.generate.all.new=todo nuevo (estándar, actualización en la web > 5min.)
-start.generate.parts.title=partes específicas del website
-start.generate.startpages.new=nueva página de inicio
-start.generate.all_forced=todos (forzado)
-start.generate.all_sync=todos (forzado y sincronizado)
-start.generate.content.new=nuevo contenido
-start.generate.topics.new=nuevos temas
-start.generate.postings.new=nuevos envios abiertos
-start.generate.images.new=nuevas imágenes
-start.generate.audio.new=nuevos ficheros de audio
-start.generate.video.new=nuevos ficheros de video
-start.generate.other.new=otros recursos mediáticos nuevos
-start.generate.navigation=navegación
-start.coverage.title=COBERTURA
-start.topics.title=TEMAS
-start.images.title=MATERIAL GRAFICO
-start.mediafolder.title=CARPETA DE RECURSOS MEDIATICOS
-start.languages.title=TÍTULO
-start.imcs.title=IMCS
-start.messageboard.title=Mensajería Interna
-start.messageboard.no_messages=no hay mensajes
-
-start.superusermenu=Superuser menu (use with care!) # needs translation\r
-
-
-# topic
-topic.htmltitle=tema
-topic.title=Nombre
-topic.description=descripción
-topic.filename=Nombre del fichero
-topic.main_url=página de información principal
-topic.archive_url=URL del archivo
-
-topiclist.htmltitle=lista de temas
-
-articletype.htmltitle=Article type  # needs translation
-articletype.id=id  # needs translation
-articletype.name=Name  # needs translation
-
-articletypelist.htmltitle=Article types  # needs translation
-
-commentstatus.htmltitle=Comment status  # needs translation
-commentstatus.id=id  # needs translation
-commentstatus.name=Name  # needs translation
-
-commentstatuslist.htmltitle=Comment status values  # needs translation
-
-superusermenu.htmltitle = Super-user functions                  # needs translation\r
-superusermenu.topics = Manage topics                            # needs translation\r
-superusermenu.articletypes = Manage article types               # needs translation  \r
-superusermenu.comment_statuses = Manage comment status values   # needs translation\r
-superusermenu.users = Manage users                              # needs translation\r
-superusermenu.languages = Manage languages                      # needs translation \r
-superusermenu.imcs = Manage IMCS (obsolete)                     # needs translation\r
-
-# users
-user.htmltitle=usuario
-user.login=login
-user.password=password
-user.admin=administrador
-
-userlist.htmltitle=lista de usuarios
-
-# head
-head.start=inicio
-head.logout=salir
-head.help=ayuda
-head.search=buscar
-head.logged_in=estás registrado
-
-# foot
-foot.top=arriba
-
-
-########## error ##########
-
-error.htmltitle=error
-error.title=oi! oi! oi!
-error.text=El siguiente mensaje puede que no le sea de mucha ayuda, pero seguramente lo será para <a href="mailto:{0}">{1}</a>:
-error.text2=Por favor envíe un mensaje con el <font color="Red">texto que aparece en rojo</font> y una descripción detallada a la siguiente dirección <a href="mailto:{0}">{1}</a>. Gracias!
-
-
-usererror.htmltitle=error de datos
-usererror.title=oi! oi! oi!
-usererror.text=Los datos que ha introducido han causado el siguiente error:
-usererror.what_to_do=Por favor, pulse el botón para volver e intentelo de nuevo
-
-htmlcharset=utf-8
index 5f4c2ae..63b97da 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: svenska
-# $Id: admin_sv.properties,v 1.4 2003/03/16 14:26:30 zapata Exp $
+# $Id: admin_sv.properties,v 1.5 2003/04/09 02:06:06 zapata Exp $
 
 languagename=Svenska
 
@@ -353,4 +353,3 @@ usererror.what_to_do=Please press the back button and try it again
 infomessage.title = Information
 infomessage.produceAllNewAddedToQueue = Din beg&auml;ran har placerats i k&ouml;n.
 
-htmlcharset=utf-8
index d80fc69..a2ca84a 100755 (executable)
Binary files a/bundles/admin_tr.properties and b/bundles/admin_tr.properties differ
index 50d69cc..f8f7ff7 100755 (executable)
 ########## admin ##########
 # language: english
-# $Id: admin_zh.properties,v 1.1 2003/01/18 08:15:19 mh Exp $
+# $Id: admin_zh.properties,v 1.2 2003/04/09 02:06:06 zapata Exp $
 
 
-languagename=Chinese
+languagename = Chinese
 
 # general
-yes=¬O
-no=§_
-dontcare=ÀH·N
-all=¥þ
-month=¤ë
-year=¦~
-file=ÀÉ
+yes = \u662f
+no = \u5426
+dontcare = \u96a8\u610f
+all = \u5168
+month = \u6708
+year = \u5e74
+file = \u6a94
 
 # actions
-insert=´¡
-save=¦s
-edit=­×
-delete=§R
-add=¥[
-filter=Âo
-attach=ªþ
-list=Äý
-back=°h
-cancel=ºM
-preview=¹wÄý
-reset=­«³]
+insert = \u63d2
+save = \u5b58
+edit = \u4fee
+delete = \u522a
+add = \u52a0
+filter = \u6ffe
+attach = \u9644
+list = \u89bd
+back = \u9000
+cancel = \u64a4
+preview = \u9810\u89bd
+reset = \u91cd\u8a2d
 
 # special
-fileedit=½sÀÉ
+fileedit = \u7de8\u6a94
 
 # records
-records=°O¿ý¶µ¥Ø
-show_from_to=¦C¥X²Ä{0}µ§¨ì²Ä{1}µ§
-no_matches_found=µL²Å¦X¶µ¥Ø!
-list.next=«á¤@µ§
-list.previous=«e¤@µ§
+records = \u8a18\u9304\u9805\u76ee
+show_from_to = \u5217\u51fa\u7b2c{0}\u7b46\u5230\u7b2c{1}\u7b46
+no_matches_found = \u7121\u7b26\u5408\u9805\u76ee!
+list.next = \u5f8c\u4e00\u7b46
+list.previous = \u524d\u4e00\u7b46
 
 # media - used by image, audio, video and other media
-media.created=¤w»s§@
-media.changed=¤w·s­×
-media.published=¤wµoªí
-media.format=®æ¦¡
-media.rights=µÛ§@Åvª¬ªp
-media.type=´CÅé®æ¦¡
-media.mediafolder=´CÅé¸ê®Æ§¨
-media.title=¼ÐÃD
-media.description=´y­z
-media.date=¤é´Á
-media.location=¦aÂI
-media.creator=§@ªÌ
-media.keywords=ÃöÁä¦r
-media.comment=¤p·N¨£ (¤º³¡¨Ï¥Î)
-media.source=¨Ó·½
-media.is_published=¤vµoªí
-media.icon=¹Ï¥Ü
-media.nr_of_media=´CÅ骫¥ó¼Æ¶q (³Ì¦h20)
-media.nr_of_media.submit=©w¸q¼Æ¶q
-
-medialist.search_text_in=·j´M¤å¦r
+media.created = \u5df2\u88fd\u4f5c
+media.changed = \u5df2\u65b0\u4fee
+media.published = \u5df2\u767c\u8868
+media.format = \u683c\u5f0f
+media.rights = \u8457\u4f5c\u6b0a\u72c0\u6cc1
+media.type = \u5a92\u9ad4\u683c\u5f0f
+media.mediafolder = \u5a92\u9ad4\u8cc7\u6599\u593e
+media.title = \u6a19\u984c
+media.description = \u63cf\u8ff0
+media.date = \u65e5\u671f
+media.location = \u5730\u9ede
+media.creator = \u4f5c\u8005
+media.keywords = \u95dc\u9375\u5b57
+media.comment = \u5c0f\u610f\u898b (\u5167\u90e8\u4f7f\u7528)
+media.source = \u4f86\u6e90
+media.is_published = \u5df1\u767c\u8868
+media.icon = \u5716\u793a
+media.nr_of_media = \u5a92\u9ad4\u7269\u4ef6\u6578\u91cf (\u6700\u591a20)
+media.nr_of_media.submit = \u5b9a\u7fa9\u6578\u91cf
+
+medialist.search_text_in = \u641c\u5c0b\u6587\u5b57
 
 # image
-image.htmltitle=¼v¹³
-imagelist.htmltitle=¼v¹³ªí
+image.htmltitle = \u5f71\u50cf
+imagelist.htmltitle = \u5f71\u50cf\u8868
 
 # audio
-audio.htmltitle=Án­µ
-audiolist.htmltitle=Án­µªí
+audio.htmltitle = \u8072\u97f3
+audiolist.htmltitle = \u8072\u97f3\u8868
 
 # video
-video.htmltitle=¼v­µ
-videolist.htmltitle=¼v­µªí
+video.htmltitle = \u5f71\u97f3
+videolist.htmltitle = \u5f71\u97f3\u8868
 
 # other
-other_media.htmltitle=¨ä¥L´CÅé
-other_media.htmltitle=¨ä¥L´CÅéªí
+other_media.htmltitle = \u5176\u4ed6\u5a92\u9ad4
+other_media.htmltitle = \u5176\u4ed6\u5a92\u9ad4\u8868
 
 # breaking
-breaking.htmltitle=·s»D§Ö³ø
-breaking.textinfo=(³Ì¦h¤­¦æ/300¦r)
-breaking.text=¤º¤å
-breaking.date=¤é´Á
+breaking.htmltitle = \u65b0\u805e\u5feb\u5831
+breaking.textinfo = (\u6700\u591a\u4e94\u884c/300\u5b57)
+breaking.text = \u5167\u6587
+breaking.date = \u65e5\u671f
 
-breakinglist.htmltitle=§Ö³ø¦Cªí
+breakinglist.htmltitle = \u5feb\u5831\u5217\u8868
 
 # comment
-comment.htmltitle=µû½×
-comment.date=¤é´Á
-comment.title=¼ÐÃD
-comment.published=¤wµoªí
-comment.text=µû½×¤º¤å
-comment.address=¦a§}
-comment.phone=¹q¸Ü
-comment.email=¹q¶lemail
-comment.url=¶W³sµ²url
-comment.creator=§@ªÌ
-comment.article=°w¹ï
-comment.html=HTML?
-comment.status=ª¬ºA 
-comment.language=»y¨¥
-
-
-commentlist.htmltitle=µû½×¦Cªí
-commentlist.produced=¤w»s§@
-commentlist.hidden=ÁôÂÃ
-commentlist.search=¶}©l·j´M!
+comment.htmltitle = \u8a55\u8ad6
+comment.date = \u65e5\u671f
+comment.title = \u6a19\u984c
+comment.published = \u5df2\u767c\u8868
+comment.text = \u8a55\u8ad6\u5167\u6587
+comment.address = \u5730\u5740
+comment.phone = \u96fb\u8a71
+comment.email = \u96fb\u90f5email
+comment.url = \u8d85\u9023\u7d50url
+comment.creator = \u4f5c\u8005
+comment.article = \u91dd\u5c0d
+comment.html = HTML?
+comment.status = \u72c0\u614b 
+comment.language = \u8a9e\u8a00
+
+
+commentlist.htmltitle = \u8a55\u8ad6\u5217\u8868
+commentlist.produced = \u5df2\u88fd\u4f5c
+commentlist.hidden = \u96b1\u85cf
+commentlist.search = \u958b\u59cb\u641c\u5c0b!
 
 # confirm
-confirm.htmltitle=½T»{§R
-confirm.really_delete=¯u­n§R¦¹µ§¸ê®Æ?
+confirm.htmltitle = \u78ba\u8a8d\u522a
+confirm.really_delete = \u771f\u8981\u522a\u6b64\u7b46\u8cc7\u6599?
 
 # content
-content.htmltitle=¤º®e
-content.owner=¾Ö¦³ªÌ
-content.topic=¥DÃD
-content.feature=±MÃD
-content.title=¥D¼ÐÃD
-content.subtitle=°Æ¼ÐÃD
-content.location=¦aÂI
-content.creator=§@ªÌ
-content.creator.email=¹q¶lEmail
-content.creator.url=ºô¯¸
-content.creator.address=¦a§}
-content.creator.telephone=¹q¸Ü
-content.abstract=ºK­n
-content.content=¤º®e
-content.html=HTML?
-content.comment=¤º³¡µû½×
-content.internal=(¤º³¡)
-content.attachments=ªþ¥ó
-content.images=¼v¹³
-content.audio=Án­µ
-content.video=¼v­µ
-content.other=¨ä¥L´CÅé
-content.media=´CÅé
-content.addimage=¥[¼v¹³
-content.addaudio=¥[Án­µ
-content.addvideo=¥[¼v­µ
-content.addother=¥[¨ä¥L´CÅé
-content.creationdate=³Ð§@¤é´Á
-content.modificationdate=­×§ï¤é´Á
-content.status=ª¬ºA
-content.type=¤åÃþ
-content.import_date=Âà¤J¤é´Á
-content.lastchange_date=¤W¦¸­×§ï
-content.create_date=¤é´Á
-content.published=¤wµoªí
-content.comments=µû½×
-
-contentlist.htmltitle=¤º®eªí
+content.htmltitle = \u5167\u5bb9
+content.owner = \u64c1\u6709\u8005
+content.topic = \u4e3b\u984c
+content.feature = \u5c08\u984c
+content.title = \u4e3b\u6a19\u984c
+content.subtitle = \u526f\u6a19\u984c
+content.location = \u5730\u9ede
+content.creator = \u4f5c\u8005
+content.creator.email = \u96fb\u90f5Email
+content.creator.url = \u7db2\u7ad9
+content.creator.address = \u5730\u5740
+content.creator.telephone = \u96fb\u8a71
+content.abstract = \u6458\u8981
+content.content = \u5167\u5bb9
+content.html = HTML?
+content.comment = \u5167\u90e8\u8a55\u8ad6
+content.internal = (\u5167\u90e8)
+content.attachments = \u9644\u4ef6
+content.images = \u5f71\u50cf
+content.audio = \u8072\u97f3
+content.video = \u5f71\u97f3
+content.other = \u5176\u4ed6\u5a92\u9ad4
+content.media = \u5a92\u9ad4
+content.addimage = \u52a0\u5f71\u50cf
+content.addaudio = \u52a0\u8072\u97f3
+content.addvideo = \u52a0\u5f71\u97f3
+content.addother = \u52a0\u5176\u4ed6\u5a92\u9ad4
+content.creationdate = \u5275\u4f5c\u65e5\u671f
+content.modificationdate = \u4fee\u6539\u65e5\u671f
+content.status = \u72c0\u614b
+content.type = \u6587\u985e
+content.import_date = \u8f49\u5165\u65e5\u671f
+content.lastchange_date = \u4e0a\u6b21\u4fee\u6539
+content.create_date = \u65e5\u671f
+content.published = \u5df2\u767c\u8868
+content.comments = \u8a55\u8ad6
+
+contentlist.htmltitle = \u5167\u5bb9\u8868
 
 # language
-language.htmltitle=»y¨¥
-language.name=»y¨¥
-language.code=»y¨¥½s½X
+language.htmltitle = \u8a9e\u8a00
+language.name = \u8a9e\u8a00
+language.code = \u8a9e\u8a00\u7de8\u78bc
 
-languagelist.htmltitle=»y¨¥¦Cªí
+languagelist.htmltitle = \u8a9e\u8a00\u5217\u8868
 
 # imcs
-linkimcs.htmltitle=À³»¼´C¦Cªí
-linkimcs.name=¦WºÙ
-linkimcs.continent=¬w
-linkimcs.new_parent=·s¥ÀÂI
-linkimcs.url=ºô§}URL
-linkimcs.sort_by=±Æ¦C¨Ì¾Ú
-linkimcs.language=»y¨¥
-linkimcs.parent=¥ÀÂI
-
-linkimcslist.htmltitle=À³»¼´C¶W³sµ¸¦Cªí
-linkimcslist.search_in=·j´M
+linkimcs.htmltitle = \u61c9\u905e\u5a92\u5217\u8868
+linkimcs.name = \u540d\u7a31
+linkimcs.continent = \u6d32
+linkimcs.new_parent = \u65b0\u6bcd\u9ede
+linkimcs.url = \u7db2\u5740URL
+linkimcs.sort_by = \u6392\u5217\u4f9d\u64da
+linkimcs.language = \u8a9e\u8a00
+linkimcs.parent = \u6bcd\u9ede
+
+linkimcslist.htmltitle = \u61c9\u905e\u5a92\u8d85\u9023\u7d61\u5217\u8868
+linkimcslist.search_in = \u641c\u5c0b
 
 # login
-login.htmltitle=µn¤J
-login.info=¥»°Ï¥u¤¹³\¸g±ÂÅvªº¹ÎÅé. ­Y±z·Q¦¨¬°½s¿è¹Î¶¤ªº¤@­û, ½Ð©ó¤U¦C¦ì¸m³sµ¸§Ú­Ì
-login.title=µn¤J
-login.name=µn¤J
-login.password=±K½X
-login.language=»y¨¥
+login.htmltitle = \u767b\u5165
+login.info = \u672c\u5340\u53ea\u5141\u8a31\u7d93\u6388\u6b0a\u7684\u5718\u9ad4. \u82e5\u60a8\u60f3\u6210\u70ba\u7de8\u8f2f\u5718\u968a\u7684\u4e00\u54e1, \u8acb\u65bc\u4e0b\u5217\u4f4d\u7f6e\u9023\u7d61\u6211\u5011
+login.title = \u767b\u5165
+login.name = \u767b\u5165
+login.password = \u5bc6\u78bc
+login.language = \u8a9e\u8a00
 #login.language.ay=Aymara
 #login.language.de=Deutsch
 #login.language.en=English
-#login.language.es=Espa\96ol
-#login.language.gn=Guaran\92
-#login.language.qu=Quechua
+#login.language.es=Espa?l
+#login.language.gn=Guaran?#login.language.qu=Quechua
 #login.language.tr=Turkish
-login.submit=  ¦n¤F
+login.submit = \u597d\u4e86
 
 # mediafolder
-mediafolder.htmltitle=´CÅé¸ê®Æ§¨
-mediafolder.date=¤é´Á
-mediafolder.name=¦WºÙ
-mediafolder.location=¦aÂI
-mediafolder.keywords=ÃöÁä¦r
-mediafolder.comment=µû½×
+mediafolder.htmltitle = \u5a92\u9ad4\u8cc7\u6599\u593e
+mediafolder.date = \u65e5\u671f
+mediafolder.name = \u540d\u7a31
+mediafolder.location = \u5730\u9ede
+mediafolder.keywords = \u95dc\u9375\u5b57
+mediafolder.comment = \u8a55\u8ad6
 
-mediafolderlist.htmltitle=´CÅé¸ê®Æ§¨ªí
+mediafolderlist.htmltitle = \u5a92\u9ad4\u8cc7\u6599\u593e\u8868
 
 # message
-message.htmltitle=°T®§
-message.date=¤é´Á
-message.title=¼ÐÃD
-message.creator=§@ªÌ
-message.text=¤º¤å
-message.textinfo=(³Ì¦h¤­¦æ/300¦r)
+message.htmltitle = \u8a0a\u606f
+message.date = \u65e5\u671f
+message.title = \u6a19\u984c
+message.creator = \u4f5c\u8005
+message.text = \u5167\u6587
+message.textinfo = (\u6700\u591a\u4e94\u884c/300\u5b57)
 
-messagelist.htmltitle=°T®§ªí
+messagelist.htmltitle = \u8a0a\u606f\u8868
 
 # feature
-#feature.htmltitle=±MÃD
-#feature.title=¼ÐÃD
-#feature.published=¤wµoªí
-#feature.is_published=¥¿µoªí
-#feature.is_not_published=©|¥¼µoªí
-#feature.filename=ÀɦW
-#feature.abstract=ºK­n
-#feature.link=³sµ²
-#featurelist.htmltitle=±MÃDªí
+#feature.htmltitle=??
+#feature.title=??
+#feature.published=???
+#feature.is_published=???
+#feature.is_not_published=????
+#feature.filename=??
+#feature.abstract=??
+#feature.link=??
+#featurelist.htmltitle=???
 
 # admin start page
-start.htmltitle=¦æ¬F
-start.openpostings.title=¶}³õ¤å
-start.comments.title=<µû½×>
-start.breaking.title=<·s»D§Ö³ø>
-start.breaking.new=·s·s»D§Ö³ø
-start.content.title=<½Z>
-start.content.new=·sº`
-start.show=¨q
-start.content.newswire=³q°T½Z
-start.content.feature=±MÃD
-start.content.topicspecial=¯S§OijÃD
-start.content.startspecial=°_ÂI­¶-¯SÃD
-start.content.hidden=ÂýZ
-start.content.not_published=(©|)¥¼µoªí½Z¥ó
-start.content.with_media=§t´CÅé
-start.content.last_changes=³Ì·s­×§ï
-start.content.with_comments=§t¤º³¡µû½×
-start.content.all=¥þ³¡¤å³¹
-start.content.search=·j´M
-start.allarticlesoftype=Æ[¬Ý "{0}" ¤å³¹
-
-
-start.producers.title=<¤â°Ê²£¥Í>
-start.producers.produceAllNew=²£¥Í©Ò¦³·s½Z
-start.producers.advanced=¶i¶¥ºô­¶ (½Ð¯S§O¤p¤ß¨Ï¥Î!)
-
-#start.coverage.title=<³ø¾É>
-start.topics.title=<¥DÃD>
-start.images.title=<¼v¹³>
-start.video.title=<¼v­µ>
-start.audio.title=<Án­µ>
-start.other_media.title=<¨ä¥L´CÅé>
-start.mediafolder.title=<´CÅé¸ê®Æ§¨>
-start.languages.title=<¤¤¤å>
-start.imcs.title=À³»¼´CIMCS
-start.messageboard.title=¤º³¡°T®§ª©
-start.messageboard.no_messages=µL°T®§
-
-start.superusermenu=ºÞ²zªÌÅv­­(½Ð¤p¤ß!)
-
-start.editfiles.title=½s¿èÀÉ®×
-start.editfiles.include=§t¤JÀÉ®×
+start.htmltitle = \u884c\u653f
+start.openpostings.title = \u958b\u5834\u6587
+start.comments.title = <\u8a55\u8ad6>
+start.breaking.title = <\u65b0\u805e\u5feb\u5831>
+start.breaking.new = \u65b0\u65b0\u805e\u5feb\u5831
+start.content.title = <\u7a3f>
+start.content.new = \u65b0\u69c1
+start.show = \u79c0
+start.content.newswire = \u901a\u8a0a\u7a3f
+start.content.feature = \u5c08\u984c
+start.content.topicspecial = \u7279\u5225\u8b70\u984c
+start.content.startspecial = \u8d77\u9ede\u9801-\u7279\u984c
+start.content.hidden = \u85cf\u7a3f
+start.content.not_published = (\u5c1a)\u672a\u767c\u8868\u7a3f\u4ef6
+start.content.with_media = \u542b\u5a92\u9ad4
+start.content.last_changes = \u6700\u65b0\u4fee\u6539
+start.content.with_comments = \u542b\u5167\u90e8\u8a55\u8ad6
+start.content.all = \u5168\u90e8\u6587\u7ae0
+start.content.search = \u641c\u5c0b
+start.allarticlesoftype = \u89c0\u770b "{0}" \u6587\u7ae0
+
+
+start.producers.title = <\u624b\u52d5\u7522\u751f>
+start.producers.produceAllNew = \u7522\u751f\u6240\u6709\u65b0\u7a3f
+start.producers.advanced = \u9032\u968e\u7db2\u9801 (\u8acb\u7279\u5225\u5c0f\u5fc3\u4f7f\u7528!)
+
+#start.coverage.title=<??>
+start.topics.title = <\u4e3b\u984c>
+start.images.title = <\u5f71\u50cf>
+start.video.title = <\u5f71\u97f3>
+start.audio.title = <\u8072\u97f3>
+start.other_media.title = <\u5176\u4ed6\u5a92\u9ad4>
+start.mediafolder.title = <\u5a92\u9ad4\u8cc7\u6599\u593e>
+start.languages.title = <\u4e2d\u6587>
+start.imcs.title = \u61c9\u905e\u5a92IMCS
+start.messageboard.title = \u5167\u90e8\u8a0a\u606f\u7248
+start.messageboard.no_messages = \u7121\u8a0a\u606f
+
+start.superusermenu = \u7ba1\u7406\u8005\u6b0a\u9650(\u8acb\u5c0f\u5fc3!)
+
+start.editfiles.title = \u7de8\u8f2f\u6a94\u6848
+start.editfiles.include = \u542b\u5165\u6a94\u6848
 
 # topic
-topic.htmltitle=¥DÃD
-topic.title=¦WºÙ
-topic.description=´y­z
-topic.filename=ÀɦW
-topic.main_url=¥D­n¸ê°Tºô§}
-topic.archive_url=¨åÂúô§}
-
-topiclist.htmltitle=¥DÃDªí
-
+topic.htmltitle = \u4e3b\u984c
+topic.title = \u540d\u7a31
+topic.description = \u63cf\u8ff0
+topic.filename = \u6a94\u540d
+topic.main_url = \u4e3b\u8981\u8cc7\u8a0a\u7db2\u5740
+topic.archive_url = \u5178\u85cf\u7db2\u5740
+
+topiclist.htmltitle = \u4e3b\u984c\u8868
+\ufffd = 
 # users
-user.htmltitle=¥ÎªÌ
-user.login=µn¤J
-user.password=±K½X
-user.admin=¦æ¬FªÌ
+user.htmltitle = \u7528\u8005
+user.login = \u767b\u5165
+user.password = \u5bc6\u78bc
+user.admin = \u884c\u653f\u8005
 
-userlist.htmltitle=¥ÎªÌªí
+userlist.htmltitle = \u7528\u8005\u8868
 
-articletype.htmltitle=Article type
-articletype.id=id
-articletype.name=Name
+articletype.htmltitle = Article type
+articletype.id = id
+articletype.name = Name
 
-articletypelist.htmltitle=Article types
+articletypelist.htmltitle = Article types
 
-commentstatus.htmltitle=Comment status
-commentstatus.id=id
-commentstatus.name=Name
+commentstatus.htmltitle = Comment status
+commentstatus.id = id
+commentstatus.name = Name
 
-commentstatuslist.htmltitle=Comment status values
+commentstatuslist.htmltitle = Comment status values
 
 
 #file editing
@@ -302,34 +300,34 @@ fileedit.htmltitle = Edit file
 
 
 # head
-head.start=¶}©l
-head.logout=µn¥X
-head.help=¨D§U
-head.search=·j´M
-head.logged_in=¤w¦¨¥\µn¤J
+head.start = \u958b\u59cb
+head.logout = \u767b\u51fa
+head.help = \u6c42\u52a9
+head.search = \u641c\u5c0b
+head.logged_in = \u5df2\u6210\u529f\u767b\u5165
 
 # foot
-foot.top=ÀY
+foot.top = \u982d
 
 
 
 
-producer.producer = »s§@¤H
-producer.verb.name = ¥ô°È¦W
-producer.verb.description = ¥ô°È´y­z
-producer.verb.enqueue = ¾Þ§@¦C(?hanteng)
+producer.producer = \u88fd\u4f5c\u4eba
+producer.verb.name = \u4efb\u52d9\u540d
+producer.verb.description = \u4efb\u52d9\u63cf\u8ff0
+producer.verb.enqueue = \u64cd\u4f5c\u5217(?hanteng)
 
-producer.job.name = ¨BÆJ¦W
-producer.job.status = ª¬ºA
-producer.job.date = ¤W¦¸­×§ï
-producer.job.cancel = ºM
-producer.job.abort = ¸õ
+producer.job.name = \u6b65\u9a5f\u540d
+producer.job.status = \u72c0\u614b
+producer.job.date = \u4e0a\u6b21\u4fee\u6539
+producer.job.cancel = \u64a4
+producer.job.abort = \u8df3
 
-producer.jobqueue.title = ¥Ø«e¨BÆJ
-producer.jobqueue.refresh = ­«¾ã
-producer.producerlist.title = ·s¼W¨BÆJ
+producer.jobqueue.title = \u76ee\u524d\u6b65\u9a5f
+producer.jobqueue.refresh = \u91cd\u6574
+producer.producerlist.title = \u65b0\u589e\u6b65\u9a5f
 
-producerqueue.htmltitle = ¤â°Ê²£¥Í
+producerqueue.htmltitle = \u624b\u52d5\u7522\u751f
 
 superusermenu.htmltitle = Super-user functions
 superusermenu.topics = Manage topics
@@ -341,30 +339,28 @@ superusermenu.imcs = Manage IMCS (obsolete)
 
 
 # Article types
-articletypes.openposting=Open posting
-articletypes.newswire=Newswire
-articletypes.feature=Feature
-articletypes.topicspecial=Topic-special
-articletypes.startspecial=Startpage-special
+articletypes.openposting = Open posting
+articletypes.newswire = Newswire
+articletypes.feature = Feature
+articletypes.topicspecial = Topic-special
+articletypes.startspecial = Startpage-special
 
 # Comment status values
-commentstatus.normal=Normal
+commentstatus.normal = Normal
 
 
 ########## error ##########
 
-error.htmltitle=¥Xºl¤F...¨t²Î
-error.title=¨t²Î¥Xºl...
-error.text=·|µo¥Í.. §Y¨Ï¥H¤Uªº¿ù»~°T®§±z¤£¯àÁA¸Ñ, ¦ý¦³¥i¯à¹ï<a href="mailto:{0}">{1}</a>¦³À°§U:
-error.text2=³Â·Ð±z±H¤@«Ê«H±N<font color="Red">¬õ¦âªº°T®§</font>¤ÎÃö©ó¾É­P¦¹¿ù»~ªº¬ÛÃö°Ê§@»¡©ú, ±Hµ¹<a href="mailto:{0}">{1}</a>. ·PÁ±z!
-
-usererror.htmltitle=¬dÃÒ¿ù»~
-usererror.title=¬dÃÒ¿ù»~
-usererror.text=±zªº¿é¤J¾É­P¥H¤Uªº¿ù»~:
-usererror.what_to_do=½Ð«ö¤U<°h>Áä, ¦A¸Õ¤@¦¸Ð
+error.htmltitle = \u51fa\u69cc\u4e86...\u7cfb\u7d71
+error.title = \u7cfb\u7d71\u51fa\u69cc...
+error.text = \u6703\u767c\u751f.. \u5373\u4f7f\u4ee5\u4e0b\u7684\u932f\u8aa4\u8a0a\u606f\u60a8\u4e0d\u80fd\u77ad\u89e3, \u4f46\u6709\u53ef\u80fd\u5c0d<a href="mailto:{0}">{1}</a>\u6709\u5e6b\u52a9:
+error.text2 = \u9ebb\u7169\u60a8\u5bc4\u4e00\u5c01\u4fe1\u5c07<font color="Red">\u7d05\u8272\u7684\u8a0a\u606f</font>\u53ca\u95dc\u65bc\u5c0e\u81f4\u6b64\u932f\u8aa4\u7684\u76f8\u95dc\u52d5\u4f5c\u8aaa\u660e, \u5bc4\u7d66<a href="mailto:{0}">{1}</a>. \u611f\u8b1d\u60a8!
 
+usererror.htmltitle = \u67e5\u8b49\u932f\u8aa4
+usererror.title = \u67e5\u8b49\u932f\u8aa4
+usererror.text = \u60a8\u7684\u8f38\u5165\u5c0e\u81f4\u4ee5\u4e0b\u7684\u932f\u8aa4:
+usererror.what_to_do = \u8acb\u6309\u4e0b<\u9000>\u9375, \u518d\u8a66\u4e00\u6b21\ufffd
 
-infomessage.title = ¸ê°T»¡©ú
-infomessage.produceAllNewAddedToQueue = ±zªº­n¨D¤w¦b§Ú­Ìªº¤u§@¶µ¥Ø¤¤.
+infomessage.title = \u8cc7\u8a0a\u8aaa\u660e
+infomessage.produceAllNewAddedToQueue = \u60a8\u7684\u8981\u6c42\u5df2\u5728\u6211\u5011\u7684\u5de5\u4f5c\u9805\u76ee\u4e2d.
 
-htmlcharset=big5
index b4a880b..2e4d0e6 100755 (executable)
@@ -1,34 +1,34 @@
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
 import java.io.IOException;\r
 import java.io.PrintWriter;\r
 import java.lang.reflect.Method;\r
@@ -62,418 +62,435 @@ import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleUserExc;\r
 import mir.util.ExceptionFunctions;\r
 import mir.util.StringRoutines;\r
+import mir.util.*;\r
+import mir.entity.*;\r
+import mir.entity.adapter.*;\r
 import mircoders.entity.EntityUsers;\r
 import mircoders.global.MirGlobal;\r
 import mircoders.module.ModuleMessage;\r
 import mircoders.module.ModuleUsers;\r
 import mircoders.storage.DatabaseArticleType;\r
 import mircoders.storage.DatabaseMessages;\r
-import mircoders.storage.DatabaseUsers;
-
-
-
-
-/**
- * Mir.java - main servlet, that dispatches to servletmodules
- *
- * @author $Author: zapata $
- * @version $Id: Mir.java,v 1.41 2003/03/17 20:47:03 zapata Exp $
- *
- */
-public class Mir extends AbstractServlet {
-  private static ModuleUsers usersModule = null;
-  private static ModuleMessage messageModule = null;
-  private final static Map servletModuleInstanceHash = new HashMap();
-
-  //I don't know about making this static cause it removes the
-  //possibility to change the config on the fly.. -mh
-  private static List loginLanguages = null;
-  public HttpSession session;
-
-  protected TemplateModel getLoginLanguages() throws ServletException {
-    synchronized (Mir.class) {
-      try {
-        if (loginLanguages == null) {
-          MessageResources messageResources2 =
-            MessageResources.getMessageResources("bundles.admin");
-          MessageResources messageResources =
-            MessageResources.getMessageResources("bundles.adminlocal");
-          List languages =
-            StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";");
-
-          loginLanguages = new Vector();
-
-          Iterator i = languages.iterator();
-
-          while (i.hasNext()) {
-            String code = (String) i.next();
-            Locale locale = new Locale(code, "");
-            String name = messageResources.getMessage(locale, "languagename");
-
-            if (name == null) {
-              name = messageResources2.getMessage(locale, "languagename");
-            }
-
-            if (name == null) {
-              name = code;
-            }
-
-            Map record = new HashMap();
-            record.put("name", name);
-            record.put("code", code);
-            loginLanguages.add(record);
-          }
-        }
-
-        return FreemarkerGenerator.makeAdapter(loginLanguages);
-      }
-      catch (Throwable t) {
-        throw new ServletException(t.getMessage());
-      }
-    }
-  }
-
-  // FIXME: this should probalby go into AbstractServlet so it can be used in
-  // OpenMir as well -mh
-  protected String getDefaultLanguage(HttpServletRequest aRequest) {
-    String defaultlanguage =
-      MirGlobal.config().getString("Mir.Login.DefaultLanguage", "");
-
-    if (defaultlanguage.length() == 0) {
-      Locale locale = aRequest.getLocale();
-      defaultlanguage = locale.getLanguage();
-    }
-
-    return defaultlanguage;
-  }
-
-  public void process(HttpServletRequest aRequest, HttpServletResponse aResponse)
-    throws ServletException, IOException, UnavailableException {
-    long startTime = System.currentTimeMillis();
-    long sessionConnectTime = 0;
-    EntityUsers userEntity;
-    String http = "";
-
-    configuration.addProperty("ServletName", getServletName());
-
-    session = aRequest.getSession(true);
-    userEntity = (EntityUsers) session.getAttribute("login.uid");
-
-    if (aRequest.getServerPort() == 443) {
-      http = "https";
-    } else {
-      http = "http";
-    }
-
-    //make sure client browsers don't cache anything
-    setNoCaching(aResponse);
-
-    //FIXME: this seems kind of hackish and only here because we can have
-    // default other than the one that the browser is set to.
-    Locale locale = new Locale(getDefaultLanguage(aRequest), "");
-    MessageResources messageResources =
-      MessageResources.getMessageResources("bundles.admin");
-    String htmlcharset = messageResources.getMessage(locale, "htmlcharset");
-
-    aResponse.setContentType("text/html; charset=" + htmlcharset);
-
-    String moduleName = aRequest.getParameter("module");
-    checkLanguage(session, aRequest);
-
-    /** @todo for cleanup and readability this should be moved to
-     *  method loginIfNecessary() */
-    if ((moduleName != null) && moduleName.equals("direct")) {
-      //...
-    }
-
-    // Authentication
-    if (((moduleName != null) && moduleName.equals("login")) ||
-        (userEntity == null)) {
-      String user = aRequest.getParameter("login");
-      String passwd = aRequest.getParameter("password");
-      logger.debug("--login: evaluating for user: " + user);
-      userEntity = allowedUser(user, passwd);
-
-      if (userEntity == null) {
-        // login failed: redirecting to login
-        logger.warn("--login: failed!");
-        _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
-
-        return;
-      } else if ((moduleName != null) && moduleName.equals("login")) {
-        // login successful
-        logger.info("--login: successful! setting uid: " + userEntity.getId());
-        session.setAttribute("login.uid", userEntity);
-        logger.debug("--login: trying to retrieve login.target");
-
-        String target = (String) session.getAttribute("login.target");
-
-        if (target != null) {
-          logger.debug("Redirect: " + target);
-
-          int serverPort = aRequest.getServerPort();
-          String redirect = "";
-          String redirectString = "";
-
-          if (serverPort == 80) {
-            redirect =
-              aResponse.encodeURL(http + "://" + aRequest.getServerName() + target);
-            redirectString =
-              "<html><head><meta http-equiv=refresh content=\"1;URL=" +
-              redirect + "\"></head><body>going <a href=\"" + redirect +
-              "\">Mir</a></body></html>";
-          } else {
-            redirect =
-              aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" +
-                aRequest.getServerPort() + target);
-            redirectString =
-              "<html><head><meta http-equiv=refresh content=\"1;URL=" +
-              redirect + "\"></head><body>going <a href=\"" + redirect +
-              "\">Mir</a></body></html>";
-          }
-
-          aResponse.getWriter().println(redirectString);
-
-          //aResponse.sendRedirect(redirect);
-        } else {
-          // redirecting to default target
-          logger.debug("--login: no target - redirecting to default");
-          _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);
-        }
-
-        return;
-      }
-       // if login succesful
-    }
-     // if login
-
-    if ((moduleName != null) && moduleName.equals("logout")) {
-      logger.info("--logout");
-      session.invalidate();
-
-      //session = aRequest.getSession(true);
-      //checkLanguage(session, aRequest);
-      _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
-
-      return;
-    }
-
-    // Check if authed!
-    if (userEntity == null) {
-      // redirect to loginpage
-      String redirectString = aRequest.getRequestURI();
-      String queryString = aRequest.getQueryString();
-
-      if ((queryString != null) && !queryString.equals("")) {
-        redirectString += ("?" + aRequest.getQueryString());
-        logger.debug("STORING: " + redirectString);
-        session.setAttribute("login.target", redirectString);
-      }
-
-      _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
-
-      return;
-    }
-
-    // If no module is specified goto standard startpage
-    if ((moduleName == null) || moduleName.equals("")) {
-      logger.debug("no module: redirect to standardpage");
-      _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);
-
-      return;
-    }
-
-    // end of auth
-    // From now on regular dispatching...
-    try {
-      // get servletmodule by parameter and continue with dispacher
-      ServletModule smod = getServletModuleForName(moduleName);
-      ServletModuleDispatch.dispatch(smod, aRequest, aResponse);
-    }
-    catch (Throwable e) {
-      Throwable cause = ExceptionFunctions.traceCauseException(e);
-
-      if (cause instanceof ServletModuleUserExc)
-        handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause);
-      else
-        handleError(aRequest, aResponse, aResponse.getWriter(), cause);
-
-    }
-
-    // timing...
-    sessionConnectTime = System.currentTimeMillis() - startTime;
-    logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms");
-  }
-
-  /**
-   *  Private method getServletModuleForName returns ServletModule
-   *  from Cache
-   *
-   * @param moduleName
-   * @return ServletModule
-   *
-   */
-  private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc {
-    // Instance in Map ?
-    if (!servletModuleInstanceHash.containsKey(moduleName)) {
-      // was not found in hash...
-      try {
-        Class theServletModuleClass = null;
-
-        try {
-          // first we try to get ServletModule from stern.che3.servlet
-          theServletModuleClass =
-            Class.forName("mircoders.servlet.ServletModule" + moduleName);
-        } catch (ClassNotFoundException e) {
-          // on failure, we try to get it from lib-layer
-          theServletModuleClass =
-            Class.forName("mir.servlet.ServletModule" + moduleName);
-        }
-
-        Method m = theServletModuleClass.getMethod("getInstance", null);
-        ServletModule smod = (ServletModule) m.invoke(null, null);
-
-        // we put it into map for further reference
-        servletModuleInstanceHash.put(moduleName, smod);
-
-        return smod;
-      }
-      catch (Exception e) {
-        throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());
-      }
-    }
-    else {
-      return (ServletModule) servletModuleInstanceHash.get(moduleName);
-    }
-  }
-
-  private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,
-                               PrintWriter out, ServletModuleUserExc anException) {
-    try {
-      logger.info("user error: " + anException.getMessage());
-      SimpleHash modelRoot = new SimpleHash();
-      MessageResources messages = MessageResources.getMessageResources("bundles.admin");
-      modelRoot.put("errorstring",
-          new SimpleScalar(
-              messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())
-          ));
-      modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
-      HTMLTemplateProcessor.process(
-          aResponse,MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),
-          modelRoot, out, getLocale(aRequest));
-      out.close();
-    }
-    catch (Exception e) {
-      logger.error("Error in UserErrorTemplate");
-    }
-
-  }
-
-  private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {
-
-    try {
-      logger.error("error: " + anException);
-      SimpleHash modelRoot = new SimpleHash();
-      modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));
-      modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(
-                                               new GregorianCalendar())));
-      HTMLTemplateProcessor.process(aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"),
-                                    modelRoot,out, getLocale(aRequest));
-      out.close();
-    }
-    catch (Exception e) {
-      logger.error("Error in ErrorTemplate");
-    }
-  }
-
-  /**
-   *  evaluate login for user / password
-   */
-  protected EntityUsers allowedUser(String user, String password) {
-    try {
-      if (usersModule == null) {
-        usersModule = new ModuleUsers(DatabaseUsers.getInstance());
-      }
-
-      return usersModule.getUserForLogin(user, password);
-    }
-    catch (Exception e) {
-      logger.debug(e.getMessage());
-      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
-      return null;
-    }
-  }
-
-  // Redirect-methods
-  private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest,
-    PrintWriter out) {
-    String loginTemplate = configuration.getString("Mir.LoginTemplate");
-    String sessionUrl = aResponse.encodeURL("");
-
-    try {
-      SimpleHash mergeData = new SimpleHash();
-      SimpleList languages = new SimpleList();
-
-      mergeData.put("session", sessionUrl);
-
-      mergeData.put("defaultlanguage", getDefaultLanguage(aRequest));
-      mergeData.put("languages", getLoginLanguages());
-
-      HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, out,
-        getLocale(aRequest));
-    }
-    catch (Throwable e) {
-      handleError(aRequest, aResponse, out, e);
-    }
-  }
-
-  private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest,
-    PrintWriter out, EntityUsers userEntity) {
-    String startTemplate = "start_admin.template";
-    String sessionUrl = aResponse.encodeURL("");
-
-    try {
-      // merge with logged in user and messages
-      SimpleHash mergeData = new SimpleHash();
-      mergeData.put("session", sessionUrl);
-      mergeData.put("login_user", userEntity);
-
-      if (messageModule == null) {
-        messageModule = new ModuleMessage(DatabaseMessages.getInstance());
-      }
-
-      mergeData.put("messages",
-        messageModule.getByWhereClause(null, "webdb_create desc", 0, 10));
-
-      mergeData.put("articletypes",
-        DatabaseArticleType.getInstance().selectByWhereClause("", "id", 0, 20));
-
-      HTMLTemplateProcessor.process(aResponse, startTemplate, mergeData, out,
-        getLocale(aRequest));
-    }
-    catch (Exception e) {
-      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-      handleError(aRequest, aResponse, out, e);
-    }
-  }
-
-  public String getServletInfo() {
-    return "Mir " + configuration.getString("Mir.Version");
-  }
-
-  private void checkLanguage(HttpSession session, HttpServletRequest aRequest) {
-    // a lang parameter always sets the language
-    String lang = aRequest.getParameter("language");
-
-    if (lang != null) {
-      logger.info("selected language " + lang + " overrides accept-language");
-      setLanguage(session, lang);
-    }
-    // otherwise store language from accept header in session
-    else if (session.getAttribute("language") == null) {
-      logger.info("accept-language is " + aRequest.getLocale().getLanguage());
-      setLanguage(session, aRequest.getLocale().getLanguage());
-    }
-  }
-}
+import mircoders.storage.DatabaseUsers;\r
+import mircoders.servlet.*;\r
+\r
+\r
+\r
+\r
+/**\r
+ * Mir.java - main servlet, that dispatches to servletmodules\r
+ *\r
+ * @author $Author: zapata $\r
+ * @version $Id: Mir.java,v 1.42 2003/04/09 02:06:06 zapata Exp $\r
+ *\r
+ */\r
+public class Mir extends AbstractServlet {\r
+  private static ModuleUsers usersModule = null;\r
+  private static ModuleMessage messageModule = null;\r
+  private final static Map servletModuleInstanceHash = new HashMap();\r
+  private static Locale fallbackLocale = null;\r
+\r
+  //I don't know about making this static cause it removes the\r
+  //possibility to change the config on the fly.. -mh\r
+  private static List loginLanguages = null;\r
+\r
+  protected TemplateModel getLoginLanguages() throws ServletException {\r
+    synchronized (Mir.class) {\r
+      try {\r
+        if (loginLanguages == null) {\r
+          MessageResources messageResources =\r
+            MessageResources.getMessageResources("bundles.adminlocal");\r
+          MessageResources messageResources2 =\r
+            MessageResources.getMessageResources("bundles.admin");\r
+\r
+          List languages =\r
+            StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";");\r
+\r
+          loginLanguages = new Vector();\r
+\r
+          Iterator i = languages.iterator();\r
+\r
+          while (i.hasNext()) {\r
+            String code = (String) i.next();\r
+            Locale locale = new Locale(code, "");\r
+            String name = messageResources.getMessage(locale, "languagename");\r
+\r
+            if (name == null) {\r
+              name = messageResources2.getMessage(locale, "languagename");\r
+            }\r
+\r
+            if (name == null) {\r
+              name = code;\r
+            }\r
+\r
+            Map record = new HashMap();\r
+            record.put("name", name);\r
+            record.put("code", code);\r
+            loginLanguages.add(record);\r
+          }\r
+        }\r
+\r
+        return FreemarkerGenerator.makeAdapter(loginLanguages);\r
+      }\r
+      catch (Throwable t) {\r
+        throw new ServletException(t.getMessage());\r
+      }\r
+    }\r
+  }\r
+\r
+  // FIXME: this should probalby go into AbstractServlet so it can be used in\r
+  // OpenMir as well -mh\r
+  protected String getDefaultLanguage(HttpServletRequest aRequest) {\r
+    String defaultlanguage =\r
+      MirGlobal.config().getString("Mir.Login.DefaultLanguage", "");\r
+\r
+    if (defaultlanguage.length() == 0) {\r
+      Locale locale = aRequest.getLocale();\r
+      defaultlanguage = locale.getLanguage();\r
+    }\r
+\r
+    return defaultlanguage;\r
+  }\r
+\r
+  protected synchronized Locale getFallbackLocale() throws ServletException {\r
+    try {\r
+      if (fallbackLocale == null) {\r
+        fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), "");\r
+      }\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ServletException(t.getMessage());\r
+    }\r
+\r
+    return fallbackLocale;\r
+  }\r
+\r
+  public void process(HttpServletRequest aRequest, HttpServletResponse aResponse)\r
+    throws ServletException, IOException, UnavailableException {\r
+    long startTime = System.currentTimeMillis();\r
+    long sessionConnectTime = 0;\r
+    EntityUsers userEntity;\r
+    HttpSession session;\r
+    String http = "";\r
+\r
+    configuration.addProperty("ServletName", getServletName());\r
+\r
+    session = aRequest.getSession(true);\r
+    userEntity = (EntityUsers) session.getAttribute("login.uid");\r
+\r
+    if (aRequest.getServerPort() == 443) {\r
+      http = "https";\r
+    } else {\r
+      http = "http";\r
+    }\r
+\r
+    //make sure client browsers don't cache anything\r
+    setNoCaching(aResponse);\r
+\r
+    //FIXME: this seems kind of hackish and only here because we can have\r
+    // default other than the one that the browser is set to.\r
+    Locale locale = new Locale(getDefaultLanguage(aRequest), "");\r
+    MessageResources messageResources =\r
+      MessageResources.getMessageResources("bundles.admin");\r
+    String htmlcharset = messageResources.getMessage(locale, "htmlcharset");\r
+\r
+    aResponse.setContentType("text/html; charset=" + htmlcharset);\r
+\r
+    String moduleName = aRequest.getParameter("module");\r
+    checkLanguage(session, aRequest);\r
+\r
+\r
+\r
+    // Authentication\r
+    if (((moduleName != null) && moduleName.equals("login")) ||\r
+        (userEntity == null)) {\r
+      String user = aRequest.getParameter("login");\r
+      String passwd = aRequest.getParameter("password");\r
+      logger.debug("--login: evaluating for user: " + user);\r
+      userEntity = allowedUser(user, passwd);\r
+\r
+      if (userEntity == null) {\r
+        // login failed: redirecting to login\r
+        logger.warn("--login: failed!");\r
+        _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
+\r
+        return;\r
+      }\r
+      else if ((moduleName != null) && moduleName.equals("login")) {\r
+        // login successful\r
+        logger.info("--login: successful! setting uid: " + userEntity.getId());\r
+        session.setAttribute("login.uid", userEntity);\r
+        logger.debug("--login: trying to retrieve login.target");\r
+\r
+        String target = (String) session.getAttribute("login.target");\r
+\r
+        if (target != null) {\r
+          logger.debug("Redirect: " + target);\r
+\r
+          int serverPort = aRequest.getServerPort();\r
+          String redirect = "";\r
+          String redirectString = "";\r
+\r
+          if (serverPort == 80) {\r
+            redirect =\r
+              aResponse.encodeURL(http + "://" + aRequest.getServerName() + target);\r
+            redirectString =\r
+              "<html><head><meta http-equiv=refresh content=\"1;URL=" +\r
+              redirect + "\"></head><body>going <a href=\"" + redirect +\r
+              "\">Mir</a></body></html>";\r
+          } else {\r
+            redirect =\r
+              aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" +\r
+                aRequest.getServerPort() + target);\r
+            redirectString =\r
+              "<html><head><meta http-equiv=refresh content=\"1;URL=" +\r
+              redirect + "\"></head><body>going <a href=\"" + redirect +\r
+              "\">Mir</a></body></html>";\r
+          }\r
+\r
+          aResponse.getWriter().println(redirectString);\r
+\r
+          //aResponse.sendRedirect(redirect);\r
+        } else {\r
+          // redirecting to default target\r
+          logger.debug("--login: no target - redirecting to default");\r
+          _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);\r
+        }\r
+\r
+        return;\r
+      }\r
+       // if login succesful\r
+    }\r
+     // if login\r
+\r
+    if ((moduleName != null) && moduleName.equals("logout")) {\r
+      logger.info("--logout");\r
+      session.invalidate();\r
+\r
+      //session = aRequest.getSession(true);\r
+      //checkLanguage(session, aRequest);\r
+      _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
+\r
+      return;\r
+    }\r
+\r
+    // Check if authed!\r
+    if (userEntity == null) {\r
+      // redirect to loginpage\r
+      String redirectString = aRequest.getRequestURI();\r
+      String queryString = aRequest.getQueryString();\r
+\r
+      if ((queryString != null) && !queryString.equals("")) {\r
+        redirectString += ("?" + aRequest.getQueryString());\r
+        logger.debug("STORING: " + redirectString);\r
+        session.setAttribute("login.target", redirectString);\r
+      }\r
+\r
+      _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
+\r
+      return;\r
+    }\r
+\r
+    // If no module is specified goto standard startpage\r
+    if ((moduleName == null) || moduleName.equals("")) {\r
+      logger.debug("no module: redirect to standardpage");\r
+      _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);\r
+\r
+      return;\r
+    }\r
+\r
+    // end of auth\r
+    // From now on regular dispatching...\r
+    try {\r
+      // get servletmodule by parameter and continue with dispacher\r
+      ServletModule smod = getServletModuleForName(moduleName);\r
+      ServletModuleDispatch.dispatch(smod, aRequest, aResponse);\r
+    }\r
+    catch (Throwable e) {\r
+      Throwable cause = ExceptionFunctions.traceCauseException(e);\r
+\r
+      if (cause instanceof ServletModuleUserExc)\r
+        handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause);\r
+      else\r
+        handleError(aRequest, aResponse, aResponse.getWriter(), cause);\r
+\r
+    }\r
+\r
+    // timing...\r
+    sessionConnectTime = System.currentTimeMillis() - startTime;\r
+    logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms");\r
+  }\r
+\r
+  /**\r
+   *  Private method getServletModuleForName returns ServletModule\r
+   *  from Cache\r
+   *\r
+   * @param moduleName\r
+   * @return ServletModule\r
+   *\r
+   */\r
+  private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc {\r
+    // Instance in Map ?\r
+    if (!servletModuleInstanceHash.containsKey(moduleName)) {\r
+      // was not found in hash...\r
+      try {\r
+        Class theServletModuleClass = null;\r
+\r
+        try {\r
+          // first we try to get ServletModule from stern.che3.servlet\r
+          theServletModuleClass =\r
+            Class.forName("mircoders.servlet.ServletModule" + moduleName);\r
+        } catch (ClassNotFoundException e) {\r
+          // on failure, we try to get it from lib-layer\r
+          theServletModuleClass =\r
+            Class.forName("mir.servlet.ServletModule" + moduleName);\r
+        }\r
+\r
+        Method m = theServletModuleClass.getMethod("getInstance", null);\r
+        ServletModule smod = (ServletModule) m.invoke(null, null);\r
+\r
+        // we put it into map for further reference\r
+        servletModuleInstanceHash.put(moduleName, smod);\r
+\r
+        return smod;\r
+      }\r
+      catch (Exception e) {\r
+        throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());\r
+      }\r
+    }\r
+    else {\r
+      return (ServletModule) servletModuleInstanceHash.get(moduleName);\r
+    }\r
+  }\r
+\r
+  private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,\r
+                               PrintWriter out, ServletModuleUserExc anException) {\r
+    try {\r
+      logger.info("user error: " + anException.getMessage());\r
+      SimpleHash modelRoot = new SimpleHash();\r
+      MessageResources messages = MessageResources.getMessageResources("bundles.admin");\r
+      modelRoot.put("errorstring",\r
+          new SimpleScalar(\r
+              messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())\r
+          ));\r
+      modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));\r
+      HTMLTemplateProcessor.process(\r
+          aResponse,\r
+          MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),\r
+          modelRoot,\r
+          null,\r
+          out,\r
+          getLocale(aRequest),\r
+          fallbackLocale);\r
+      out.close();\r
+    }\r
+    catch (Exception e) {\r
+      logger.error("Error in UserErrorTemplate");\r
+    }\r
+\r
+  }\r
+\r
+  private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {\r
+\r
+    try {\r
+      logger.error("error: " + anException);\r
+      SimpleHash modelRoot = new SimpleHash();\r
+      modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));\r
+      modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(\r
+                                               new GregorianCalendar())));\r
+      HTMLTemplateProcessor.process(\r
+          aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"),\r
+          modelRoot,null,out, getLocale(aRequest), getFallbackLocale());\r
+      out.close();\r
+    }\r
+    catch (Exception e) {\r
+      logger.error("Error in ErrorTemplate");\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  evaluate login for user / password\r
+   */\r
+  protected EntityUsers allowedUser(String user, String password) {\r
+    try {\r
+      if (usersModule == null) {\r
+        usersModule = new ModuleUsers(DatabaseUsers.getInstance());\r
+      }\r
+\r
+      return usersModule.getUserForLogin(user, password);\r
+    }\r
+    catch (Exception e) {\r
+      logger.debug(e.getMessage());\r
+      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
+\r
+      return null;\r
+    }\r
+  }\r
+\r
+  // Redirect-methods\r
+  private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest,\r
+    PrintWriter out) {\r
+    String loginTemplate = configuration.getString("Mir.LoginTemplate");\r
+    String sessionUrl = aResponse.encodeURL("");\r
+\r
+    try {\r
+      SimpleHash mergeData = new SimpleHash();\r
+      SimpleList languages = new SimpleList();\r
+\r
+      mergeData.put("session", sessionUrl);\r
+\r
+      mergeData.put("defaultlanguage", getDefaultLanguage(aRequest));\r
+      mergeData.put("languages", getLoginLanguages());\r
+\r
+      HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale());\r
+    }\r
+    catch (Throwable e) {\r
+      handleError(aRequest, aResponse, out, e);\r
+    }\r
+  }\r
+\r
+  private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest,\r
+    PrintWriter out, EntityUsers userEntity) {\r
+    String startTemplate = configuration.getString("Mir.StartTemplate");\r
+    String sessionUrl = aResponse.encodeURL("");\r
+\r
+    try {\r
+      Map mergeData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal");\r
+      mergeData.put("messages",\r
+             new CachingRewindableIterator(\r
+               new EntityIteratorAdapter( "", "webdb_create desc", 10,\r
+                 MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0)));\r
+      mergeData.put("searchvalue", null);\r
+      mergeData.put("searchfield", null);\r
+      mergeData.put("searchispublished", null);\r
+      mergeData.put("searcharticletype", null);\r
+      mergeData.put("searchorder", null);\r
+      mergeData.put("selectarticleurl", null);\r
+\r
+      ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate);\r
+    }\r
+    catch (Exception e) {\r
+      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
+      handleError(aRequest, aResponse, out, e);\r
+    }\r
+  }\r
+\r
+  public String getServletInfo() {\r
+    return "Mir " + configuration.getString("Mir.Version");\r
+  }\r
+\r
+  private void checkLanguage(HttpSession session, HttpServletRequest aRequest) {\r
+    // a lang parameter always sets the language\r
+    String lang = aRequest.getParameter("language");\r
+\r
+    if (lang != null) {\r
+      logger.info("selected language " + lang + " overrides accept-language");\r
+      setLanguage(session, lang);\r
+    }\r
+    // otherwise store language from accept header in session\r
+    else if (session.getAttribute("language") == null) {\r
+      logger.info("accept-language is " + aRequest.getLocale().getLanguage());\r
+      setLanguage(session, aRequest.getLocale().getLanguage());\r
+    }\r
+  }\r
+}\r
index 77807af..f8cc73e 100755 (executable)
  * not wish to do so, delete this exception statement from your version.
  */
 
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-\r
-import mir.servlet.AbstractServlet;\r
-import mir.servlet.ServletModuleDispatch;\r
-import mir.servlet.ServletModuleUserExc;\r
-import mir.util.ExceptionFunctions;\r
-import mircoders.global.MirGlobal;\r
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import mir.servlet.AbstractServlet;
+import mir.servlet.ServletModuleDispatch;
+import mir.servlet.ServletModuleUserExc;
+import mir.util.ExceptionFunctions;
+import mircoders.global.MirGlobal;
 import mircoders.servlet.ServletModuleOpenIndy;
 
 /**
  *  OpenMir.java - main servlet for open posting and comment feature to articles
  *
  *  @author RK 1999-2001, the mir-coders group
- *  @version $Id: OpenMir.java,v 1.30 2003/03/17 20:47:03 zapata Exp $
+ *  @version $Id: OpenMir.java,v 1.31 2003/04/09 02:06:06 zapata Exp $
  *
  */
 
index 39aa89f..bce4ee9 100755 (executable)
@@ -44,7 +44,6 @@ Mir.Public-email.address=mir-coders@lists.indymedia.org
 Mir.Public-email.name=mir-coders mailinglist
 
 Mir.Version=1.1beta
-StandardLanguage=de
 DirectOpenposting=yes
 
 # The name of the abuse config file (relative to the WEB-INF dir)
@@ -76,7 +75,12 @@ Mir.Localizer.ProducerConfigFile=etc/producer/producers.xml
 # If the default language is left empty, it will set the accept-language of
 # the client browser as the default.
 Mir.Login.DefaultLanguage=en
-Mir.Login.Languages=en;nl;de;qu;tr;ay;es;eu
+
+# The available languages in the login form:
+Mir.Login.Languages=en;de;nl;es;pt;eu;sv;tr;zh
+
+# For missing values, the FallbackLanguage is used as default
+Mir.Admin.FallbackLanguage=en
 
 
 # the templates
@@ -292,6 +296,7 @@ ServletModule.OpenIndy.UserErrorTemplate=usererror.template
 Mir.TemplateDir=templates/admin/
 
 Mir.LoginTemplate=login.template
+Mir.StartTemplate=start_admin.template
 
 Mir.ErrorTemplate=error.template
 Mir.UserErrorTemplate=usererror.template
index 84e87b5..d6fb3f2 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-/**\r
- * Base class the entities are derived from. Provides base functionality of\r
- * an entity. Entities are used to represent rows of a database table.<p>\r
- */\r
-\r
-package  mir.entity;\r
-\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectExc;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.TemplateHashModel;\r
-import freemarker.template.TemplateModel;\r
-import freemarker.template.TemplateModelException;\r
-import freemarker.template.TemplateModelRoot;\r
-\r
-/**\r
- * Base Class of Entities\r
- * Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant\r
- *\r
- * @version $Id: Entity.java,v 1.18 2003/03/05 19:23:14 idfx Exp $\r
- * @author rk\r
- *\r
- */\r
-\r
-public class Entity implements TemplateHashModel, TemplateModelRoot\r
-{\r
-  protected static MirPropertiesConfiguration configuration;\r
-\r
-  private boolean changed;\r
-  protected Map theValuesHash; // tablekey / value\r
-  protected StorageObject theStorageObject;\r
-  protected List streamedInput = null;\r
-  protected LoggerWrapper logger;\r
-\r
-  static {\r
-    try {\r
-      configuration = MirPropertiesConfiguration.instance();\r
-    }\r
-    catch (PropertiesConfigExc e) {\r
-      throw new RuntimeException(e.getMessage());\r
-    }\r
-  }\r
-\r
-  public Entity() {\r
-    logger = new LoggerWrapper("Entity");\r
-\r
-    this.changed = false;\r
-  }\r
-\r
-  /**\r
-   * Constructor\r
-   * @param StorageObject The StorageObject of the Entity.\r
-   */\r
-  public Entity(StorageObject StorageObject) {\r
-    this();\r
-    setStorage(StorageObject);\r
-  }\r
-\r
-  /*\r
-   * Sets the StorageObject of the Entity.\r
-   */\r
-  public void setStorage(StorageObject storage) {\r
-    this.theStorageObject = storage;\r
-  }\r
-\r
-  /**\r
-   * Sets the values of the Entity.\r
-   * @param theStringValues Map containing the new values of the Entity\r
-   */\r
-\r
-  public void setValues(Map theStringValues) {\r
-    /** @todo should be synchronized */\r
-    if (theStringValues != null) {\r
-      theValuesHash = new HashMap();\r
-      theValuesHash.putAll(theStringValues);\r
-    }\r
-    else\r
-      logger.warn("Entity.setValues called with null Map");\r
-  }\r
-\r
-  /**\r
-   * Returns whether the content of the Entity has changed.\r
-   * @return true wenn ja, sonst false\r
-   */\r
-  public boolean changed() {\r
-    return changed;\r
-  }\r
-\r
-  /**\r
-   * Returns the primary key of the Entity.\r
-   * @return String Id\r
-   */\r
-  public String getId() {\r
-    return (String) getValue(theStorageObject.getIdName());\r
-  }\r
-\r
-  /**\r
-   * Defines the primary key of the Entity\r
-   * @param id\r
-   */\r
-  public void setId(String id) {\r
-    theValuesHash.put(theStorageObject.getIdName(), id);\r
-  }\r
-\r
-  /**\r
-   * Returns the value of a field by field name.\r
-   * @param field The name of the field\r
-   * @return value of the field\r
-   */\r
-  public String getValue(String field) {\r
-    String returnValue = null;\r
-    if (field != null) {\r
-      if (field.equals("webdb_create_formatted")) {\r
-        if (hasValueForField("webdb_create"))\r
-          returnValue = StringUtil.dateToReadableDate(getValue("webdb_create"));\r
-      }\r
-      else if (field.equals("webdb_lastchange_formatted")) {\r
-        if (hasValueForField("webdb_lastchange"))\r
-          returnValue = StringUtil.dateToReadableDate(getValue(\r
-              "webdb_lastchange"));\r
-      }\r
-      else\r
-        returnValue = (String) theValuesHash.get(field);\r
-    }\r
-    return returnValue;\r
-  }\r
-\r
-  public boolean hasValueForField(String field) {\r
-    if (theValuesHash != null)\r
-      return theValuesHash.containsKey(field);\r
-    return false;\r
-  }\r
-\r
-  /**\r
-   * Insers Entity into the database via StorageObject\r
-   * @return Primary Key of the Entity\r
-   * @exception StorageObjectException\r
-   */\r
-  public String insert() throws StorageObjectExc {\r
-    logger.debug("Entity: trying to insert ...");\r
-    if (theStorageObject != null) {\r
-      return theStorageObject.insert( (Entity)this);\r
-    }\r
-    else\r
-      throw new StorageObjectExc("theStorageObject == null!");\r
-  }\r
-\r
-  /**\r
-   * Saves changes of this Entity to the database\r
-   * @exception StorageObjectException\r
-   */\r
-  public void update() throws StorageObjectFailure {\r
-    theStorageObject.update( (Entity)this);\r
-  }\r
-\r
-  /**\r
-   * Sets the value for a field. Issues a log message if the field name\r
-   * supplied was not found in the Entity.\r
-   * @param theProp The field name whose value has to be set\r
-   * @param theValue The new value of the field\r
-   * @exception StorageObjectException\r
-   */\r
-  public void setValueForProperty(String theProp, String theValue) throws\r
-      StorageObjectFailure {\r
-    this.changed = true;\r
-    if (isField(theProp))\r
-      theValuesHash.put(theProp, theValue);\r
-    else {\r
-      logger.warn("Entity.setValueForProperty: Property not found: " + theProp + " (" + theValue + ")");\r
-    }\r
-\r
-  }\r
-\r
-  /**\r
-   * Returns the field names of the Entity as ArrayListe.\r
-   * @return ArrayList with field names\r
-       * @exception StorageObjectException is throuwn if database access was impossible\r
-   */\r
-  public List getFields() throws StorageObjectFailure {\r
-    return theStorageObject.getFields();\r
-  }\r
-\r
-  /**\r
-   * Returns an int[] with the types of the fields\r
-   * @return int[] that contains the types of the fields\r
-   * @exception StorageObjectException\r
-   */\r
-  public int[] getTypes() throws StorageObjectFailure {\r
-    return theStorageObject.getTypes();\r
-  }\r
-\r
-  /**\r
-   * Returns an ArrayList with field names\r
-   * @return List with field names\r
-   * @exception StorageObjectException\r
-   */\r
-  public List getLabels() throws StorageObjectFailure {\r
-    return theStorageObject.getLabels();\r
-  }\r
-\r
-  /**\r
-   * Returns a Map with all values of the Entity.\r
-   * @return Map with field name as key and the corresponding values\r
-   *\r
-       * @deprecated This method is deprecated and will be deleted in the next release.\r
-   *  Entity interfaces freemarker.template.TemplateHashModel now and can\r
-   *  be used in the same way as SimpleHash.\r
-   */\r
-  public Map getValues() {\r
-    logger.warn("using deprecated Entity.getValues() - a waste of resources");\r
-    return theValuesHash;\r
-  }\r
-\r
-  /**\r
-   * Returns an ArrayList with all database fields that can\r
-   * be evaluated as streamedInput.\r
-   * Could be automated by the types (blob, etc.)\r
-   * Until now to be created manually in the inheriting class\r
-   *\r
-   *  Liefert einen ArrayList mit allen Datenbankfeldern, die\r
-   *  als streamedInput ausgelesen werden muessen.\r
-   *  Waere automatisierbar ueber die types (blob, etc.)\r
-   *  Bisher manuell anzulegen in der erbenden Klasse\r
-   */\r
-\r
-  public List streamedInput() {\r
-    return streamedInput;\r
-  }\r
-\r
-  /** Returns whether fieldName is a valid field name of this Entity.\r
-   * @param fieldName\r
-   * @return true in case fieldName is a field name, else false.\r
-   * @exception StorageObjectException\r
-   */\r
-  public boolean isField(String fieldName) throws StorageObjectFailure {\r
-    return theStorageObject.getFields().contains(fieldName);\r
-  }\r
-\r
-  protected void throwStorageObjectFailure(Throwable e, String wo) throws\r
-      StorageObjectFailure {\r
-    logger.error(e.toString() + " function: " + wo);\r
-    e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
-\r
-    throw new StorageObjectFailure("Storage Object Exception in entity", e);\r
-  }\r
-\r
-  // Now implements freemarkers TemplateHashModel\r
-  // two methods have to be overridden:\r
-  // 1. public boolean isEmpty() throws TemplateModelException\r
-  // 2. public TemplateModel get(java.lang.String key) throws TemplateModelException\r
-\r
-  public boolean isEmpty() throws TemplateModelException {\r
-    return (theValuesHash == null || theValuesHash.isEmpty()) ? true : false;\r
-  }\r
-\r
-  public TemplateModel get(java.lang.String key) throws TemplateModelException {\r
-    return new SimpleScalar(getValue(key));\r
-  }\r
-\r
-  public void put(java.lang.String key, TemplateModel model) {\r
-    // putting should only take place via setValue and is limited to the\r
-    // database fields associated with the entity. no additional freemarker\r
-    // stuff will be available via Entity.\r
-    logger.warn("put is called on entity! - the values will be lost!");\r
-  }\r
-\r
-  public void remove(java.lang.String key) {\r
-    // do we need this?\r
-  }\r
-\r
-  //////////////////////////////////////////////////////////////////////////////////\r
-}\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+/**
+ * Base class the entities are derived from. Provides base functionality of
+ * an entity. Entities are used to represent rows of a database table.<p>
+ */
+
+package  mir.entity;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectExc;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateHashModel;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateModelRoot;
+
+/**
+ * Base Class of Entities
+ * Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant
+ *
+ * @version $Id: Entity.java,v 1.19 2003/04/09 02:06:06 zapata Exp $
+ * @author rk
+ *
+ */
+
+public class Entity implements TemplateHashModel, TemplateModelRoot
+{
+  protected static MirPropertiesConfiguration configuration;
+
+  private boolean changed;
+  protected Map theValuesHash; // tablekey / value
+  protected StorageObject theStorageObject;
+  protected List streamedInput = null;
+  protected LoggerWrapper logger;
+
+  static {
+    try {
+      configuration = MirPropertiesConfiguration.instance();
+    }
+    catch (PropertiesConfigExc e) {
+      throw new RuntimeException(e.getMessage());
+    }
+  }
+
+  public Entity() {
+    logger = new LoggerWrapper("Entity");
+
+    this.changed = false;
+  }
+
+  /**
+   * Constructor
+   * @param StorageObject The StorageObject of the Entity.
+   */
+  public Entity(StorageObject StorageObject) {
+    this();
+    setStorage(StorageObject);
+  }
+
+  /*
+   * Sets the StorageObject of the Entity.
+   */
+  public void setStorage(StorageObject storage) {
+    this.theStorageObject = storage;
+  }
+
+  /**
+   * Sets the values of the Entity.
+   * @param theStringValues Map containing the new values of the Entity
+   */
+
+  public void setValues(Map theStringValues) {
+    /** @todo should be synchronized */
+    if (theStringValues != null) {
+      theValuesHash = new HashMap();
+      theValuesHash.putAll(theStringValues);
+    }
+    else
+      logger.warn("Entity.setValues called with null Map");
+  }
+
+  /**
+   * Returns whether the content of the Entity has changed.
+   * @return true wenn ja, sonst false
+   */
+  public boolean changed() {
+    return changed;
+  }
+
+  /**
+   * Returns the primary key of the Entity.
+   * @return String Id
+   */
+  public String getId() {
+    return (String) getValue(theStorageObject.getIdName());
+  }
+
+  /**
+   * Defines the primary key of the Entity
+   * @param id
+   */
+  public void setId(String id) {
+    theValuesHash.put(theStorageObject.getIdName(), id);
+  }
+
+  /**
+   * Returns the value of a field by field name.
+   * @param field The name of the field
+   * @return value of the field
+   */
+  public String getValue(String field) {
+    String returnValue = null;
+    if (field != null) {
+      if (field.equals("webdb_create_formatted")) {
+        if (hasValueForField("webdb_create"))
+          returnValue = StringUtil.dateToReadableDate(getValue("webdb_create"));
+      }
+      else if (field.equals("webdb_lastchange_formatted")) {
+        if (hasValueForField("webdb_lastchange"))
+          returnValue = StringUtil.dateToReadableDate(getValue(
+              "webdb_lastchange"));
+      }
+      else
+        returnValue = (String) theValuesHash.get(field);
+    }
+    return returnValue;
+  }
+
+  public boolean hasValueForField(String field) {
+    if (theValuesHash != null)
+      return theValuesHash.containsKey(field);
+    return false;
+  }
+
+  /**
+   * Insers Entity into the database via StorageObject
+   * @return Primary Key of the Entity
+   * @exception StorageObjectException
+   */
+  public String insert() throws StorageObjectExc {
+    logger.debug("Entity: trying to insert ...");
+    if (theStorageObject != null) {
+      return theStorageObject.insert( (Entity)this);
+    }
+    else
+      throw new StorageObjectExc("theStorageObject == null!");
+  }
+
+  /**
+   * Saves changes of this Entity to the database
+   * @exception StorageObjectException
+   */
+  public void update() throws StorageObjectFailure {
+    theStorageObject.update( (Entity)this);
+  }
+
+  /**
+   * Sets the value for a field. Issues a log message if the field name
+   * supplied was not found in the Entity.
+   * @param theProp The field name whose value has to be set
+   * @param theValue The new value of the field
+   * @exception StorageObjectException
+   */
+  public void setValueForProperty(String theProp, String theValue) throws
+      StorageObjectFailure {
+    this.changed = true;
+    if (isField(theProp))
+      theValuesHash.put(theProp, theValue);
+    else {
+      logger.warn("Entity.setValueForProperty: Property not found: " + theProp + " (" + theValue + ")");
+    }
+
+  }
+
+  /**
+   * Returns the field names of the Entity as ArrayListe.
+   * @return ArrayList with field names
+       * @exception StorageObjectException is throuwn if database access was impossible
+   */
+  public List getFields() throws StorageObjectFailure {
+    return theStorageObject.getFields();
+  }
+
+  /**
+   * Returns an int[] with the types of the fields
+   * @return int[] that contains the types of the fields
+   * @exception StorageObjectException
+   */
+  public int[] getTypes() throws StorageObjectFailure {
+    return theStorageObject.getTypes();
+  }
+
+  /**
+   * Returns an ArrayList with field names
+   * @return List with field names
+   * @exception StorageObjectException
+   */
+  public List getLabels() throws StorageObjectFailure {
+    return theStorageObject.getLabels();
+  }
+
+  /**
+   * Returns a Map with all values of the Entity.
+   * @return Map with field name as key and the corresponding values
+   *
+       * @deprecated This method is deprecated and will be deleted in the next release.
+   *  Entity interfaces freemarker.template.TemplateHashModel now and can
+   *  be used in the same way as SimpleHash.
+   */
+  public Map getValues() {
+    logger.warn("using deprecated Entity.getValues() - a waste of resources");
+    return theValuesHash;
+  }
+
+  /**
+   * Returns an ArrayList with all database fields that can
+   * be evaluated as streamedInput.
+   * Could be automated by the types (blob, etc.)
+   * Until now to be created manually in the inheriting class
+   *
+   *  Liefert einen ArrayList mit allen Datenbankfeldern, die
+   *  als streamedInput ausgelesen werden muessen.
+   *  Waere automatisierbar ueber die types (blob, etc.)
+   *  Bisher manuell anzulegen in der erbenden Klasse
+   */
+
+  public List streamedInput() {
+    return streamedInput;
+  }
+
+  /** Returns whether fieldName is a valid field name of this Entity.
+   * @param fieldName
+   * @return true in case fieldName is a field name, else false.
+   * @exception StorageObjectException
+   */
+  public boolean isField(String fieldName) throws StorageObjectFailure {
+    return theStorageObject.getFields().contains(fieldName);
+  }
+
+  protected void throwStorageObjectFailure(Throwable e, String wo) throws
+      StorageObjectFailure {
+    logger.error(e.toString() + " function: " + wo);
+    e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+
+    throw new StorageObjectFailure("Storage Object Exception in entity", e);
+  }
+
+  // Now implements freemarkers TemplateHashModel
+  // two methods have to be overridden:
+  // 1. public boolean isEmpty() throws TemplateModelException
+  // 2. public TemplateModel get(java.lang.String key) throws TemplateModelException
+
+  public boolean isEmpty() throws TemplateModelException {
+    return (theValuesHash == null || theValuesHash.isEmpty()) ? true : false;
+  }
+
+  public TemplateModel get(java.lang.String key) throws TemplateModelException {
+    return new SimpleScalar(getValue(key));
+  }
+
+  public void put(java.lang.String key, TemplateModel model) {
+    // putting should only take place via setValue and is limited to the
+    // database fields associated with the entity. no additional freemarker
+    // stuff will be available via Entity.
+    logger.warn("put is called on entity! - the values will be lost!");
+  }
+
+  public void remove(java.lang.String key) {
+    // do we need this?
+  }
+
+  //////////////////////////////////////////////////////////////////////////////////
+}
+
index 2e829c5..8ce7a6e 100755 (executable)
  * not wish to do so, delete this exception statement from your version.
  */
 
-package mir.entity;\r
-\r
+package mir.entity;
+
 import mir.storage.StorageObject;
 import mir.storage.StorageObjectFailure;
 import mir.util.RewindableIterator;
-\r
-public class EntityBrowser implements RewindableIterator {\r
-\r
-  private StorageObject storage;\r
-  private String whereClause;\r
-  private String orderByClause;\r
-  private int batchSize;\r
-  private int toFetch;\r
-  private EntityList currentBatch;\r
-\r
-  private int skip;\r
-  private int limit;\r
-\r
-  private int batchPosition;\r
-  private int positionInBatch;\r
-\r
-  public EntityBrowser(StorageObject aStorage, String aWhereClause, String anOrderByClause,\r
-                       int aBatchSize, int aLimit, int aSkip) throws StorageObjectFailure {\r
-\r
-    storage=aStorage;\r
-    whereClause=aWhereClause;\r
-    orderByClause=anOrderByClause;\r
-    batchSize=aBatchSize;\r
-    skip=aSkip;\r
-    limit=aLimit;\r
-\r
-    rewind();\r
-  }\r
-\r
-  public EntityBrowser(StorageObject aStorage,\r
-          String aWhereClause, String anOrderByClause,\r
-          int aBatchSize) throws StorageObjectFailure {\r
-    this(aStorage, aWhereClause, anOrderByClause, aBatchSize, -1, 0);\r
-  }\r
-\r
-  public void readCurrentBatch(int aSkip) throws StorageObjectFailure {\r
-    currentBatch = storage.selectByWhereClause(whereClause, orderByClause, aSkip, batchSize);\r
-    batchPosition = aSkip;\r
-    positionInBatch = 0;\r
-  }\r
-\r
-  public void rewind() {\r
-    try {\r
-      readCurrentBatch(skip);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-  }\r
-\r
-  public boolean hasNext() {\r
-    try {\r
-      if (limit>-1 && batchPosition+positionInBatch>=skip+limit)\r
-        return false;\r
-\r
-      if (positionInBatch>=currentBatch.size() && currentBatch.hasNextBatch()) {\r
-        readCurrentBatch(batchPosition+positionInBatch);\r
-      }\r
-\r
-      return (positionInBatch<currentBatch.size());\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-  }\r
-\r
-  public Object next() {\r
-    try {\r
-      if (hasNext()) {\r
-        Entity result = currentBatch.elementAt(positionInBatch);\r
-        positionInBatch=positionInBatch+1;\r
-\r
-        return result;\r
-      }\r
-      else {\r
-        return null;\r
-      }\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-  }\r
-\r
-  public void remove() {\r
-    throw new UnsupportedOperationException();\r
-  }\r
+
+public class EntityBrowser implements RewindableIterator {
+
+  private StorageObject storage;
+  private String whereClause;
+  private String orderByClause;
+  private int batchSize;
+  private int toFetch;
+  private EntityList currentBatch;
+
+  private int skip;
+  private int limit;
+
+  private int batchPosition;
+  private int positionInBatch;
+
+  public EntityBrowser(StorageObject aStorage, String aWhereClause, String anOrderByClause,
+                       int aBatchSize, int aLimit, int aSkip) throws StorageObjectFailure {
+
+    storage=aStorage;
+    whereClause=aWhereClause;
+    orderByClause=anOrderByClause;
+    batchSize=aBatchSize;
+    skip=aSkip;
+    limit=aLimit;
+
+    rewind();
+  }
+
+  public EntityBrowser(StorageObject aStorage,
+          String aWhereClause, String anOrderByClause,
+          int aBatchSize) throws StorageObjectFailure {
+    this(aStorage, aWhereClause, anOrderByClause, aBatchSize, -1, 0);
+  }
+
+  public void readCurrentBatch(int aSkip) throws StorageObjectFailure {
+    currentBatch = storage.selectByWhereClause(whereClause, orderByClause, aSkip, batchSize);
+    batchPosition = aSkip;
+    positionInBatch = 0;
+  }
+
+  public void rewind() {
+    try {
+      readCurrentBatch(skip);
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.getMessage());
+    }
+  }
+
+  public boolean hasNext() {
+    try {
+      if (limit>-1 && batchPosition+positionInBatch>=skip+limit)
+        return false;
+
+      if (positionInBatch>=currentBatch.size() && currentBatch.hasNextBatch()) {
+        readCurrentBatch(batchPosition+positionInBatch);
+      }
+
+      return (positionInBatch<currentBatch.size());
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.getMessage());
+    }
+  }
+
+  public Object next() {
+    try {
+      if (hasNext()) {
+        Entity result = currentBatch.elementAt(positionInBatch);
+        positionInBatch=positionInBatch+1;
+
+        return result;
+      }
+      else {
+        return null;
+      }
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.getMessage());
+    }
+  }
+
+  public void remove() {
+    throw new UnsupportedOperationException();
+  }
 }
\ No newline at end of file
index e83b78b..76dca01 100755 (executable)
@@ -1,83 +1,83 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.entity.adapter;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import mir.entity.Entity;\r
-import mir.storage.StorageObject;\r
-\r
-public class EntityAdapterModel {\r
-  private Map entityAdapterMappings;\r
-\r
-  public EntityAdapterModel() {\r
-    entityAdapterMappings = new HashMap();\r
-  }\r
-\r
-  public EntityAdapter makeEntityAdapter( String aName, Entity anEntity ) throws EntityAdapterExc {\r
-    Mapping mapping = getMappingForName( aName );\r
-\r
-    return mapping.getDefinition().makeEntityAdapter( anEntity, this );\r
-  }\r
-\r
-  public void addMapping( String aName, StorageObject aStorage, EntityAdapterDefinition aDefinition ) {\r
-    entityAdapterMappings.put( aName, new Mapping( aStorage, aDefinition ) );\r
-    }\r
-\r
-  public Mapping getMappingForName( String aName ) throws EntityAdapterExc {\r
-    if (!entityAdapterMappings.containsKey(aName))\r
-      throw new EntityAdapterExc( "'" + aName + "' not present in model" );\r
-\r
-    return (Mapping) entityAdapterMappings.get( aName );\r
-  }\r
-\r
-  public class Mapping {\r
-    private StorageObject storage;\r
-    private EntityAdapterDefinition definition;\r
-\r
-    public Mapping( StorageObject aStorage, EntityAdapterDefinition aDefinition ) {\r
-      storage = aStorage;\r
-      definition = aDefinition;\r
-    }\r
-\r
-    public StorageObject getStorage() {\r
-      return storage;\r
-    }\r
-\r
-    public EntityAdapterDefinition getDefinition() {\r
-      return definition;\r
-    }\r
-  }\r
-}\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.entity.adapter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import mir.entity.Entity;
+import mir.storage.StorageObject;
+
+public class EntityAdapterModel {
+  private Map entityAdapterMappings;
+
+  public EntityAdapterModel() {
+    entityAdapterMappings = new HashMap();
+  }
+
+  public EntityAdapter makeEntityAdapter( String aName, Entity anEntity ) throws EntityAdapterExc {
+    Mapping mapping = getMappingForName( aName );
+
+    return mapping.getDefinition().makeEntityAdapter( anEntity, this );
+  }
+
+  public void addMapping( String aName, StorageObject aStorage, EntityAdapterDefinition aDefinition ) {
+    entityAdapterMappings.put( aName, new Mapping( aStorage, aDefinition ) );
+    }
+
+  public Mapping getMappingForName( String aName ) throws EntityAdapterExc {
+    if (!entityAdapterMappings.containsKey(aName))
+      throw new EntityAdapterExc( "'" + aName + "' not present in model" );
+
+    return (Mapping) entityAdapterMappings.get( aName );
+  }
+
+  public class Mapping {
+    private StorageObject storage;
+    private EntityAdapterDefinition definition;
+
+    public Mapping( StorageObject aStorage, EntityAdapterDefinition aDefinition ) {
+      storage = aStorage;
+      definition = aDefinition;
+    }
+
+    public StorageObject getStorage() {
+      return storage;
+    }
+
+    public EntityAdapterDefinition getDefinition() {
+      return definition;
+    }
+  }
+}
+
+
index 9de4648..d4fda8c 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.generator;\r
-\r
-import java.io.PrintWriter;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import mir.misc.MessageMethodModel;\r
-import mir.util.RewindableIterator;\r
-\r
-import org.apache.struts.util.MessageResources;\r
-\r
-import freemarker.template.FileTemplateCache;\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.Template;\r
-import freemarker.template.TemplateHashModel;\r
-import freemarker.template.TemplateListModel;\r
-import freemarker.template.TemplateMethodModel;\r
-import freemarker.template.TemplateModel;\r
-import freemarker.template.TemplateModelException;\r
-import freemarker.template.TemplateModelRoot;\r
-import freemarker.template.TemplateScalarModel;\r
-\r
-public class FreemarkerGenerator implements Generator {\r
-  private Template template;\r
-\r
-  public FreemarkerGenerator(Template aTemplate) {\r
-    template = aTemplate;\r
-  }\r
-\r
-  public void generate(Object anOutputWriter, Map aValues, PrintWriter aLogger) throws GeneratorExc, GeneratorFailure {\r
-    if (!(anOutputWriter instanceof PrintWriter))\r
-      throw new GeneratorExc("Writer for a FreemarkerGenerator must be a PrintWriter");\r
-\r
-    try {\r
-      template.process((TemplateModelRoot) makeMapAdapter(aValues), (PrintWriter) anOutputWriter);\r
-    }\r
-    catch (Throwable t) {\r
-      t.printStackTrace();\r
-      aLogger.println("Exception occurred: "+t.getMessage());\r
-      t.printStackTrace(aLogger);\r
-      throw new GeneratorFailure( t );\r
-    }\r
-  }\r
-\r
-  private static TemplateScalarModel makeStringAdapter(String aString) {\r
-    return new SimpleScalar(aString);\r
-  }\r
-\r
-  private static TemplateHashModel makeMapAdapter(Map aMap)  {\r
-    return new MapAdapter(aMap);\r
-  }\r
-\r
-  private static TemplateListModel makeIteratorAdapter(Iterator anIterator) {\r
-    return new IteratorAdapter(anIterator);\r
-  }\r
-\r
-  private static TemplateMethodModel makeFunctionAdapter(Generator.GeneratorFunction aFunction) {\r
-    return new FunctionAdapter(aFunction);\r
-  }\r
-\r
-  public static TemplateModel makeAdapter(Object anObject) throws TemplateModelException {\r
-    if (anObject == null)\r
-      return null;\r
-\r
-    if (anObject instanceof TemplateModel)\r
-      return (TemplateModel) anObject;\r
-    else if (anObject instanceof Generator.GeneratorFunction)\r
-      return makeFunctionAdapter((Generator.GeneratorFunction) anObject);\r
-    else if (anObject instanceof MessageResources)\r
-      return new MessageMethodModel((MessageResources) anObject);\r
-    else if (anObject instanceof Integer)\r
-      return makeStringAdapter(((Integer) anObject).toString());\r
-    else if (anObject instanceof Boolean) {\r
-      if (((Boolean) anObject).booleanValue())\r
-        return makeStringAdapter("1");\r
-      else\r
-        return makeStringAdapter("0");\r
-    }\r
-    else if (anObject instanceof String)\r
-      return makeStringAdapter((String) anObject);\r
-    else if (anObject instanceof Map)\r
-      return makeMapAdapter((Map) anObject);\r
-    else if (anObject instanceof Iterator)\r
-      return makeIteratorAdapter((Iterator) anObject);\r
-    else if (anObject instanceof List)\r
-      return makeIteratorAdapter(((List) anObject).iterator());\r
-    else\r
-      throw new TemplateModelException("Unadaptable class: " + anObject.getClass().getName());\r
-  }\r
-\r
-  private static class MapAdapter implements TemplateModelRoot {\r
-    Map map;\r
-    Map valuesCache;\r
-\r
-    private MapAdapter(Map aMap) {\r
-      map = aMap;\r
-      valuesCache = new HashMap();\r
-    }\r
-\r
-    public void put(String aKey, TemplateModel aModel) {\r
-      valuesCache.put(aKey, aModel);\r
-    }\r
-\r
-    public void remove(String aKey) {\r
-      // ML: kinda tricky...\r
-    }\r
-\r
-    public boolean isEmpty() {\r
-      return map.isEmpty();\r
-    }\r
-\r
-    public TemplateModel get(String aKey) throws TemplateModelException {\r
-      try {\r
-        if (!valuesCache.containsKey(aKey)) {\r
-          Object value = map.get(aKey);\r
-\r
-          if (value == null && !map.containsKey(aKey)) {\r
-            throw new TemplateModelException("MapAdapter: no key "+aKey+" available");\r
-          }\r
-\r
-          valuesCache.put(aKey, makeAdapter(value));\r
-        }\r
-\r
-        return (TemplateModel) valuesCache.get(aKey);\r
-      }\r
-      catch (TemplateModelException e) {\r
-        throw e;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new TemplateModelException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  private static class IteratorAdapter implements TemplateListModel {\r
-    Iterator iterator;\r
-    List valuesCache;\r
-    int position;\r
-\r
-    private IteratorAdapter(Iterator anIterator) {\r
-      iterator = anIterator;\r
-\r
-      valuesCache = new Vector();\r
-      position=0;\r
-\r
-\r
-      if (iterator instanceof RewindableIterator) {\r
-        ((RewindableIterator) iterator).rewind();\r
-      }\r
-    }\r
-\r
-    public boolean isEmpty() {\r
-      return valuesCache.isEmpty() && !iterator.hasNext();\r
-    }\r
-\r
-    private void getUntil(int anIndex) throws TemplateModelException {\r
-      while (valuesCache.size()<=anIndex && iterator.hasNext())\r
-      {\r
-        valuesCache.add(makeAdapter(iterator.next()));\r
-      }\r
-    };\r
-\r
-    public TemplateModel get(int anIndex) throws TemplateModelException {\r
-      TemplateModel result;\r
-\r
-      getUntil(anIndex);\r
-\r
-      if (anIndex<valuesCache.size())\r
-      {\r
-        result = (TemplateModel) valuesCache.get(anIndex);\r
-\r
-        return result;\r
-      }\r
-      else\r
-        throw new TemplateModelException( "Iterator out of bounds" );\r
-    }\r
-\r
-    public boolean hasNext() {\r
-      return position<valuesCache.size() || iterator.hasNext();\r
-    }\r
-\r
-    public boolean isRewound() {\r
-      return position==0;\r
-    }\r
-\r
-    public TemplateModel next() throws TemplateModelException {\r
-      TemplateModel result;\r
-\r
-      if (hasNext()) {\r
-        result = get(position);\r
-        position++;\r
-      }\r
-      else\r
-        throw new TemplateModelException( "Iterator out of bounds" );\r
-\r
-      return result;\r
-    }\r
-\r
-    public void rewind() {\r
-      position=0;\r
-    }\r
-  }\r
-\r
-  private static class ListAdapter implements TemplateListModel {\r
-    List list;\r
-    List valuesCache;\r
-    int position;\r
-\r
-    private ListAdapter(List aList) {\r
-      list = aList;\r
-      valuesCache = new Vector();\r
-      position=0;\r
-    }\r
-\r
-    public boolean isEmpty() {\r
-      return list.isEmpty();\r
-    }\r
-\r
-    public TemplateModel get(int i) throws TemplateModelException {\r
-\r
-      if (i>=valuesCache.size() && i<list.size()) {\r
-        for(int j=valuesCache.size(); j<=i; j++) {\r
-          valuesCache.add(makeAdapter(list.get(j)));\r
-        }\r
-      }\r
-\r
-      if (i<valuesCache.size())\r
-        return (TemplateModel) valuesCache.get(i);\r
-      else\r
-        throw new TemplateModelException( "Iterator out of bounds" );\r
-    }\r
-\r
-    public boolean hasNext() {\r
-      return position<list.size();\r
-    }\r
-\r
-    public boolean isRewound() {\r
-      return position==0;\r
-    }\r
-\r
-    public TemplateModel next() throws TemplateModelException {\r
-      TemplateModel result;\r
-\r
-      if (hasNext()) {\r
-        result = get(position);\r
-        position++;\r
-      }\r
-      else {\r
-        throw new TemplateModelException( "Iterator out of bounds" );\r
-      }\r
-\r
-      return result;\r
-    }\r
-\r
-    public void rewind() {\r
-      position = 0;\r
-    }\r
-  }\r
-\r
-  private static class FunctionAdapter implements TemplateMethodModel {\r
-    Generator.GeneratorFunction function;\r
-\r
-    public FunctionAdapter(Generator.GeneratorFunction aFunction) {\r
-      function = aFunction;\r
-    }\r
-\r
-    public TemplateModel exec(List anArguments) throws TemplateModelException {\r
-      try {\r
-        return makeAdapter(function.perform(anArguments));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new TemplateModelException(t.getMessage());\r
-      }\r
-    }\r
-\r
-    public boolean isEmpty() {\r
-      return false;\r
-    }\r
-\r
-  }\r
-\r
-  public static class FreemarkerGeneratorLibrary implements GeneratorLibrary {\r
-    private FileTemplateCache templateCache;\r
-\r
-    public FreemarkerGeneratorLibrary(String aTemplateRoot) {\r
-      templateCache = new FileTemplateCache( aTemplateRoot+"/" );\r
-      templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND);\r
-    }\r
-\r
-    public Generator makeGenerator(String anIdentifier) throws GeneratorExc, GeneratorFailure {\r
-      Template template = (Template) templateCache.getItem(anIdentifier, "template");\r
-\r
-      if (template==null) {\r
-        throw new GeneratorExc("FreemarkerGeneratorLibrary: Can't find template "+templateCache.getDirectory()+anIdentifier);\r
-      }\r
-\r
-      return new FreemarkerGenerator(template);\r
-    }\r
-  }\r
-\r
-  public static class FreemarkerGeneratorLibraryFactory implements GeneratorLibraryFactory {\r
-    private String basePath;\r
-\r
-    public FreemarkerGeneratorLibraryFactory(String aBasePath) {\r
-      basePath = aBasePath;\r
-    }\r
-\r
-    public GeneratorLibrary makeLibrary(String anInitializationString) {\r
-      return new FreemarkerGeneratorLibrary(basePath+anInitializationString);\r
-    };\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.generator;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.util.RewindableIterator;
+import mir.util.*;
+
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.FileTemplateCache;
+import freemarker.template.SimpleScalar;
+import freemarker.template.Template;
+import freemarker.template.TemplateHashModel;
+import freemarker.template.TemplateListModel;
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateModelRoot;
+import freemarker.template.TemplateScalarModel;
+
+public class FreemarkerGenerator implements Generator {
+  private Template template;
+
+  public FreemarkerGenerator(Template aTemplate) {
+    template = aTemplate;
+  }
+
+  public void generate(Object anOutputWriter, Map aValues, PrintWriter aLogger) throws GeneratorExc, GeneratorFailure {
+    if (!(anOutputWriter instanceof PrintWriter))
+      throw new GeneratorExc("Writer for a FreemarkerGenerator must be a PrintWriter");
+
+    try {
+      template.process((TemplateModelRoot) makeMapAdapter(aValues), (PrintWriter) anOutputWriter);
+    }
+    catch (Throwable t) {
+      t.printStackTrace();
+      aLogger.println("Exception occurred: "+t.getMessage());
+      t.printStackTrace(aLogger);
+      throw new GeneratorFailure( t );
+    }
+  }
+
+  private static TemplateScalarModel makeStringAdapter(String aString) {
+    return new SimpleScalar(aString);
+  }
+
+  private static TemplateHashModel makeMapAdapter(Map aMap)  {
+    return new MapAdapter(aMap);
+  }
+
+  private static TemplateListModel makeIteratorAdapter(Iterator anIterator) {
+    return new IteratorAdapter(anIterator);
+  }
+
+  private static TemplateMethodModel makeFunctionAdapter(Generator.GeneratorFunction aFunction) {
+    return new FunctionAdapter(aFunction);
+  }
+
+  public static TemplateModel makeAdapter(Object anObject) throws TemplateModelException {
+    if (anObject == null)
+      return null;
+
+    if (anObject instanceof TemplateModel)
+      return (TemplateModel) anObject;
+    else if (anObject instanceof Generator.GeneratorFunction)
+      return makeFunctionAdapter((Generator.GeneratorFunction) anObject);
+    else if (anObject instanceof Integer)
+      return makeStringAdapter(((Integer) anObject).toString());
+    else if (anObject instanceof Boolean) {
+      if (((Boolean) anObject).booleanValue())
+        return makeStringAdapter("1");
+      else
+        return makeStringAdapter("0");
+    }
+    else if (anObject instanceof String)
+      return makeStringAdapter((String) anObject);
+    else if (anObject instanceof Map)
+      return makeMapAdapter((Map) anObject);
+    else if (anObject instanceof Iterator)
+      return makeIteratorAdapter((Iterator) anObject);
+    else if (anObject instanceof List)
+      return makeIteratorAdapter(((List) anObject).iterator());
+    else
+      throw new TemplateModelException("Unadaptable class: " + anObject.getClass().getName());
+  }
+
+  private static class MapAdapter implements TemplateModelRoot {
+    Map map;
+    Map valuesCache;
+
+    private MapAdapter(Map aMap) {
+      map = aMap;
+      valuesCache = new HashMap();
+    }
+
+    public void put(String aKey, TemplateModel aModel) {
+      valuesCache.put(aKey, aModel);
+    }
+
+    public void remove(String aKey) {
+      // ML: kinda tricky...
+    }
+
+    public boolean isEmpty() {
+      return map.isEmpty();
+    }
+
+    public TemplateModel get(String aKey) throws TemplateModelException {
+      try {
+        if (!valuesCache.containsKey(aKey)) {
+          Object value = map.get(aKey);
+
+          if (value == null && !map.containsKey(aKey)) {
+            throw new TemplateModelException("MapAdapter: no key "+aKey+" available");
+          }
+
+          valuesCache.put(aKey, makeAdapter(value));
+        }
+
+        return (TemplateModel) valuesCache.get(aKey);
+      }
+      catch (TemplateModelException e) {
+        throw e;
+      }
+      catch (Throwable t) {
+        throw new TemplateModelException(t.getMessage());
+      }
+    }
+  }
+
+  private static class IteratorAdapter implements TemplateListModel {
+    Iterator iterator;
+    List valuesCache;
+    int position;
+
+    private IteratorAdapter(Iterator anIterator) {
+      iterator = anIterator;
+
+      valuesCache = new Vector();
+      position=0;
+
+
+      if (iterator instanceof RewindableIterator) {
+        ((RewindableIterator) iterator).rewind();
+      }
+    }
+
+    public boolean isEmpty() {
+      return valuesCache.isEmpty() && !iterator.hasNext();
+    }
+
+    private void getUntil(int anIndex) throws TemplateModelException {
+      while (valuesCache.size()<=anIndex && iterator.hasNext())
+      {
+        valuesCache.add(makeAdapter(iterator.next()));
+      }
+    };
+
+    public TemplateModel get(int anIndex) throws TemplateModelException {
+      TemplateModel result;
+
+      getUntil(anIndex);
+
+      if (anIndex<valuesCache.size())
+      {
+        result = (TemplateModel) valuesCache.get(anIndex);
+
+        return result;
+      }
+      else
+        throw new TemplateModelException( "Iterator out of bounds" );
+    }
+
+    public boolean hasNext() {
+      return position<valuesCache.size() || iterator.hasNext();
+    }
+
+    public boolean isRewound() {
+      return position==0;
+    }
+
+    public TemplateModel next() throws TemplateModelException {
+      TemplateModel result;
+
+      if (hasNext()) {
+        result = get(position);
+        position++;
+      }
+      else
+        throw new TemplateModelException( "Iterator out of bounds" );
+
+      return result;
+    }
+
+    public void rewind() {
+      position=0;
+    }
+  }
+
+  private static class ListAdapter implements TemplateListModel {
+    List list;
+    List valuesCache;
+    int position;
+
+    private ListAdapter(List aList) {
+      list = aList;
+      valuesCache = new Vector();
+      position=0;
+    }
+
+    public boolean isEmpty() {
+      return list.isEmpty();
+    }
+
+    public TemplateModel get(int i) throws TemplateModelException {
+
+      if (i>=valuesCache.size() && i<list.size()) {
+        for(int j=valuesCache.size(); j<=i; j++) {
+          valuesCache.add(makeAdapter(list.get(j)));
+        }
+      }
+
+      if (i<valuesCache.size())
+        return (TemplateModel) valuesCache.get(i);
+      else
+        throw new TemplateModelException( "Iterator out of bounds" );
+    }
+
+    public boolean hasNext() {
+      return position<list.size();
+    }
+
+    public boolean isRewound() {
+      return position==0;
+    }
+
+    public TemplateModel next() throws TemplateModelException {
+      TemplateModel result;
+
+      if (hasNext()) {
+        result = get(position);
+        position++;
+      }
+      else {
+        throw new TemplateModelException( "Iterator out of bounds" );
+      }
+
+      return result;
+    }
+
+    public void rewind() {
+      position = 0;
+    }
+  }
+
+  private static class FunctionAdapter implements TemplateMethodModel {
+    Generator.GeneratorFunction function;
+
+    public FunctionAdapter(Generator.GeneratorFunction aFunction) {
+      function = aFunction;
+    }
+
+    public TemplateModel exec(List anArguments) throws TemplateModelException {
+      try {
+        return makeAdapter(function.perform(anArguments));
+      }
+      catch (Throwable t) {
+        throw new TemplateModelException(t.getMessage());
+      }
+    }
+
+    public boolean isEmpty() {
+      return false;
+    }
+
+  }
+
+  public static class FreemarkerGeneratorLibrary implements GeneratorLibrary {
+    private FileTemplateCache templateCache;
+
+    public FreemarkerGeneratorLibrary(String aTemplateRoot) {
+      templateCache = new FileTemplateCache( aTemplateRoot+"/" );
+      templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND);
+    }
+
+    public Generator makeGenerator(String anIdentifier) throws GeneratorExc, GeneratorFailure {
+      Template template = (Template) templateCache.getItem(anIdentifier, "template");
+
+      if (template==null) {
+        throw new GeneratorExc("FreemarkerGeneratorLibrary: Can't find template "+templateCache.getDirectory()+anIdentifier);
+      }
+
+      return new FreemarkerGenerator(template);
+    }
+  }
+
+  public static class FreemarkerGeneratorLibraryFactory implements GeneratorLibraryFactory {
+    private String basePath;
+
+    public FreemarkerGeneratorLibraryFactory(String aBasePath) {
+      basePath = aBasePath;
+    }
+
+    public GeneratorLibrary makeLibrary(String anInitializationString) {
+      return new FreemarkerGeneratorLibrary(basePath+anInitializationString);
+    };
+  }
+}
index 2184f76..d953599 100755 (executable)
@@ -1,83 +1,83 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.log;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-\r
-public class Log {\r
-\r
-  private static Logger myLogger;\r
-\r
-  static {\r
-    try {\r
-      String loggerClass = MirPropertiesConfiguration.instance().getString("Log.LogClass");\r
-      myLogger = (Logger) Class.forName(loggerClass).newInstance();\r
-    }\r
-    catch (java.lang.ClassNotFoundException cnfe) {\r
-      System.err.println("Log was not able to initialize: class not found");\r
-      cnfe.printStackTrace(System.err);\r
-    }\r
-    catch (java.lang.InstantiationException ie) {\r
-      System.err.println(\r
-          "Log was not able to initialize: could not initialize class");\r
-      ie.printStackTrace(System.err);\r
-    }\r
-    catch (java.lang.IllegalAccessException iae) {\r
-      System.err.println("Log was not able to initialize: illegal access");\r
-      iae.printStackTrace(System.err);\r
-    }\r
-    catch (PropertiesConfigExc e) {\r
-      e.printStackTrace(System.err);\r
-    }\r
-  }\r
-\r
-  public static void debug(Object o, String s) {\r
-    myLogger.debug(o, s);\r
-  }\r
-\r
-  public static void info(Object o, String s) {\r
-    myLogger.info(o, s);\r
-  }\r
-\r
-  public static void warn(Object o, String s) {\r
-    myLogger.warn(o, s);\r
-  }\r
-\r
-  public static void error(Object o, String s) {\r
-    myLogger.error(o, s);\r
-  }\r
-\r
-  public static void fatal(Object o, String s) {\r
-    myLogger.fatal(o, s);\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.log;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+
+public class Log {
+
+  private static Logger myLogger;
+
+  static {
+    try {
+      String loggerClass = MirPropertiesConfiguration.instance().getString("Log.LogClass");
+      myLogger = (Logger) Class.forName(loggerClass).newInstance();
+    }
+    catch (java.lang.ClassNotFoundException cnfe) {
+      System.err.println("Log was not able to initialize: class not found");
+      cnfe.printStackTrace(System.err);
+    }
+    catch (java.lang.InstantiationException ie) {
+      System.err.println(
+          "Log was not able to initialize: could not initialize class");
+      ie.printStackTrace(System.err);
+    }
+    catch (java.lang.IllegalAccessException iae) {
+      System.err.println("Log was not able to initialize: illegal access");
+      iae.printStackTrace(System.err);
+    }
+    catch (PropertiesConfigExc e) {
+      e.printStackTrace(System.err);
+    }
+  }
+
+  public static void debug(Object o, String s) {
+    myLogger.debug(o, s);
+  }
+
+  public static void info(Object o, String s) {
+    myLogger.info(o, s);
+  }
+
+  public static void warn(Object o, String s) {
+    myLogger.warn(o, s);
+  }
+
+  public static void error(Object o, String s) {
+    myLogger.error(o, s);
+  }
+
+  public static void fatal(Object o, String s) {
+    myLogger.fatal(o, s);
+  }
+}
index ede6069..97bfd9a 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.log.log4j;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.apache.log4j.PropertyConfigurator;\r
-\r
-\r
-public class LoggerImpl implements mir.log.Logger {\r
-  private static Map loggers = new HashMap();\r
-\r
-  public LoggerImpl() throws PropertiesConfigExc {\r
-    System.setProperty("log.home",\r
-        MirPropertiesConfiguration.instance().getStringWithHome("Log.Home"));\r
-    PropertyConfigurator.configure(\r
-        MirPropertiesConfiguration.instance().getStringWithHome("Log.log4j.ConfigurationFile").trim());\r
-  }\r
-\r
-  public void debug(Object o, String s) {\r
-    this.getLogger(o).debug(s);\r
-  }\r
-\r
-  public void info(Object o, String s) {\r
-    this.getLogger(o).info(s);\r
-  }\r
-\r
-  public void warn(Object o, String s) {\r
-    this.getLogger(o).warn(s);\r
-  }\r
-\r
-  public void error(Object o, String s) {\r
-    this.getLogger(o).error(s);\r
-  }\r
-\r
-  public void fatal(Object o, String s) {\r
-    this.getLogger(o).fatal(s);\r
-  }\r
-\r
-  private Logger getLogger(Object o) {\r
-    String name;\r
-    Logger l;\r
-\r
-    if (o instanceof String) {\r
-      name = (String) o;\r
-    }\r
-    else if (o instanceof Class) {\r
-      name = ( (Class) o).getName();\r
-    }\r
-    else if (o != null) {\r
-      name = o.getClass().getName();\r
-    }\r
-    else {\r
-      name = "generic";\r
-    }\r
-\r
-    synchronized (loggers) {\r
-      l = (Logger) loggers.get(name);\r
-      if (l == null) {\r
-        if (!loggers.containsKey(name)) {\r
-          l = Logger.getLogger(name);\r
-          loggers.put(name, l);\r
-        }\r
-        l = (Logger) loggers.get(name);\r
-      }\r
-    }\r
-\r
-    return l;\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.log.log4j;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+
+public class LoggerImpl implements mir.log.Logger {
+  private static Map loggers = new HashMap();
+
+  public LoggerImpl() throws PropertiesConfigExc {
+    System.setProperty("log.home",
+        MirPropertiesConfiguration.instance().getStringWithHome("Log.Home"));
+    PropertyConfigurator.configure(
+        MirPropertiesConfiguration.instance().getStringWithHome("Log.log4j.ConfigurationFile").trim());
+  }
+
+  public void debug(Object o, String s) {
+    this.getLogger(o).debug(s);
+  }
+
+  public void info(Object o, String s) {
+    this.getLogger(o).info(s);
+  }
+
+  public void warn(Object o, String s) {
+    this.getLogger(o).warn(s);
+  }
+
+  public void error(Object o, String s) {
+    this.getLogger(o).error(s);
+  }
+
+  public void fatal(Object o, String s) {
+    this.getLogger(o).fatal(s);
+  }
+
+  private Logger getLogger(Object o) {
+    String name;
+    Logger l;
+
+    if (o instanceof String) {
+      name = (String) o;
+    }
+    else if (o instanceof Class) {
+      name = ( (Class) o).getName();
+    }
+    else if (o != null) {
+      name = o.getClass().getName();
+    }
+    else {
+      name = "generic";
+    }
+
+    synchronized (loggers) {
+      l = (Logger) loggers.get(name);
+      if (l == null) {
+        if (!loggers.containsKey(name)) {
+          l = Logger.getLogger(name);
+          loggers.put(name, l);
+        }
+        l = (Logger) loggers.get(name);
+      }
+    }
+
+    return l;
+  }
 }
\ No newline at end of file
index 0d78ff7..c979198 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.misc;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.OutputStreamWriter;\r
-import java.io.Reader;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-\r
-/**\r
- * Hilfsklasse zum Mergen von Template und Daten\r
- */\r
-public final class FileUtil {\r
-\r
-  private static String producerStorageRoot;\r
-\r
-  //\r
-  // Initialisierung\r
-\r
-  static {\r
-    try {\r
-      producerStorageRoot =\r
-          MirPropertiesConfiguration.instance().getString("Producer.StorageRoot");\r
-    }\r
-    catch (PropertiesConfigExc e) {\r
-      e.printStackTrace();\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Privater Konstruktor, um versehentliche Instantiierung zu verhindern\r
-   */\r
-  private FileUtil() {\r
-  }\r
-\r
-  public static File getFile(String filename) throws IOException {\r
-\r
-    try {\r
-      File f = null;\r
-      f = new File(filename);\r
-      File dir = new File(f.getParent());\r
-      dir.mkdirs();\r
-\r
-      return f;\r
-    }\r
-    catch (Exception e) {\r
-      throw new IOException(e.toString());\r
-    }\r
-\r
-  }\r
-\r
-  public static long write(File f, InputStream in) throws IOException {\r
-\r
-    long size = 0;\r
-\r
-    if (in != null) {\r
-      try {\r
-        FileOutputStream out = new FileOutputStream(f);\r
-\r
-        int read;\r
-        byte[] buf = new byte[8 * 1024];\r
-        while ( (read = in.read(buf)) != -1) {\r
-          out.write(buf, 0, read);\r
-          size += read;\r
-        }\r
-\r
-        in.close();\r
-        out.close();\r
-      }\r
-      catch (IOException e) {\r
-        throw new IOException(e.toString());\r
-      }\r
-    }\r
-    return size;\r
-  }\r
-\r
-  public static long write(String filename, InputStream in) throws IOException {\r
-\r
-    long size = 0;\r
-\r
-    if (in != null) {\r
-      try {\r
-        File f = getFile(filename);\r
-        size = write(f, in);\r
-      }\r
-      catch (IOException e) {\r
-        throw new IOException(e.toString());\r
-      }\r
-    }\r
-    return size;\r
-  }\r
-\r
-  public static long write(String filename, Reader in, String encoding) throws IOException {\r
-\r
-    long size = 0;\r
-\r
-    if (in != null) {\r
-      try {\r
-        File f = getFile(filename);\r
-        FileOutputStream fOut = new FileOutputStream(f);\r
-        OutputStreamWriter out = new OutputStreamWriter(fOut, encoding);\r
-        int read;\r
-        char[] cbuf = new char[8 * 1024];\r
-        while ( (read = in.read(cbuf)) != -1) {\r
-          out.write(cbuf, 0, read);\r
-          size += read;\r
-        }\r
-\r
-        out.close();\r
-        in.close();\r
-      }\r
-      catch (IOException e) {\r
-        throw new IOException(e.toString());\r
-      }\r
-    }\r
-    return size;\r
-  }\r
-\r
-  public static boolean read(String filename, byte out[]) throws IOException {\r
-\r
-    File f = null;\r
-    f = new File(filename);\r
-\r
-    if (f.exists()) {\r
-      try {\r
-        if (out.length != f.length())\r
-          return false;\r
-        FileInputStream inStream;\r
-        inStream = new FileInputStream(f);\r
-        inStream.read(out);\r
-        inStream.close();\r
-      }\r
-      catch (IOException e) {\r
-        throw new IOException(e.toString());\r
-      }\r
-    }\r
-    else {\r
-      return false;\r
-    }\r
-    return true;\r
-  }\r
-\r
-  public static long getSize(String filename) {\r
-    File f = null;\r
-    f = new File(filename);\r
-    long l = 0;\r
-\r
-    if (f.exists()) {\r
-      return f.length();\r
-    }\r
-    else {\r
-      return -1;\r
-    }\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.misc;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+
+/**
+ * Hilfsklasse zum Mergen von Template und Daten
+ */
+public final class FileUtil {
+
+  private static String producerStorageRoot;
+
+  //
+  // Initialisierung
+
+  static {
+    try {
+      producerStorageRoot =
+          MirPropertiesConfiguration.instance().getString("Producer.StorageRoot");
+    }
+    catch (PropertiesConfigExc e) {
+      e.printStackTrace();
+    }
+  }
+
+  /**
+   * Privater Konstruktor, um versehentliche Instantiierung zu verhindern
+   */
+  private FileUtil() {
+  }
+
+  public static File getFile(String filename) throws IOException {
+
+    try {
+      File f = null;
+      f = new File(filename);
+      File dir = new File(f.getParent());
+      dir.mkdirs();
+
+      return f;
+    }
+    catch (Exception e) {
+      throw new IOException(e.toString());
+    }
+
+  }
+
+  public static long write(File f, InputStream in) throws IOException {
+
+    long size = 0;
+
+    if (in != null) {
+      try {
+        FileOutputStream out = new FileOutputStream(f);
+
+        int read;
+        byte[] buf = new byte[8 * 1024];
+        while ( (read = in.read(buf)) != -1) {
+          out.write(buf, 0, read);
+          size += read;
+        }
+
+        in.close();
+        out.close();
+      }
+      catch (IOException e) {
+        throw new IOException(e.toString());
+      }
+    }
+    return size;
+  }
+
+  public static long write(String filename, InputStream in) throws IOException {
+
+    long size = 0;
+
+    if (in != null) {
+      try {
+        File f = getFile(filename);
+        size = write(f, in);
+      }
+      catch (IOException e) {
+        throw new IOException(e.toString());
+      }
+    }
+    return size;
+  }
+
+  public static long write(String filename, Reader in, String encoding) throws IOException {
+
+    long size = 0;
+
+    if (in != null) {
+      try {
+        File f = getFile(filename);
+        FileOutputStream fOut = new FileOutputStream(f);
+        OutputStreamWriter out = new OutputStreamWriter(fOut, encoding);
+        int read;
+        char[] cbuf = new char[8 * 1024];
+        while ( (read = in.read(cbuf)) != -1) {
+          out.write(cbuf, 0, read);
+          size += read;
+        }
+
+        out.close();
+        in.close();
+      }
+      catch (IOException e) {
+        throw new IOException(e.toString());
+      }
+    }
+    return size;
+  }
+
+  public static boolean read(String filename, byte out[]) throws IOException {
+
+    File f = null;
+    f = new File(filename);
+
+    if (f.exists()) {
+      try {
+        if (out.length != f.length())
+          return false;
+        FileInputStream inStream;
+        inStream = new FileInputStream(f);
+        inStream.read(out);
+        inStream.close();
+      }
+      catch (IOException e) {
+        throw new IOException(e.toString());
+      }
+    }
+    else {
+      return false;
+    }
+    return true;
+  }
+
+  public static long getSize(String filename) {
+    File f = null;
+    f = new File(filename);
+    long l = 0;
+
+    if (f.exists()) {
+      return f.length();
+    }
+    else {
+      return -1;
+    }
+  }
+
+}
index f23a66d..5b842a2 100755 (executable)
@@ -41,6 +41,15 @@ import java.util.Set;
 \r
 import javax.servlet.http.HttpServletResponse;\r
 \r
+import org.apache.struts.util.MessageResources;\r
+\r
+import freemarker.template.FileTemplateCache;\r
+import freemarker.template.SimpleHash;\r
+import freemarker.template.SimpleList;\r
+import freemarker.template.SimpleScalar;\r
+import freemarker.template.Template;\r
+import freemarker.template.TemplateModelRoot;\r
+\r
 import mir.config.MirPropertiesConfiguration;\r
 import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
 import mir.entity.Entity;\r
@@ -50,15 +59,7 @@ import mir.log.LoggerWrapper;
 import mir.storage.StorageObjectFailure;\r
 import mir.util.GeneratorHTMLFunctions;\r
 import mir.util.GeneratorIntegerFunctions;\r
-\r
-import org.apache.struts.util.MessageResources;\r
-\r
-import freemarker.template.FileTemplateCache;\r
-import freemarker.template.SimpleHash;\r
-import freemarker.template.SimpleList;\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.Template;\r
-import freemarker.template.TemplateModelRoot;\r
+import mir.util.*;\r
 \r
 /**\r
  * Hilfsklasse zum Mergen von Template und Daten\r
@@ -66,6 +67,7 @@ import freemarker.template.TemplateModelRoot;
 public final class HTMLTemplateProcessor {\r
 \r
   public static String templateDir;\r
+  private static final String[] bundles = { "bundles.adminlocal", "bundles.admin" };\r
   private static MirPropertiesConfiguration configuration;\r
   private static FileTemplateCache templateCache;\r
   private static String docRoot;\r
@@ -108,28 +110,6 @@ public final class HTMLTemplateProcessor {
   private HTMLTemplateProcessor() {\r
   }\r
 \r
-  // process-methods to merge different datastructures\r
-  // with freemarker templates\r
-\r
-  /**\r
-   * Wandelt <code>anEntity</code> in freemarker-Struktur um, mischt die Daten mit\r
-   * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
-   * <code>out</code>\r
-   *\r
-   * @param templateFilename\r
-   * @param anEntity\r
-   * @param out\r
-   * @exception HTMLParseException\r
-   */\r
-\r
-  public static void process(String templateFilename, Entity anEntity,\r
-                             PrintWriter out) throws HTMLParseException {\r
-    if (anEntity == null)\r
-      throw new HTMLParseException("entity is empty!");\r
-    else\r
-      process(templateFilename, anEntity, out);\r
-  }\r
-\r
   /**\r
    * Wandelt Liste mit Entities <code>entList</code> in freemarker-Struktur um, mischt die Daten mit\r
    * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
@@ -140,10 +120,9 @@ public final class HTMLTemplateProcessor {
    * @param out\r
    * @exception HTMLParseException\r
    */\r
-  public static void process(HttpServletResponse res, String templateFilename,\r
-   EntityList entList, PrintWriter out, Locale locale) throws HTMLParseException {\r
-    process(res, templateFilename, entList, (String)null, (TemplateModelRoot)null,\r
-            out, locale);\r
+\r
+  public static void process(HttpServletResponse res, String templateFilename, EntityList entList, PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
+    process(res, templateFilename, entList, (String)null, (TemplateModelRoot) null, out, locale, aFallbackLocale);\r
   }\r
 \r
   /**\r
@@ -163,12 +142,12 @@ public final class HTMLTemplateProcessor {
   public static void process(HttpServletResponse res, String templateFilename,\r
                              EntityList entList, String additionalModelName,\r
                              TemplateModelRoot additionalModel, PrintWriter out,\r
-                             Locale locale) throws HTMLParseException {\r
+                             Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
 \r
     SimpleHash modelRoot = new SimpleHash();\r
 \r
     if (entList == null) {\r
-      process(null, templateFilename, modelRoot, out, locale);\r
+      process(null, templateFilename, modelRoot, null, out, locale, aFallbackLocale);\r
     }\r
     else {\r
       try {\r
@@ -178,7 +157,7 @@ public final class HTMLTemplateProcessor {
         if (additionalModelName != null && additionalModel != null)\r
           modelRoot.put(additionalModelName, additionalModel);\r
 \r
-        process(res, templateFilename, modelRoot, out, locale);\r
+        process(res, templateFilename, modelRoot, null, out, locale, aFallbackLocale);\r
       }\r
       catch (StorageObjectFailure e) {\r
         throw new HTMLParseException(e.toString());\r
@@ -188,20 +167,6 @@ public final class HTMLTemplateProcessor {
 \r
 \r
   /**\r
-   * Gibt Template <code>templateFilename</code> an den PrintWriter\r
-   * <code>out</code>\r
-   *\r
-   * @param templateFilename\r
-   * @param mergeData\r
-   * @param out\r
-   * @exception HTMLParseException\r
-   */\r
-  public static void process(String templateFilename, PrintWriter out,\r
-                             Locale locale) throws HTMLParseException {\r
-    process(null, templateFilename, (TemplateModelRoot)null, out, locale);\r
-  }\r
-\r
-  /**\r
    * Mischt die freemarker-Struktur <code>tmr</code> mit\r
    * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
    * <code>out</code>\r
@@ -213,20 +178,8 @@ public final class HTMLTemplateProcessor {
    */\r
   public static void process(HttpServletResponse res, String templateFilename,\r
                              TemplateModelRoot tmr, PrintWriter out,\r
-                             Locale locale) throws HTMLParseException {\r
-    process(res, templateFilename, tmr, null, out, locale);\r
-  }\r
-\r
-  public static void process(HttpServletResponse res, String templateFilename,\r
-                             TemplateModelRoot tmr, TemplateModelRoot extra,\r
-                             PrintWriter out, Locale locale) throws HTMLParseException {\r
-    process(res, templateFilename, tmr, extra, out, locale, "bundles.adminlocal", "bundles.admin");\r
-  }\r
-\r
-  public static void process(HttpServletResponse res, String templateFilename,\r
-       TemplateModelRoot tmr, TemplateModelRoot extra, PrintWriter out,\r
-       Locale locale, String bundles) throws HTMLParseException {\r
-    process(res, templateFilename, tmr, extra, out, locale, bundles, null);\r
+                             Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
+    process(res, templateFilename, tmr, null, out, locale, aFallbackLocale);\r
   }\r
 \r
   /**\r
@@ -241,8 +194,8 @@ public final class HTMLTemplateProcessor {
    */\r
   public static void process(HttpServletResponse res, String templateFilename,\r
                              TemplateModelRoot tmr, TemplateModelRoot extra,\r
-                             PrintWriter out, Locale locale, String bundles,\r
-                             String bundles2) throws HTMLParseException {\r
+                             PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
+\r
     if (out == null)\r
       throw new HTMLParseException("no outputstream");\r
     Template tmpl = getTemplateFor(templateFilename);\r
@@ -309,12 +262,17 @@ public final class HTMLTemplateProcessor {
     outPutHash.put("config", configHash);\r
     outPutHash.put("utility", utilityHash);\r
 \r
-    MessageResources messages = MessageResources.getMessageResources(bundles);\r
-    if (bundles2!=null) {\r
-      outPutHash.put("lang", new MessageMethodModel(locale, MessageResources.getMessageResources(bundles), MessageResources.getMessageResources(bundles2)));\r
+    MessageResources messages[] = new MessageResources[bundles.length];\r
+\r
+    for (int i=0; i<bundles.length; i++) {\r
+      messages[i] = MessageResources.getMessageResources(bundles[i]);\r
     }\r
-    else {\r
-      outPutHash.put("lang", new MessageMethodModel(locale, MessageResources.getMessageResources(bundles)));\r
+\r
+    try {\r
+      outPutHash.put("lang", FreemarkerGenerator.makeAdapter(new ResourceBundleGeneratorFunction(new Locale[] {locale, aFallbackLocale}, messages)));\r
+    }\r
+    catch (Throwable t) {\r
+      throw new HTMLParseException(t.toString());\r
     }\r
 \r
     tmpl.process(outPutHash, out);\r
@@ -444,10 +402,4 @@ public final class HTMLTemplateProcessor {
 \r
     return returnTemplate;\r
   }\r
-\r
-  public static void stopAutoUpdate() {\r
-    templateCache.stopAutoUpdate();\r
-    templateCache = null;\r
-  }\r
-\r
 }
\ No newline at end of file
diff --git a/source/mir/misc/MessageMethodModel.java b/source/mir/misc/MessageMethodModel.java
deleted file mode 100755 (executable)
index 9c4985a..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.misc;\r
-\r
-import java.util.List;\r
-import java.util.Locale;\r
-\r
-import org.apache.struts.util.MessageResources;\r
-\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.TemplateMethodModel;\r
-import freemarker.template.TemplateModel;\r
-\r
-/**\r
- * A FreeMarker <code>TemplateMethodModel</code> that provides access to a\r
- * Struts <code>MessageResources</code>, for use in Interantionalized templates.\r
- *\r
- * @author Kellan <kellan@protest.net>\r
- */\r
-\r
-public class MessageMethodModel implements TemplateMethodModel {\r
-\r
-  /**\r
-   * The perferred locale for this instance of MessageMethod.\r
-   */\r
-  private Locale locale;\r
-\r
-  /**\r
-   * The MessageResources to query, a single instance shared for\r
-   * the lifetime of servlet.\r
-   */\r
-  private MessageResources messages;\r
-  private MessageResources messages2;\r
-\r
-\r
-  /**\r
-   * Construct a MessageMethod that uses the JVM's default locale.\r
-   *\r
-   * @param message The MessageResources object to query\r
-   */\r
-  public MessageMethodModel(MessageResources messages) {\r
-    this(null, messages);\r
-  }\r
-\r
-  /**\r
-   * Construct a MessageMethod\r
-   *\r
-   * @param locale a Locale object, persumably initialized\r
-   *               from users Accept-Language header field\r
-   *\r
-   * @param message The MessageResources object to query\r
-   */\r
-  public MessageMethodModel(Locale aLocale, MessageResources aMessages) {\r
-    this(aLocale, aMessages, null);\r
-  }\r
-\r
-  public MessageMethodModel(Locale aLocale, MessageResources aMessages,\r
-                            MessageResources aMessages2) {\r
-    locale = aLocale;\r
-    messages = aMessages;\r
-    messages2 = aMessages2;\r
-  }\r
-\r
-  /**\r
-   * Takes the first argument as a resource key, then looks up\r
-   * a string in the MessagesResources, based on that key, and the Locale\r
-   *\r
-   * TODO: error messages should be i18n :)\r
-   *\r
-   * @param arguments List passed in by FM, first arguement is a string used as the key\r
-   *                  all subsequent arguments are used as described in MessageResources\r
-   *                  (they are filled into the placehoders of the string being returned)\r
-   */\r
-  public TemplateModel exec(List arguments) {\r
-    if (arguments != null) {\r
-      String key = (String) arguments.get(0);\r
-      arguments.remove(0);\r
-      String mesg = null;\r
-\r
-      if (messages!=null)\r
-        mesg = messages.getMessage(locale, key, arguments.toArray());\r
-\r
-      if (mesg == null && messages2!=null) {\r
-        mesg = messages2.getMessage(locale, key, arguments.toArray());\r
-      }\r
-\r
-      if (mesg == null) {\r
-        return new SimpleScalar(errUnknownTag + key);\r
-      }\r
-      return new SimpleScalar(mesg);\r
-    }\r
-    else {\r
-      return missingKeyScalar;\r
-    }\r
-  }\r
-\r
-  // i'm not real clear on how this is used - kellan :)\r
-  public boolean isEmpty() {\r
-    if (messages == null)\r
-      return true;\r
-    else\r
-      return false;\r
-  }\r
-\r
-  private static String errUnknownTag = "MESSAGE NOT FOUND: ";\r
-  private static String missingKey = "MESSAGE CALL WITHOUT KEY";\r
-  private static SimpleScalar missingKeyScalar = new SimpleScalar(missingKey);\r
-}\r
index 136acb1..253fd74 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.misc;\r
-\r
-/**\r
- * Title:\r
- * Description:\r
- * Copyright:    Copyright (c) 2002 Mir-coders\r
- * @author $Author: idfx $\r
- * @version $Id: WebdbImage.java,v 1.12 2003/03/05 19:23:14 idfx Exp $\r
- */\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.io.OutputStream;\r
-import java.util.Random;\r
-\r
-import javax.media.jai.InterpolationBilinear;\r
-import javax.media.jai.JAI;\r
-import javax.media.jai.ParameterBlockJAI;\r
-import javax.media.jai.PlanarImage;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-\r
-import com.sun.media.jai.codec.FileSeekableStream;\r
-\r
-public class WebdbImage\r
-{\r
-\r
-  // default values for scaling\r
-  private int maxIconSize;\r
-  private int maxImageSize;\r
-\r
-  private int iconWidth;\r
-  private int iconHeight;\r
-\r
-  Random r = new Random();\r
-\r
-  // internal representation of the image\r
-  private PlanarImage planarImage;\r
-\r
-  // type of the image\r
-  private String _type;\r
-\r
-  private WebdbImage() {\r
-  }\r
-\r
-  // constructor\r
-  // takes a temporary file as a parameter\r
-  public WebdbImage(File f, String type) throws Exception {\r
-    // It has to be a FileSeekableStream cause the image conversion\r
-    // needs to seek backwards.\r
-    maxImageSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxSize");\r
-    maxIconSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxIconSize");\r
-\r
-    planarImage = JAI.create("stream", new FileSeekableStream(f));\r
-    _type = type;\r
-    scaleImage();\r
-  }\r
-\r
-  // acc3ssor-methods\r
-  // must be run after scaleIcon()\r
-  public int getIconWidth() throws IOException {\r
-    return iconWidth;\r
-  }\r
-\r
-  // must be run after scaleIcon()\r
-  public int getIconHeight() throws IOException {\r
-    return iconHeight;\r
-  }\r
-\r
-  public int getImageWidth() {\r
-    return (int) planarImage.getWidth();\r
-  }\r
-\r
-  public int getImageHeight() {\r
-    return (int) planarImage.getHeight();\r
-  }\r
-\r
-  public void setImage(OutputStream outStream) {\r
-    JAI.create("encode", planarImage, outStream, _type, null);\r
-  }\r
-\r
-  public void setIcon(OutputStream outStream) throws IOException {\r
-    scaleIcon(outStream);\r
-  }\r
-\r
-  private void scaleImage() throws java.io.IOException {\r
-    if (maxImageSize > 0 &&\r
-        (getImageHeight() > maxImageSize || getImageWidth() > maxImageSize)) {\r
-      float scale;\r
-      ParameterBlockJAI params = new ParameterBlockJAI("scale");\r
-      params.addSource(planarImage);\r
-      if (getImageHeight() > getImageWidth())\r
-        scale = (float) maxImageSize / (float) getImageHeight();\r
-      else\r
-        scale = (float) maxImageSize / (float) getImageWidth();\r
-\r
-      params.setParameter("xScale", scale);\r
-      params.setParameter("yScale", scale);\r
-      params.setParameter("xTrans", 0.0F);\r
-      params.setParameter("yTrans", 0.0F);\r
-      params.setParameter("interpolation", new InterpolationBilinear());\r
-      planarImage = JAI.create("scale", params);\r
-    }\r
-  }\r
-\r
-  private void scaleIcon(OutputStream outStream) throws java.io.IOException {\r
-    float scale;\r
-    ParameterBlockJAI params = new ParameterBlockJAI("scale");\r
-    params.addSource(planarImage);\r
-    if (getImageHeight() > getImageWidth())\r
-      scale = (float) maxIconSize / (float) getImageHeight();\r
-    else\r
-      scale = (float) maxIconSize / (float) getImageWidth();\r
-\r
-    params.setParameter("xScale", scale);\r
-    params.setParameter("yScale", scale);\r
-    params.setParameter("xTrans", 0.0F);\r
-    params.setParameter("yTrans", 0.0F);\r
-    params.setParameter("interpolation", new InterpolationBilinear());\r
-    PlanarImage temp = JAI.create("scale", params);\r
-    JAI.create("encode", temp, outStream, _type, null);\r
-    iconWidth = temp.getWidth();\r
-    iconHeight = temp.getHeight();\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.misc;
+
+/**
+ * Title:
+ * Description:
+ * Copyright:    Copyright (c) 2002 Mir-coders
+ * @author $Author: zapata $
+ * @version $Id: WebdbImage.java,v 1.13 2003/04/09 02:06:07 zapata Exp $
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Random;
+
+import javax.media.jai.InterpolationBilinear;
+import javax.media.jai.JAI;
+import javax.media.jai.ParameterBlockJAI;
+import javax.media.jai.PlanarImage;
+
+import mir.config.MirPropertiesConfiguration;
+
+import com.sun.media.jai.codec.FileSeekableStream;
+
+public class WebdbImage
+{
+
+  // default values for scaling
+  private int maxIconSize;
+  private int maxImageSize;
+
+  private int iconWidth;
+  private int iconHeight;
+
+  Random r = new Random();
+
+  // internal representation of the image
+  private PlanarImage planarImage;
+
+  // type of the image
+  private String _type;
+
+  private WebdbImage() {
+  }
+
+  // constructor
+  // takes a temporary file as a parameter
+  public WebdbImage(File f, String type) throws Exception {
+    // It has to be a FileSeekableStream cause the image conversion
+    // needs to seek backwards.
+    maxImageSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxSize");
+    maxIconSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxIconSize");
+
+    planarImage = JAI.create("stream", new FileSeekableStream(f));
+    _type = type;
+    scaleImage();
+  }
+
+  // acc3ssor-methods
+  // must be run after scaleIcon()
+  public int getIconWidth() throws IOException {
+    return iconWidth;
+  }
+
+  // must be run after scaleIcon()
+  public int getIconHeight() throws IOException {
+    return iconHeight;
+  }
+
+  public int getImageWidth() {
+    return (int) planarImage.getWidth();
+  }
+
+  public int getImageHeight() {
+    return (int) planarImage.getHeight();
+  }
+
+  public void setImage(OutputStream outStream) {
+    JAI.create("encode", planarImage, outStream, _type, null);
+  }
+
+  public void setIcon(OutputStream outStream) throws IOException {
+    scaleIcon(outStream);
+  }
+
+  private void scaleImage() throws java.io.IOException {
+    if (maxImageSize > 0 &&
+        (getImageHeight() > maxImageSize || getImageWidth() > maxImageSize)) {
+      float scale;
+      ParameterBlockJAI params = new ParameterBlockJAI("scale");
+      params.addSource(planarImage);
+      if (getImageHeight() > getImageWidth())
+        scale = (float) maxImageSize / (float) getImageHeight();
+      else
+        scale = (float) maxImageSize / (float) getImageWidth();
+
+      params.setParameter("xScale", scale);
+      params.setParameter("yScale", scale);
+      params.setParameter("xTrans", 0.0F);
+      params.setParameter("yTrans", 0.0F);
+      params.setParameter("interpolation", new InterpolationBilinear());
+      planarImage = JAI.create("scale", params);
+    }
+  }
+
+  private void scaleIcon(OutputStream outStream) throws java.io.IOException {
+    float scale;
+    ParameterBlockJAI params = new ParameterBlockJAI("scale");
+    params.addSource(planarImage);
+    if (getImageHeight() > getImageWidth())
+      scale = (float) maxIconSize / (float) getImageHeight();
+    else
+      scale = (float) maxIconSize / (float) getImageWidth();
+
+    params.setParameter("xScale", scale);
+    params.setParameter("yScale", scale);
+    params.setParameter("xTrans", 0.0F);
+    params.setParameter("yTrans", 0.0F);
+    params.setParameter("interpolation", new InterpolationBilinear());
+    PlanarImage temp = JAI.create("scale", params);
+    JAI.create("encode", temp, outStream, _type, null);
+    iconWidth = temp.getWidth();
+    iconHeight = temp.getHeight();
+  }
+
 }
\ No newline at end of file
index 2e0b628..de00c44 100755 (executable)
@@ -31,9 +31,9 @@
 
 package mir.producer;
 
-import java.util.Map;\r
-\r
-import mir.log.LoggerWrapper;\r
+import java.util.Map;
+
+import mir.log.LoggerWrapper;
 import mir.util.ParameterExpander;
 
 public class ExpandedAssignmentProducerNode implements ProducerNode {
index c3d17e7..d3ee397 100755 (executable)
@@ -1,36 +1,36 @@
-package mir.producer;\r
-\r
-import java.util.Map;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.rss.RSSData;\r
-import mir.rss.RSSReader;\r
-import mir.rss.RSSToMapConverter;\r
-import mir.util.ParameterExpander;\r
-import mir.util.ExceptionFunctions;\r
-\r
-public class RSSProducerNode implements ProducerNode {\r
-  private String key;\r
-  private String url;\r
-\r
-  public RSSProducerNode(String aKey, String anURL) {\r
-    key = aKey;\r
-    url = anURL;\r
-  }\r
-\r
-  public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {\r
-    try {\r
-      String expandedKey = ParameterExpander.expandExpression( aValueMap, key );\r
-      String expandedUrl = ParameterExpander.expandExpression( aValueMap, url );\r
-\r
-      ParameterExpander.setValueForKey(aValueMap, expandedKey, null);\r
-      RSSReader reader = new RSSReader();\r
-      RSSData rssData = reader.parseUrl(expandedUrl);\r
-      ParameterExpander.setValueForKey(aValueMap, expandedKey, RSSToMapConverter.convertRSSData(rssData));\r
-    }\r
-    catch (Throwable t) {\r
-      Throwable s = ExceptionFunctions.traceCauseException(t);\r
-      aLogger.error("Error while processing RSS data: " + s.getClass().getName()+","+ s.getMessage());\r
-    }\r
-  };\r
+package mir.producer;
+
+import java.util.Map;
+
+import mir.log.LoggerWrapper;
+import mir.rss.RSSData;
+import mir.rss.RSSReader;
+import mir.rss.RSSToMapConverter;
+import mir.util.ParameterExpander;
+import mir.util.ExceptionFunctions;
+
+public class RSSProducerNode implements ProducerNode {
+  private String key;
+  private String url;
+
+  public RSSProducerNode(String aKey, String anURL) {
+    key = aKey;
+    url = anURL;
+  }
+
+  public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {
+    try {
+      String expandedKey = ParameterExpander.expandExpression( aValueMap, key );
+      String expandedUrl = ParameterExpander.expandExpression( aValueMap, url );
+
+      ParameterExpander.setValueForKey(aValueMap, expandedKey, null);
+      RSSReader reader = new RSSReader();
+      RSSData rssData = reader.parseUrl(expandedUrl);
+      ParameterExpander.setValueForKey(aValueMap, expandedKey, RSSToMapConverter.convertRSSData(rssData));
+    }
+    catch (Throwable t) {
+      Throwable s = ExceptionFunctions.traceCauseException(t);
+      aLogger.error("Error while processing RSS data: " + s.getClass().getName()+","+ s.getMessage());
+    }
+  };
 }
\ No newline at end of file
index 6252402..14f4953 100755 (executable)
 
 package mir.producer.reader;
 
-import java.util.Arrays;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.generator.Generator;\r
-import mir.generator.WriterEngine;\r
-import mir.log.LoggerWrapper;\r
-import mir.producer.ConditionalProducerNode;\r
-import mir.producer.DirCopyingProducerNode;\r
-import mir.producer.EntityBatchingProducerNode;\r
-import mir.producer.EntityEnumeratingProducerNode;\r
-import mir.producer.EntityListProducerNode;\r
-import mir.producer.EvaluatedAssignmentProducerNode;\r
-import mir.producer.ExpandedAssignmentProducerNode;\r
-import mir.producer.FileDateSettingProducerNode;\r
-import mir.producer.FileDeletingProducerNode;\r
-import mir.producer.GeneratingProducerNode;\r
-import mir.producer.LoggingProducerNode;\r
-import mir.producer.LoopProducerNode;\r
-import mir.producer.ProducerNode;\r
-import mir.producer.RSSProducerNode;\r
-import mir.producer.ResourceBundleProducerNode;\r
-import mir.producer.ScriptCallingProducerNode;\r
-import mir.util.XMLReader;\r
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import mir.entity.adapter.EntityAdapterModel;
+import mir.generator.Generator;
+import mir.generator.WriterEngine;
+import mir.log.LoggerWrapper;
+import mir.producer.ConditionalProducerNode;
+import mir.producer.DirCopyingProducerNode;
+import mir.producer.EntityBatchingProducerNode;
+import mir.producer.EntityEnumeratingProducerNode;
+import mir.producer.EntityListProducerNode;
+import mir.producer.EvaluatedAssignmentProducerNode;
+import mir.producer.ExpandedAssignmentProducerNode;
+import mir.producer.FileDateSettingProducerNode;
+import mir.producer.FileDeletingProducerNode;
+import mir.producer.GeneratingProducerNode;
+import mir.producer.LoggingProducerNode;
+import mir.producer.LoopProducerNode;
+import mir.producer.ProducerNode;
+import mir.producer.RSSProducerNode;
+import mir.producer.ResourceBundleProducerNode;
+import mir.producer.ScriptCallingProducerNode;
+import mir.util.XMLReader;
 import mir.util.XMLReaderTool;
 
 public class DefaultProducerNodeBuilders {
index 46249ef..1eabcc2 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mir.producer.reader;\r
-\r
-import java.io.File;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-import java.util.Vector;\r
-\r
-import mir.producer.CompositeProducerNode;\r
-import mir.producer.ProducerFactory;\r
-import mir.producer.ProducerNode;\r
-import mir.producer.SimpleProducerVerb;\r
-import mir.util.XMLReader;\r
-import mir.util.XMLReaderTool;\r
-\r
-public class ProducerConfigReader {\r
-  private ProducerNodeBuilderLibrary builderLibrary;\r
-  private ProducerNodeBuilderLibrary scriptedNodeBuilderLibrary;\r
-\r
-  public ProducerConfigReader() {\r
-    super();\r
-  };\r
-\r
-  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {\r
-    parseFile(aFileName, aBuilderLibrary, aProducerFactories, new Vector());\r
-  }\r
-\r
-  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories, List aUsedFiles) throws ProducerConfigFailure {\r
-    try {\r
-      XMLReader reader = new XMLReader();\r
-      aUsedFiles.add(new File(aFileName));\r
-\r
-      builderLibrary = aBuilderLibrary;\r
-      scriptedNodeBuilderLibrary = new ProducerNodeBuilderLibrary();\r
-\r
-      reader.parseFile(aFileName, new RootSectionHandler(aProducerFactories));\r
-\r
-    }\r
-    catch (Throwable e) {\r
-      if ((e instanceof XMLReader.XMLReaderExc) && ((XMLReader.XMLReaderExc) e).getHasLocation()) {\r
-        XMLReader.XMLReaderExc f = (XMLReader.XMLReaderExc) e;\r
-        throw new ProducerConfigFailure("'" + f.getMessage()+"' in " + f.getFilename()+"(line " + f.getLineNr()+", column " + f.getColumnNr() + ")", e);\r
-      }\r
-      throw new ProducerConfigFailure( e );\r
-    }\r
-  }\r
-\r
-\r
-  public class RootSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private List producers;\r
-\r
-    public RootSectionHandler(List aProducers) {\r
-      producers = aProducers;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("producers")) {\r
-        return new ProducersSectionHandler(producers);\r
-      }\r
-      else\r
-        throw new XMLReader.XMLReaderExc("Tag 'producers' expected, tag '"+aTag+"' found");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) {\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-  }\r
-\r
-\r
-  private final static String   PRODUCER_NAME_ATTRIBUTE = "name";\r
-  private final static String[] PRODUCER_REQUIRED_ATTRIBUTES = { PRODUCER_NAME_ATTRIBUTE };\r
-  private final static String[] PRODUCER_OPTIONAL_ATTRIBUTES = { };\r
-\r
-  private final static String   NODE_DEFINITION_NAME_ATTRIBUTE = "name";\r
-  private final static String[] NODE_DEFINITION_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_NAME_ATTRIBUTE };\r
-  private final static String[] NODE_DEFINITION_OPTIONAL_ATTRIBUTES = {  };\r
-\r
-  public class ProducersSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private List producers;\r
-    private Set producerNames;\r
-    private String name;\r
-\r
-    public ProducersSectionHandler(List aProducers) {\r
-      producers = aProducers;\r
-      producerNames = new HashSet();\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("producer")) {\r
-        XMLReaderTool.checkAttributes(anAttributes,\r
-                                      PRODUCER_REQUIRED_ATTRIBUTES,\r
-                                      PRODUCER_OPTIONAL_ATTRIBUTES);\r
-\r
-        name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);\r
-        XMLReaderTool.checkValidIdentifier(name);\r
-\r
-        if (producerNames.contains(name))\r
-          throw new XMLReader.XMLReaderExc("Duplicate producer name: '" +\r
-                                           name + "'");\r
-\r
-        name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);\r
-\r
-        return new ProducerSectionHandler(name);\r
-      }\r
-      else if (aTag.equals("nodedefinition")) {\r
-        XMLReaderTool.checkAttributes(anAttributes,\r
-                                      NODE_DEFINITION_REQUIRED_ATTRIBUTES,\r
-                                      NODE_DEFINITION_OPTIONAL_ATTRIBUTES);\r
-\r
-        name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);\r
-        XMLReaderTool.checkValidIdentifier(name);\r
-\r
-        name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);\r
-\r
-        return new NodeDefinitionSectionHandler(name);\r
-      }\r
-      throw new XMLReader.XMLReaderExc("Unexpected tag: " + aTag);\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (aHandler instanceof ProducerSectionHandler) {\r
-        producers.add(((ProducerSectionHandler) aHandler).getProducerFactory());\r
-        producerNames.add(((ProducerSectionHandler) aHandler).getProducerFactory().getName());\r
-      }\r
-      else if (aHandler instanceof NodeDefinitionSectionHandler) {\r
-        scriptedNodeBuilderLibrary.registerFactory(name,\r
-            new DefaultProducerNodeBuilders.ScriptedProducerNodeBuilder.factory(\r
-                ((NodeDefinitionSectionHandler) aHandler).getDefinition()));\r
-      }\r
-      else throw new XMLReader.XMLReaderExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-  }\r
-\r
-  public class ProducerSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private ProducerFactory producerFactory;\r
-    private String factoryName;\r
-\r
-    private ProducerNode body;\r
-    private Map verbNodes;\r
-    private List verbs;\r
-    private String defaultVerb;\r
-\r
-    public ProducerSectionHandler(String aName) {\r
-      factoryName = aName;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("verbs")) {\r
-        if (verbs!=null)\r
-          throw new XMLReader.XMLReaderExc("Verbs already processed");\r
-        if (body!=null)\r
-          throw new XMLReader.XMLReaderExc("Verbs should come before body");\r
-        else\r
-          return new ProducerVerbsSectionHandler();\r
-      }\r
-      else if (aTag.equals("body")) {\r
-        if (body==null)\r
-          return new ProducerNodeSectionHandler();\r
-        else\r
-          throw new XMLReader.XMLReaderExc("Body already processed");\r
-      }\r
-      throw new XMLReader.XMLReaderExc("Unexpected tag: '"+aTag+"'");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (aHandler instanceof ProducerNodeSectionHandler) {\r
-        body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();\r
-      }\r
-      else if (aHandler instanceof ProducerVerbsSectionHandler)\r
-      {\r
-        verbs = ((ProducerVerbsSectionHandler) aHandler).getVerbs();\r
-        verbNodes = ((ProducerVerbsSectionHandler) aHandler).getVerbNodes();\r
-        defaultVerb = ((ProducerVerbsSectionHandler) aHandler).getDefaultVerb();\r
-      }\r
-      else throw new XMLReader.XMLReaderExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());\r
-    }\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-      if (verbs==null)\r
-        throw new XMLReader.XMLReaderExc("No verbs defined");\r
-\r
-      if (body==null)\r
-        throw new XMLReader.XMLReaderExc("No body defined");\r
-\r
-      producerFactory = new ScriptedProducerFactory(factoryName, verbs, verbNodes, body, defaultVerb);\r
-    }\r
-\r
-    public ProducerFactory getProducerFactory() {\r
-      return producerFactory;\r
-    }\r
-  }\r
-\r
-  private final static String   PRODUCER_VERB_NAME_ATTRIBUTE = "name";\r
-  private final static String   PRODUCER_VERB_DESCRIPTION_ATTRIBUTE = "description";\r
-  private final static String   PRODUCER_VERB_DEFAULT_ATTRIBUTE = "default";\r
-  private final static String[] PRODUCER_VERB_REQUIRED_ATTRIBUTES = { PRODUCER_VERB_NAME_ATTRIBUTE };\r
-  private final static String[] PRODUCER_VERB_OPTIONAL_ATTRIBUTES = { PRODUCER_VERB_DEFAULT_ATTRIBUTE, PRODUCER_VERB_DESCRIPTION_ATTRIBUTE };\r
-\r
-  public class ProducerVerbsSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private Map verbNodes;\r
-    private List verbs;\r
-    private String defaultVerb;\r
-    private String currentVerb;\r
-    private String currentVerbDescription;\r
-\r
-    public ProducerVerbsSectionHandler() {\r
-      verbNodes = new HashMap();\r
-      verbs = new Vector();\r
-      defaultVerb = null;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("verb")) {\r
-        XMLReaderTool.checkAttributes(anAttributes,\r
-                                      PRODUCER_VERB_REQUIRED_ATTRIBUTES,\r
-                                      PRODUCER_VERB_OPTIONAL_ATTRIBUTES);\r
-        currentVerb = (String) anAttributes.get(PRODUCER_VERB_NAME_ATTRIBUTE);\r
-\r
-        XMLReaderTool.checkValidIdentifier(currentVerb);\r
-\r
-        if (verbNodes.containsKey(currentVerb))\r
-          throw new XMLReader.XMLReaderExc("Duplicate definition of verb '" +\r
-                                           currentVerb + "'");\r
-\r
-        if (anAttributes.containsKey(PRODUCER_VERB_DEFAULT_ATTRIBUTE)) {\r
-          if (defaultVerb != null)\r
-            throw new XMLReader.XMLReaderExc("Default verb already declared");\r
-\r
-          defaultVerb = currentVerb;\r
-        }\r
-\r
-        if (anAttributes.containsKey(PRODUCER_VERB_DESCRIPTION_ATTRIBUTE))\r
-          currentVerbDescription = (String) anAttributes.get(\r
-              PRODUCER_VERB_DESCRIPTION_ATTRIBUTE);\r
-        else\r
-          currentVerbDescription = "";\r
-\r
-        return new ProducerNodeSectionHandler();\r
-      }\r
-      else\r
-        throw new XMLReader.XMLReaderExc("Only 'verb' tags allowed here, '" +\r
-                                         aTag + "' encountered.");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) {\r
-      verbNodes.put(currentVerb, ((ProducerNodeSectionHandler) aHandler).getProducerNode());\r
-      verbs.add(new SimpleProducerVerb(currentVerb, currentVerbDescription));\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-\r
-    public String getDefaultVerb() {\r
-      return defaultVerb;\r
-    }\r
-\r
-    public List getVerbs() {\r
-      return verbs;\r
-    }\r
-\r
-    public Map getVerbNodes() {\r
-      return verbNodes;\r
-    }\r
-  }\r
-\r
-  public class EmptySectionHandler extends XMLReader.AbstractSectionHandler {\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      throw new XMLReader.XMLReaderExc("No tags are allowed here");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) {\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-  }\r
-\r
-  public class MultiProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private Map nodeParameters;\r
-    private Set validNodeParameters;\r
-    private String currentNodeParameter;\r
-    private String scriptedNodeName;\r
-    private Set allowedNodeParameterReferences;\r
-\r
-    public MultiProducerNodeSectionHandler(String aScriptedNodeName, Set anAllowedNodeParameterReferences, Set aValidNodeParameters) {\r
-      allowedNodeParameterReferences = anAllowedNodeParameterReferences;\r
-      scriptedNodeName = aScriptedNodeName;\r
-      validNodeParameters = aValidNodeParameters;\r
-      nodeParameters = new HashMap();\r
-    }\r
-    public MultiProducerNodeSectionHandler(Set aValidNodeParameters) {\r
-      this("", new HashSet(), aValidNodeParameters);\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (!validNodeParameters.contains(aTag))\r
-        throw new XMLReader.XMLReaderExc("Invalid node parameter: '" + aTag + "'");\r
-      else if (nodeParameters.containsKey(aTag))\r
-        throw new XMLReader.XMLReaderExc("Node parameter: '" + aTag + "' already specified");\r
-      else if (anAttributes.size()>0)\r
-        throw new XMLReader.XMLReaderExc("No parameters are allowed here");\r
-\r
-      currentNodeParameter = aTag;\r
-\r
-      return new ProducerNodeSectionHandler(scriptedNodeName, validNodeParameters);\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {\r
-      if (aHandler instanceof ProducerNodeSectionHandler) {\r
-        nodeParameters.put(currentNodeParameter, ((ProducerNodeSectionHandler) aHandler).getProducerNode());\r
-      }\r
-      else {\r
-        throw new XMLReader.XMLReaderExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );\r
-      }\r
-    }\r
-\r
-    public Map getNodeParameters() {\r
-      return nodeParameters;\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-  }\r
-\r
-  public class ProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private CompositeProducerNode producerNode;\r
-    private ProducerNodeBuilder currentBuilder;\r
-    private String scriptedNodeName;\r
-    private Set allowedNodeParameterReferences;\r
-\r
-    public ProducerNodeSectionHandler(String aScriptedNodeName, Set anAllowedNodeParameterReferences) {\r
-      producerNode = new CompositeProducerNode();\r
-      scriptedNodeName = aScriptedNodeName;\r
-      allowedNodeParameterReferences = anAllowedNodeParameterReferences;\r
-    }\r
-\r
-    public ProducerNodeSectionHandler() {\r
-      this("", new HashSet());\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      try {\r
-        if (allowedNodeParameterReferences.contains( (aTag))) {\r
-          if (!anAttributes.isEmpty()) {\r
-            throw new XMLReader.XMLReaderExc("No attributes allowed");\r
-          }\r
-\r
-          currentBuilder = new DefaultProducerNodeBuilders.\r
-              ScriptedProducerParameterNodeBuilder(scriptedNodeName, aTag);\r
-          return new EmptySectionHandler();\r
-        }\r
-        else if (scriptedNodeBuilderLibrary.hasBuilderForName(aTag) ||\r
-                 builderLibrary.hasBuilderForName( (aTag))) {\r
-\r
-          if (scriptedNodeBuilderLibrary.hasBuilderForName(aTag))\r
-            currentBuilder = scriptedNodeBuilderLibrary.constructBuilder(aTag);\r
-          else\r
-            currentBuilder = builderLibrary.constructBuilder(aTag);\r
-\r
-          currentBuilder.setAttributes(anAttributes);\r
-          if (currentBuilder.getAvailableSubNodes().isEmpty()) {\r
-            return new EmptySectionHandler();\r
-          }\r
-          if (currentBuilder.getAvailableSubNodes().size() > 1)\r
-            return new MultiProducerNodeSectionHandler(scriptedNodeName,\r
-                allowedNodeParameterReferences,\r
-                currentBuilder.getAvailableSubNodes());\r
-          else if (currentBuilder.getAvailableSubNodes().size() < 1)\r
-            return new EmptySectionHandler();\r
-          else {\r
-            return new ProducerNodeSectionHandler(scriptedNodeName,\r
-                allowedNodeParameterReferences);\r
-          }\r
-        }\r
-        else\r
-          throw new XMLReader.XMLReaderExc("Unknown producer node tag: '" +\r
-                                           aTag + "'");\r
-      }\r
-      catch (Throwable t) {\r
-        throw new XMLReader.XMLReaderFailure(t);\r
-      }\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {\r
-      try {\r
-        if (aHandler instanceof ProducerNodeSectionHandler) {\r
-          currentBuilder.setSubNode(\r
-                (String) (currentBuilder.getAvailableSubNodes().iterator().next()),\r
-                ((ProducerNodeSectionHandler) aHandler).getProducerNode());\r
-        }\r
-        else if (aHandler instanceof MultiProducerNodeSectionHandler) {\r
-          Iterator i;\r
-          Map nodeParameters;\r
-          Map.Entry entry;\r
-\r
-          nodeParameters = ( (MultiProducerNodeSectionHandler) aHandler).\r
-              getNodeParameters();\r
-          i = nodeParameters.entrySet().iterator();\r
-          while (i.hasNext()) {\r
-            entry = (Map.Entry) i.next();\r
-            currentBuilder.setSubNode( (String) entry.getKey(),\r
-                                      (ProducerNode) entry.getValue());\r
-          }\r
-        }\r
-        else if (aHandler instanceof EmptySectionHandler) {\r
-          // deliberately empty: nothing expected, so nothing to process\r
-        }\r
-        else {\r
-          throw new XMLReader.XMLReaderExc(\r
-              "Internal error: unknown section handler '" +\r
-              aHandler.getClass().getName() + "'");\r
-        }\r
-\r
-        producerNode.addSubNode(currentBuilder.constructNode());\r
-        currentBuilder = null;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new XMLReader.XMLReaderFailure(t);\r
-      }\r
-    }\r
-\r
-    public ProducerNode getProducerNode() {\r
-      if (producerNode.getNrSubNodes()==1) {\r
-        return producerNode.getSubNode(0);\r
-      }\r
-      else {\r
-        return producerNode;\r
-      }\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-  }\r
-\r
-  public class NodeDefinitionSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private ScriptedProducerNodeDefinition nodeDefinition;\r
-    private ProducerNode body;\r
-    private Map stringParameters;\r
-    private Map integerParameters;\r
-    private Map nodeParameters;\r
-    private String name;\r
-\r
-    public NodeDefinitionSectionHandler(String aName) {\r
-      body = null;\r
-      nodeParameters = null;\r
-      stringParameters = null;\r
-      integerParameters = null;\r
-      name = aName;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("parameters")) {\r
-        if (!anAttributes.isEmpty()) {\r
-          throw new XMLReader.XMLReaderExc( "No attributes allowed for tag 'parameters'" );\r
-        }\r
-        if (nodeParameters!=null) {\r
-          throw new XMLReader.XMLReaderExc( "Parameters have already been declared" );\r
-        }\r
-        if (body!=null) {\r
-          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'" );\r
-        }\r
-\r
-        return new NodeDefinitionParametersSectionHandler();\r
-      }\r
-      else if (aTag.equals("definition")) {\r
-        if (nodeParameters==null)\r
-          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'"  );\r
-\r
-        return new ProducerNodeSectionHandler(name, nodeParameters.keySet());\r
-      }\r
-      else throw new XMLReader.XMLReaderExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) {\r
-      if (aHandler instanceof NodeDefinitionParametersSectionHandler) {\r
-        stringParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getStringParameters();\r
-        integerParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getIntegerParameters();\r
-        nodeParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getNodeParameters();\r
-      }\r
-      else if (aHandler instanceof ProducerNodeSectionHandler) {\r
-        body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();\r
-      }\r
-    }\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-      Iterator i;\r
-      if (body == null)\r
-        throw new XMLReader.XMLReaderExc( "Definition missing" );\r
-\r
-      nodeDefinition = new ScriptedProducerNodeDefinition(name);\r
-\r
-      nodeDefinition.setBody(body);\r
-\r
-      i = nodeParameters.keySet().iterator();\r
-      while (i.hasNext()) {\r
-        nodeDefinition.addNodeParameter((String) i.next());\r
-      }\r
-\r
-      i = stringParameters.entrySet().iterator();\r
-      while (i.hasNext()) {\r
-        Map.Entry entry = (Map.Entry) i.next();\r
-        nodeDefinition.addStringParameter((String) entry.getKey(), (String) entry.getValue());\r
-      }\r
-\r
-      i = integerParameters.entrySet().iterator();\r
-      while (i.hasNext()) {\r
-        Map.Entry entry = (Map.Entry) i.next();\r
-        nodeDefinition.addIntegerParameter((String) entry.getKey(), (String) entry.getValue());\r
-      }\r
-    }\r
-\r
-    public ScriptedProducerNodeDefinition getDefinition() {\r
-      return nodeDefinition;\r
-    }\r
-  }\r
-\r
-  private final static String   NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE = "name";\r
-  private final static String   NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE = "defaultvalue";\r
-  private final static String[] NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE };\r
-  private final static String[] NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE };\r
-  private final static String[] NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES = { };\r
-\r
-  public class NodeDefinitionParametersSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private Map nodeParameters;\r
-    private Map stringParameters;\r
-    private Map integerParameters;\r
-\r
-    public NodeDefinitionParametersSectionHandler() {\r
-      nodeParameters = new HashMap();\r
-      stringParameters = new HashMap();\r
-      integerParameters = new HashMap();\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      String parameterName;\r
-      String defaultValue;\r
-\r
-      if (aTag.equals("node")) {\r
-        XMLReaderTool.checkAttributes(anAttributes,\r
-            NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,\r
-            NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES);\r
-        parameterName = (String) anAttributes.get(\r
-            NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);\r
-\r
-        if (nodeParameters.containsKey(parameterName))\r
-          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +\r
-                                           parameterName + "'");\r
-\r
-        XMLReaderTool.checkValidIdentifier(parameterName);\r
-\r
-        nodeParameters.put(parameterName, parameterName);\r
-\r
-        return new EmptySectionHandler();\r
-      }\r
-      else if (aTag.equals("string") || aTag.equals("integer")) {\r
-        XMLReaderTool.checkAttributes(anAttributes,\r
-            NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,\r
-            NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES);\r
-        parameterName = (String) anAttributes.get(\r
-            NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);\r
-\r
-        if (stringParameters.containsKey(parameterName) ||\r
-            integerParameters.containsKey(parameterName))\r
-          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +\r
-                                           parameterName + "'");\r
-\r
-        XMLReaderTool.checkValidIdentifier(parameterName);\r
-\r
-        defaultValue = (String) anAttributes.get(\r
-            NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE);\r
-\r
-        if (aTag.equals("string"))\r
-          stringParameters.put(parameterName, defaultValue);\r
-        else\r
-          integerParameters.put(parameterName, defaultValue);\r
-\r
-        return new EmptySectionHandler();\r
-      }\r
-      else\r
-        throw new XMLReader.XMLReaderExc(\r
-            "Only 'string', 'integer' and 'node' tags allowed here, '" + aTag + "' encountered.");\r
-    }\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) {\r
-    }\r
-\r
-    public void finishSection() {\r
-    }\r
-\r
-    public Map getNodeParameters() {\r
-      return nodeParameters;\r
-    }\r
-\r
-    public Map getStringParameters() {\r
-      return stringParameters;\r
-    }\r
-\r
-    public Map getIntegerParameters() {\r
-      return integerParameters;\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mir.producer.reader;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import mir.producer.CompositeProducerNode;
+import mir.producer.ProducerFactory;
+import mir.producer.ProducerNode;
+import mir.producer.SimpleProducerVerb;
+import mir.util.XMLReader;
+import mir.util.XMLReaderTool;
+
+public class ProducerConfigReader {
+  private ProducerNodeBuilderLibrary builderLibrary;
+  private ProducerNodeBuilderLibrary scriptedNodeBuilderLibrary;
+
+  public ProducerConfigReader() {
+    super();
+  };
+
+  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
+    parseFile(aFileName, aBuilderLibrary, aProducerFactories, new Vector());
+  }
+
+  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories, List aUsedFiles) throws ProducerConfigFailure {
+    try {
+      XMLReader reader = new XMLReader();
+      aUsedFiles.add(new File(aFileName));
+
+      builderLibrary = aBuilderLibrary;
+      scriptedNodeBuilderLibrary = new ProducerNodeBuilderLibrary();
+
+      reader.parseFile(aFileName, new RootSectionHandler(aProducerFactories));
+
+    }
+    catch (Throwable e) {
+      if ((e instanceof XMLReader.XMLReaderExc) && ((XMLReader.XMLReaderExc) e).getHasLocation()) {
+        XMLReader.XMLReaderExc f = (XMLReader.XMLReaderExc) e;
+        throw new ProducerConfigFailure("'" + f.getMessage()+"' in " + f.getFilename()+"(line " + f.getLineNr()+", column " + f.getColumnNr() + ")", e);
+      }
+      throw new ProducerConfigFailure( e );
+    }
+  }
+
+
+  public class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+    private List producers;
+
+    public RootSectionHandler(List aProducers) {
+      producers = aProducers;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("producers")) {
+        return new ProducersSectionHandler(producers);
+      }
+      else
+        throw new XMLReader.XMLReaderExc("Tag 'producers' expected, tag '"+aTag+"' found");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) {
+    }
+
+    public void finishSection() {
+    }
+  }
+
+
+  private final static String   PRODUCER_NAME_ATTRIBUTE = "name";
+  private final static String[] PRODUCER_REQUIRED_ATTRIBUTES = { PRODUCER_NAME_ATTRIBUTE };
+  private final static String[] PRODUCER_OPTIONAL_ATTRIBUTES = { };
+
+  private final static String   NODE_DEFINITION_NAME_ATTRIBUTE = "name";
+  private final static String[] NODE_DEFINITION_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_NAME_ATTRIBUTE };
+  private final static String[] NODE_DEFINITION_OPTIONAL_ATTRIBUTES = {  };
+
+  public class ProducersSectionHandler extends XMLReader.AbstractSectionHandler {
+    private List producers;
+    private Set producerNames;
+    private String name;
+
+    public ProducersSectionHandler(List aProducers) {
+      producers = aProducers;
+      producerNames = new HashSet();
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("producer")) {
+        XMLReaderTool.checkAttributes(anAttributes,
+                                      PRODUCER_REQUIRED_ATTRIBUTES,
+                                      PRODUCER_OPTIONAL_ATTRIBUTES);
+
+        name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
+        XMLReaderTool.checkValidIdentifier(name);
+
+        if (producerNames.contains(name))
+          throw new XMLReader.XMLReaderExc("Duplicate producer name: '" +
+                                           name + "'");
+
+        name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
+
+        return new ProducerSectionHandler(name);
+      }
+      else if (aTag.equals("nodedefinition")) {
+        XMLReaderTool.checkAttributes(anAttributes,
+                                      NODE_DEFINITION_REQUIRED_ATTRIBUTES,
+                                      NODE_DEFINITION_OPTIONAL_ATTRIBUTES);
+
+        name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
+        XMLReaderTool.checkValidIdentifier(name);
+
+        name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
+
+        return new NodeDefinitionSectionHandler(name);
+      }
+      throw new XMLReader.XMLReaderExc("Unexpected tag: " + aTag);
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (aHandler instanceof ProducerSectionHandler) {
+        producers.add(((ProducerSectionHandler) aHandler).getProducerFactory());
+        producerNames.add(((ProducerSectionHandler) aHandler).getProducerFactory().getName());
+      }
+      else if (aHandler instanceof NodeDefinitionSectionHandler) {
+        scriptedNodeBuilderLibrary.registerFactory(name,
+            new DefaultProducerNodeBuilders.ScriptedProducerNodeBuilder.factory(
+                ((NodeDefinitionSectionHandler) aHandler).getDefinition()));
+      }
+      else throw new XMLReader.XMLReaderExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+    }
+
+    public void finishSection() {
+    }
+  }
+
+  public class ProducerSectionHandler extends XMLReader.AbstractSectionHandler {
+    private ProducerFactory producerFactory;
+    private String factoryName;
+
+    private ProducerNode body;
+    private Map verbNodes;
+    private List verbs;
+    private String defaultVerb;
+
+    public ProducerSectionHandler(String aName) {
+      factoryName = aName;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("verbs")) {
+        if (verbs!=null)
+          throw new XMLReader.XMLReaderExc("Verbs already processed");
+        if (body!=null)
+          throw new XMLReader.XMLReaderExc("Verbs should come before body");
+        else
+          return new ProducerVerbsSectionHandler();
+      }
+      else if (aTag.equals("body")) {
+        if (body==null)
+          return new ProducerNodeSectionHandler();
+        else
+          throw new XMLReader.XMLReaderExc("Body already processed");
+      }
+      throw new XMLReader.XMLReaderExc("Unexpected tag: '"+aTag+"'");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (aHandler instanceof ProducerNodeSectionHandler) {
+        body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();
+      }
+      else if (aHandler instanceof ProducerVerbsSectionHandler)
+      {
+        verbs = ((ProducerVerbsSectionHandler) aHandler).getVerbs();
+        verbNodes = ((ProducerVerbsSectionHandler) aHandler).getVerbNodes();
+        defaultVerb = ((ProducerVerbsSectionHandler) aHandler).getDefaultVerb();
+      }
+      else throw new XMLReader.XMLReaderExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+    }
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+      if (verbs==null)
+        throw new XMLReader.XMLReaderExc("No verbs defined");
+
+      if (body==null)
+        throw new XMLReader.XMLReaderExc("No body defined");
+
+      producerFactory = new ScriptedProducerFactory(factoryName, verbs, verbNodes, body, defaultVerb);
+    }
+
+    public ProducerFactory getProducerFactory() {
+      return producerFactory;
+    }
+  }
+
+  private final static String   PRODUCER_VERB_NAME_ATTRIBUTE = "name";
+  private final static String   PRODUCER_VERB_DESCRIPTION_ATTRIBUTE = "description";
+  private final static String   PRODUCER_VERB_DEFAULT_ATTRIBUTE = "default";
+  private final static String[] PRODUCER_VERB_REQUIRED_ATTRIBUTES = { PRODUCER_VERB_NAME_ATTRIBUTE };
+  private final static String[] PRODUCER_VERB_OPTIONAL_ATTRIBUTES = { PRODUCER_VERB_DEFAULT_ATTRIBUTE, PRODUCER_VERB_DESCRIPTION_ATTRIBUTE };
+
+  public class ProducerVerbsSectionHandler extends XMLReader.AbstractSectionHandler {
+    private Map verbNodes;
+    private List verbs;
+    private String defaultVerb;
+    private String currentVerb;
+    private String currentVerbDescription;
+
+    public ProducerVerbsSectionHandler() {
+      verbNodes = new HashMap();
+      verbs = new Vector();
+      defaultVerb = null;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("verb")) {
+        XMLReaderTool.checkAttributes(anAttributes,
+                                      PRODUCER_VERB_REQUIRED_ATTRIBUTES,
+                                      PRODUCER_VERB_OPTIONAL_ATTRIBUTES);
+        currentVerb = (String) anAttributes.get(PRODUCER_VERB_NAME_ATTRIBUTE);
+
+        XMLReaderTool.checkValidIdentifier(currentVerb);
+
+        if (verbNodes.containsKey(currentVerb))
+          throw new XMLReader.XMLReaderExc("Duplicate definition of verb '" +
+                                           currentVerb + "'");
+
+        if (anAttributes.containsKey(PRODUCER_VERB_DEFAULT_ATTRIBUTE)) {
+          if (defaultVerb != null)
+            throw new XMLReader.XMLReaderExc("Default verb already declared");
+
+          defaultVerb = currentVerb;
+        }
+
+        if (anAttributes.containsKey(PRODUCER_VERB_DESCRIPTION_ATTRIBUTE))
+          currentVerbDescription = (String) anAttributes.get(
+              PRODUCER_VERB_DESCRIPTION_ATTRIBUTE);
+        else
+          currentVerbDescription = "";
+
+        return new ProducerNodeSectionHandler();
+      }
+      else
+        throw new XMLReader.XMLReaderExc("Only 'verb' tags allowed here, '" +
+                                         aTag + "' encountered.");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) {
+      verbNodes.put(currentVerb, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
+      verbs.add(new SimpleProducerVerb(currentVerb, currentVerbDescription));
+    }
+
+    public void finishSection() {
+    }
+
+    public String getDefaultVerb() {
+      return defaultVerb;
+    }
+
+    public List getVerbs() {
+      return verbs;
+    }
+
+    public Map getVerbNodes() {
+      return verbNodes;
+    }
+  }
+
+  public class EmptySectionHandler extends XMLReader.AbstractSectionHandler {
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      throw new XMLReader.XMLReaderExc("No tags are allowed here");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) {
+    }
+
+    public void finishSection() {
+    }
+  }
+
+  public class MultiProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+    private Map nodeParameters;
+    private Set validNodeParameters;
+    private String currentNodeParameter;
+    private String scriptedNodeName;
+    private Set allowedNodeParameterReferences;
+
+    public MultiProducerNodeSectionHandler(String aScriptedNodeName, Set anAllowedNodeParameterReferences, Set aValidNodeParameters) {
+      allowedNodeParameterReferences = anAllowedNodeParameterReferences;
+      scriptedNodeName = aScriptedNodeName;
+      validNodeParameters = aValidNodeParameters;
+      nodeParameters = new HashMap();
+    }
+    public MultiProducerNodeSectionHandler(Set aValidNodeParameters) {
+      this("", new HashSet(), aValidNodeParameters);
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (!validNodeParameters.contains(aTag))
+        throw new XMLReader.XMLReaderExc("Invalid node parameter: '" + aTag + "'");
+      else if (nodeParameters.containsKey(aTag))
+        throw new XMLReader.XMLReaderExc("Node parameter: '" + aTag + "' already specified");
+      else if (anAttributes.size()>0)
+        throw new XMLReader.XMLReaderExc("No parameters are allowed here");
+
+      currentNodeParameter = aTag;
+
+      return new ProducerNodeSectionHandler(scriptedNodeName, validNodeParameters);
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {
+      if (aHandler instanceof ProducerNodeSectionHandler) {
+        nodeParameters.put(currentNodeParameter, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
+      }
+      else {
+        throw new XMLReader.XMLReaderExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );
+      }
+    }
+
+    public Map getNodeParameters() {
+      return nodeParameters;
+    }
+
+    public void finishSection() {
+    }
+  }
+
+  public class ProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+    private CompositeProducerNode producerNode;
+    private ProducerNodeBuilder currentBuilder;
+    private String scriptedNodeName;
+    private Set allowedNodeParameterReferences;
+
+    public ProducerNodeSectionHandler(String aScriptedNodeName, Set anAllowedNodeParameterReferences) {
+      producerNode = new CompositeProducerNode();
+      scriptedNodeName = aScriptedNodeName;
+      allowedNodeParameterReferences = anAllowedNodeParameterReferences;
+    }
+
+    public ProducerNodeSectionHandler() {
+      this("", new HashSet());
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      try {
+        if (allowedNodeParameterReferences.contains( (aTag))) {
+          if (!anAttributes.isEmpty()) {
+            throw new XMLReader.XMLReaderExc("No attributes allowed");
+          }
+
+          currentBuilder = new DefaultProducerNodeBuilders.
+              ScriptedProducerParameterNodeBuilder(scriptedNodeName, aTag);
+          return new EmptySectionHandler();
+        }
+        else if (scriptedNodeBuilderLibrary.hasBuilderForName(aTag) ||
+                 builderLibrary.hasBuilderForName( (aTag))) {
+
+          if (scriptedNodeBuilderLibrary.hasBuilderForName(aTag))
+            currentBuilder = scriptedNodeBuilderLibrary.constructBuilder(aTag);
+          else
+            currentBuilder = builderLibrary.constructBuilder(aTag);
+
+          currentBuilder.setAttributes(anAttributes);
+          if (currentBuilder.getAvailableSubNodes().isEmpty()) {
+            return new EmptySectionHandler();
+          }
+          if (currentBuilder.getAvailableSubNodes().size() > 1)
+            return new MultiProducerNodeSectionHandler(scriptedNodeName,
+                allowedNodeParameterReferences,
+                currentBuilder.getAvailableSubNodes());
+          else if (currentBuilder.getAvailableSubNodes().size() < 1)
+            return new EmptySectionHandler();
+          else {
+            return new ProducerNodeSectionHandler(scriptedNodeName,
+                allowedNodeParameterReferences);
+          }
+        }
+        else
+          throw new XMLReader.XMLReaderExc("Unknown producer node tag: '" +
+                                           aTag + "'");
+      }
+      catch (Throwable t) {
+        throw new XMLReader.XMLReaderFailure(t);
+      }
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {
+      try {
+        if (aHandler instanceof ProducerNodeSectionHandler) {
+          currentBuilder.setSubNode(
+                (String) (currentBuilder.getAvailableSubNodes().iterator().next()),
+                ((ProducerNodeSectionHandler) aHandler).getProducerNode());
+        }
+        else if (aHandler instanceof MultiProducerNodeSectionHandler) {
+          Iterator i;
+          Map nodeParameters;
+          Map.Entry entry;
+
+          nodeParameters = ( (MultiProducerNodeSectionHandler) aHandler).
+              getNodeParameters();
+          i = nodeParameters.entrySet().iterator();
+          while (i.hasNext()) {
+            entry = (Map.Entry) i.next();
+            currentBuilder.setSubNode( (String) entry.getKey(),
+                                      (ProducerNode) entry.getValue());
+          }
+        }
+        else if (aHandler instanceof EmptySectionHandler) {
+          // deliberately empty: nothing expected, so nothing to process
+        }
+        else {
+          throw new XMLReader.XMLReaderExc(
+              "Internal error: unknown section handler '" +
+              aHandler.getClass().getName() + "'");
+        }
+
+        producerNode.addSubNode(currentBuilder.constructNode());
+        currentBuilder = null;
+      }
+      catch (Throwable t) {
+        throw new XMLReader.XMLReaderFailure(t);
+      }
+    }
+
+    public ProducerNode getProducerNode() {
+      if (producerNode.getNrSubNodes()==1) {
+        return producerNode.getSubNode(0);
+      }
+      else {
+        return producerNode;
+      }
+    }
+
+    public void finishSection() {
+    }
+  }
+
+  public class NodeDefinitionSectionHandler extends XMLReader.AbstractSectionHandler {
+    private ScriptedProducerNodeDefinition nodeDefinition;
+    private ProducerNode body;
+    private Map stringParameters;
+    private Map integerParameters;
+    private Map nodeParameters;
+    private String name;
+
+    public NodeDefinitionSectionHandler(String aName) {
+      body = null;
+      nodeParameters = null;
+      stringParameters = null;
+      integerParameters = null;
+      name = aName;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("parameters")) {
+        if (!anAttributes.isEmpty()) {
+          throw new XMLReader.XMLReaderExc( "No attributes allowed for tag 'parameters'" );
+        }
+        if (nodeParameters!=null) {
+          throw new XMLReader.XMLReaderExc( "Parameters have already been declared" );
+        }
+        if (body!=null) {
+          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
+        }
+
+        return new NodeDefinitionParametersSectionHandler();
+      }
+      else if (aTag.equals("definition")) {
+        if (nodeParameters==null)
+          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'"  );
+
+        return new ProducerNodeSectionHandler(name, nodeParameters.keySet());
+      }
+      else throw new XMLReader.XMLReaderExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) {
+      if (aHandler instanceof NodeDefinitionParametersSectionHandler) {
+        stringParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getStringParameters();
+        integerParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getIntegerParameters();
+        nodeParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getNodeParameters();
+      }
+      else if (aHandler instanceof ProducerNodeSectionHandler) {
+        body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();
+      }
+    }
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+      Iterator i;
+      if (body == null)
+        throw new XMLReader.XMLReaderExc( "Definition missing" );
+
+      nodeDefinition = new ScriptedProducerNodeDefinition(name);
+
+      nodeDefinition.setBody(body);
+
+      i = nodeParameters.keySet().iterator();
+      while (i.hasNext()) {
+        nodeDefinition.addNodeParameter((String) i.next());
+      }
+
+      i = stringParameters.entrySet().iterator();
+      while (i.hasNext()) {
+        Map.Entry entry = (Map.Entry) i.next();
+        nodeDefinition.addStringParameter((String) entry.getKey(), (String) entry.getValue());
+      }
+
+      i = integerParameters.entrySet().iterator();
+      while (i.hasNext()) {
+        Map.Entry entry = (Map.Entry) i.next();
+        nodeDefinition.addIntegerParameter((String) entry.getKey(), (String) entry.getValue());
+      }
+    }
+
+    public ScriptedProducerNodeDefinition getDefinition() {
+      return nodeDefinition;
+    }
+  }
+
+  private final static String   NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE = "name";
+  private final static String   NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE = "defaultvalue";
+  private final static String[] NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE };
+  private final static String[] NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE };
+  private final static String[] NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES = { };
+
+  public class NodeDefinitionParametersSectionHandler extends XMLReader.AbstractSectionHandler {
+    private Map nodeParameters;
+    private Map stringParameters;
+    private Map integerParameters;
+
+    public NodeDefinitionParametersSectionHandler() {
+      nodeParameters = new HashMap();
+      stringParameters = new HashMap();
+      integerParameters = new HashMap();
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      String parameterName;
+      String defaultValue;
+
+      if (aTag.equals("node")) {
+        XMLReaderTool.checkAttributes(anAttributes,
+            NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
+            NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES);
+        parameterName = (String) anAttributes.get(
+            NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);
+
+        if (nodeParameters.containsKey(parameterName))
+          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+                                           parameterName + "'");
+
+        XMLReaderTool.checkValidIdentifier(parameterName);
+
+        nodeParameters.put(parameterName, parameterName);
+
+        return new EmptySectionHandler();
+      }
+      else if (aTag.equals("string") || aTag.equals("integer")) {
+        XMLReaderTool.checkAttributes(anAttributes,
+            NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
+            NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES);
+        parameterName = (String) anAttributes.get(
+            NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);
+
+        if (stringParameters.containsKey(parameterName) ||
+            integerParameters.containsKey(parameterName))
+          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+                                           parameterName + "'");
+
+        XMLReaderTool.checkValidIdentifier(parameterName);
+
+        defaultValue = (String) anAttributes.get(
+            NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE);
+
+        if (aTag.equals("string"))
+          stringParameters.put(parameterName, defaultValue);
+        else
+          integerParameters.put(parameterName, defaultValue);
+
+        return new EmptySectionHandler();
+      }
+      else
+        throw new XMLReader.XMLReaderExc(
+            "Only 'string', 'integer' and 'node' tags allowed here, '" + aTag + "' encountered.");
+    }
+
+    public void endElement(XMLReader.SectionHandler aHandler) {
+    }
+
+    public void finishSection() {
+    }
+
+    public Map getNodeParameters() {
+      return nodeParameters;
+    }
+
+    public Map getStringParameters() {
+      return stringParameters;
+    }
+
+    public Map getIntegerParameters() {
+      return integerParameters;
+    }
+  }
+}
index 5f24399..c5d4f1f 100755 (executable)
@@ -1,70 +1,70 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.rss;\r
-\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-public class RSSData {\r
-  private List items;\r
-  private Map item;\r
-  private RSSChannel channel;\r
-\r
-  protected RSSData() {\r
-    items = new Vector();\r
-    item = new HashMap();\r
-    channel = null;\r
-  }\r
-\r
-  protected void addItem(RSSItem anItem) {\r
-    items.add(anItem);\r
-    item.put(anItem.getIdentifier(), anItem);\r
-  };\r
-\r
-  public void setChannel(RSSChannel aChannel) {\r
-    channel = aChannel;\r
-  }\r
-\r
-  public RSSChannel getChannel() {\r
-    return channel;\r
-  }\r
-\r
-  public List getItems() {\r
-    return items;\r
-  }\r
-\r
-  public Map getItem() {\r
-    return item;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.rss;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+public class RSSData {
+  private List items;
+  private Map item;
+  private RSSChannel channel;
+
+  protected RSSData() {
+    items = new Vector();
+    item = new HashMap();
+    channel = null;
+  }
+
+  protected void addItem(RSSItem anItem) {
+    items.add(anItem);
+    item.put(anItem.getIdentifier(), anItem);
+  };
+
+  public void setChannel(RSSChannel aChannel) {
+    channel = aChannel;
+  }
+
+  public RSSChannel getChannel() {
+    return channel;
+  }
+
+  public List getItems() {
+    return items;
+  }
+
+  public Map getItem() {
+    return item;
+  }
+}
index 45fbe4f..86d9ec6 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.rss;\r
-\r
-import java.io.InputStream;\r
-import java.net.URL;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import mir.util.XMLReader;\r
-import mir.util.XMLReaderTool;\r
-\r
-/**\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
-public class RSSReader {\r
-  public RSSReader() {\r
-  }\r
-\r
-  public RSSData parseInputStream(InputStream aStream) throws RSSExc, RSSFailure {\r
-    try {\r
-      XMLReader xmlReader = new XMLReader();\r
-      RSSData result = new RSSData();\r
-      xmlReader.parseInputStream(aStream, new RootSectionHandler(result));\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RSSFailure(t);\r
-    }\r
-  }\r
-\r
-  public RSSData parseUrl(String anUrl) throws RSSExc, RSSFailure {\r
-    try {\r
-      InputStream inputStream = (InputStream) new URL(anUrl).getContent(new Class[] {InputStream.class});\r
-\r
-      if (inputStream==null)\r
-        throw new RSSExc("RSSChannel.parseUrl: Can't get url content");\r
-\r
-      return parseInputStream(inputStream);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RSSFailure(t);\r
-    }\r
-  }\r
-\r
-  private static class RootSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private RSSData data;\r
-\r
-    public RootSectionHandler(RSSData aData) {\r
-      data = aData;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (XMLReaderTool.getLocalNameFromQualifiedName(aTag).equals("RDF")) {\r
-        return new RDFSectionHandler(data);\r
-      }\r
-      else\r
-        throw new XMLReader.XMLReaderFailure(new RSSExc("'RDF' tag expected"));\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      if (aCharacters.trim().length()>0)\r
-        throw new XMLReader.XMLReaderExc("No character data allowed here");\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-  }\r
-\r
-  private static class RDFSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private RSSData data;\r
-\r
-    public RDFSectionHandler(RSSData aData) {\r
-      data = aData;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      String identifier = (String) anAttributes.get("rdf:about");\r
-\r
-      if (aTag.equals("channel")) {\r
-        if (identifier==null)\r
-          throw new XMLReader.XMLReaderFailure(new RSSExc("Missing rdf:about"));\r
-        else\r
-          return new ChannelSectionHandler(identifier);\r
-      }\r
-      else if (aTag.equals("item")) {\r
-        if (identifier==null)\r
-          throw new XMLReader.XMLReaderFailure(new RSSExc("Missing rdf:about"));\r
-        else\r
-          return new ItemSectionHandler(identifier);\r
-      }\r
-      else\r
-        return new DiscardingSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (aHandler instanceof ItemSectionHandler) {\r
-        data.addItem(((ItemSectionHandler) aHandler).getItem());\r
-      }\r
-      else if (aHandler instanceof ChannelSectionHandler) {\r
-        data.setChannel(((ChannelSectionHandler) aHandler).getChannel());\r
-      }\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      if (aCharacters.trim().length()>0)\r
-        throw new XMLReader.XMLReaderExc("No character data allowed here");\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-  }\r
-\r
-  private static class ChannelSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private String image;\r
-    private String currentTag;\r
-    private RSSChannel channel;\r
-\r
-    public ChannelSectionHandler(String anIdentifier) {\r
-      channel = new RSSChannel(anIdentifier);\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      currentTag = aTag;\r
-      if (currentTag.equals("items")) {\r
-        return new ChannelItemsSectionHandler();\r
-      }\r
-      else if (currentTag.equals("description") ||\r
-               currentTag.equals("link") ||\r
-               currentTag.equals("title")) {\r
-        return new PCDATASectionHandler();\r
-      }\r
-\r
-      return new DiscardingSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (currentTag.equals("items")) {\r
-        channel.setItems(((ChannelItemsSectionHandler) aHandler).getItems());\r
-      }\r
-      if (currentTag.equals("description")) {\r
-        channel.setDescription(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-      else if (currentTag.equals("title")) {\r
-        channel.setTitle(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-      else if (currentTag.equals("link")) {\r
-        channel.setLink(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      if (aCharacters.trim().length()>0)\r
-        throw new XMLReader.XMLReaderExc("No character data allowed here");\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public RSSChannel getChannel () {\r
-      return channel;\r
-    }\r
-  }\r
-\r
-  private static class ChannelItemsSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private List items;\r
-\r
-    public ChannelItemsSectionHandler() {\r
-      items = new Vector();\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("rdf:Seq"))\r
-        return new RDFSequenceSectionHandler();\r
-      else\r
-        return new DiscardingSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (aHandler instanceof RDFSequenceSectionHandler) {\r
-        items.addAll(((RDFSequenceSectionHandler) aHandler).getItems());\r
-      }\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      if (aCharacters.trim().length()>0)\r
-        throw new XMLReader.XMLReaderExc("No character data allowed here");\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public List getItems() {\r
-      return items;\r
-    }\r
-  }\r
-\r
-  private static class ItemSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private String currentTag;\r
-    private RSSItem item;\r
-\r
-    public ItemSectionHandler(String anIdentifier) {\r
-      item = new RSSItem(anIdentifier);\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      currentTag = aTag;\r
-\r
-      if (currentTag.equals("description") ||\r
-               currentTag.equals("link") ||\r
-               currentTag.equals("title")) {\r
-        return new PCDATASectionHandler();\r
-      }\r
-\r
-      return new DiscardingSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      if (currentTag.equals("description")) {\r
-        item.setDescription(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-      else if (currentTag.equals("title")) {\r
-        item.setTitle(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-      else if (currentTag.equals("link")) {\r
-        item.setLink(((PCDATASectionHandler) aHandler).getData());\r
-      }\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      if (aCharacters.trim().length()>0)\r
-        throw new XMLReader.XMLReaderExc("No character data allowed here");\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public RSSItem getItem() {\r
-      return item;\r
-    };\r
-  }\r
-\r
-  private static class PCDATASectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private StringBuffer data;\r
-\r
-    public PCDATASectionHandler() {\r
-      data = new StringBuffer();\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      throw new XMLReader.XMLReaderFailure(new RSSExc("No subtags allowed here"));\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      data.append(aCharacters);\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public String getData() {\r
-      return data.toString();\r
-    }\r
-  }\r
-\r
-\r
-  private static class RDFSequenceSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private List items;\r
-\r
-    public RDFSequenceSectionHandler() {\r
-      items = new Vector();\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      if (aTag.equals("rdf:li")) {\r
-        String item = (String) anAttributes.get("rdf:resource");\r
-\r
-        if (item!=null)\r
-          items.add(item);\r
-      }\r
-\r
-      return new DiscardingSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public List getItems() {\r
-      return items;\r
-    }\r
-  }\r
-\r
-  private static class RDFLiteralSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    private StringBuffer data;\r
-    private String tag;\r
-\r
-    public RDFLiteralSectionHandler() {\r
-      data = new StringBuffer();\r
-    }\r
-\r
-    protected StringBuffer getData() {\r
-      return data;\r
-    }\r
-\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      tag=aTag;\r
-      data.append("<"+tag+">");\r
-\r
-      return new RDFLiteralSectionHandler();\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-      data.append(((RDFLiteralSectionHandler) aHandler).getData());\r
-      data.append("</"+tag+">");\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-      data.append(aCharacters);\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-  }\r
-\r
-  private static class DiscardingSectionHandler extends XMLReader.AbstractSectionHandler {\r
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {\r
-      return this;\r
-    };\r
-\r
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {\r
-    };\r
-\r
-    public void finishSection() throws XMLReader.XMLReaderExc {\r
-    };\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.rss;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.util.XMLReader;
+import mir.util.XMLReaderTool;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+public class RSSReader {
+  public RSSReader() {
+  }
+
+  public RSSData parseInputStream(InputStream aStream) throws RSSExc, RSSFailure {
+    try {
+      XMLReader xmlReader = new XMLReader();
+      RSSData result = new RSSData();
+      xmlReader.parseInputStream(aStream, new RootSectionHandler(result));
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new RSSFailure(t);
+    }
+  }
+
+  public RSSData parseUrl(String anUrl) throws RSSExc, RSSFailure {
+    try {
+      InputStream inputStream = (InputStream) new URL(anUrl).getContent(new Class[] {InputStream.class});
+
+      if (inputStream==null)
+        throw new RSSExc("RSSChannel.parseUrl: Can't get url content");
+
+      return parseInputStream(inputStream);
+    }
+    catch (Throwable t) {
+      throw new RSSFailure(t);
+    }
+  }
+
+  private static class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+    private RSSData data;
+
+    public RootSectionHandler(RSSData aData) {
+      data = aData;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (XMLReaderTool.getLocalNameFromQualifiedName(aTag).equals("RDF")) {
+        return new RDFSectionHandler(data);
+      }
+      else
+        throw new XMLReader.XMLReaderFailure(new RSSExc("'RDF' tag expected"));
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      if (aCharacters.trim().length()>0)
+        throw new XMLReader.XMLReaderExc("No character data allowed here");
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+  }
+
+  private static class RDFSectionHandler extends XMLReader.AbstractSectionHandler {
+    private RSSData data;
+
+    public RDFSectionHandler(RSSData aData) {
+      data = aData;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      String identifier = (String) anAttributes.get("rdf:about");
+
+      if (aTag.equals("channel")) {
+        if (identifier==null)
+          throw new XMLReader.XMLReaderFailure(new RSSExc("Missing rdf:about"));
+        else
+          return new ChannelSectionHandler(identifier);
+      }
+      else if (aTag.equals("item")) {
+        if (identifier==null)
+          throw new XMLReader.XMLReaderFailure(new RSSExc("Missing rdf:about"));
+        else
+          return new ItemSectionHandler(identifier);
+      }
+      else
+        return new DiscardingSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (aHandler instanceof ItemSectionHandler) {
+        data.addItem(((ItemSectionHandler) aHandler).getItem());
+      }
+      else if (aHandler instanceof ChannelSectionHandler) {
+        data.setChannel(((ChannelSectionHandler) aHandler).getChannel());
+      }
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      if (aCharacters.trim().length()>0)
+        throw new XMLReader.XMLReaderExc("No character data allowed here");
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+  }
+
+  private static class ChannelSectionHandler extends XMLReader.AbstractSectionHandler {
+    private String image;
+    private String currentTag;
+    private RSSChannel channel;
+
+    public ChannelSectionHandler(String anIdentifier) {
+      channel = new RSSChannel(anIdentifier);
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      currentTag = aTag;
+      if (currentTag.equals("items")) {
+        return new ChannelItemsSectionHandler();
+      }
+      else if (currentTag.equals("description") ||
+               currentTag.equals("link") ||
+               currentTag.equals("title")) {
+        return new PCDATASectionHandler();
+      }
+
+      return new DiscardingSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (currentTag.equals("items")) {
+        channel.setItems(((ChannelItemsSectionHandler) aHandler).getItems());
+      }
+      if (currentTag.equals("description")) {
+        channel.setDescription(((PCDATASectionHandler) aHandler).getData());
+      }
+      else if (currentTag.equals("title")) {
+        channel.setTitle(((PCDATASectionHandler) aHandler).getData());
+      }
+      else if (currentTag.equals("link")) {
+        channel.setLink(((PCDATASectionHandler) aHandler).getData());
+      }
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      if (aCharacters.trim().length()>0)
+        throw new XMLReader.XMLReaderExc("No character data allowed here");
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+
+    public RSSChannel getChannel () {
+      return channel;
+    }
+  }
+
+  private static class ChannelItemsSectionHandler extends XMLReader.AbstractSectionHandler {
+    private List items;
+
+    public ChannelItemsSectionHandler() {
+      items = new Vector();
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("rdf:Seq"))
+        return new RDFSequenceSectionHandler();
+      else
+        return new DiscardingSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (aHandler instanceof RDFSequenceSectionHandler) {
+        items.addAll(((RDFSequenceSectionHandler) aHandler).getItems());
+      }
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      if (aCharacters.trim().length()>0)
+        throw new XMLReader.XMLReaderExc("No character data allowed here");
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+
+    public List getItems() {
+      return items;
+    }
+  }
+
+  private static class ItemSectionHandler extends XMLReader.AbstractSectionHandler {
+    private String currentTag;
+    private RSSItem item;
+
+    public ItemSectionHandler(String anIdentifier) {
+      item = new RSSItem(anIdentifier);
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      currentTag = aTag;
+
+      if (currentTag.equals("description") ||
+               currentTag.equals("link") ||
+               currentTag.equals("title")) {
+        return new PCDATASectionHandler();
+      }
+
+      return new DiscardingSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      if (currentTag.equals("description")) {
+        item.setDescription(((PCDATASectionHandler) aHandler).getData());
+      }
+      else if (currentTag.equals("title")) {
+        item.setTitle(((PCDATASectionHandler) aHandler).getData());
+      }
+      else if (currentTag.equals("link")) {
+        item.setLink(((PCDATASectionHandler) aHandler).getData());
+      }
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      if (aCharacters.trim().length()>0)
+        throw new XMLReader.XMLReaderExc("No character data allowed here");
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+
+    public RSSItem getItem() {
+      return item;
+    };
+  }
+
+  private static class PCDATASectionHandler extends XMLReader.AbstractSectionHandler {
+    private StringBuffer data;
+
+    public PCDATASectionHandler() {
+      data = new StringBuffer();
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      throw new XMLReader.XMLReaderFailure(new RSSExc("No subtags allowed here"));
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      data.append(aCharacters);
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+
+    public String getData() {
+      return data.toString();
+    }
+  }
+
+
+  private static class RDFSequenceSectionHandler extends XMLReader.AbstractSectionHandler {
+    private List items;
+
+    public RDFSequenceSectionHandler() {
+      items = new Vector();
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      if (aTag.equals("rdf:li")) {
+        String item = (String) anAttributes.get("rdf:resource");
+
+        if (item!=null)
+          items.add(item);
+      }
+
+      return new DiscardingSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+
+    public List getItems() {
+      return items;
+    }
+  }
+
+  private static class RDFLiteralSectionHandler extends XMLReader.AbstractSectionHandler {
+    private StringBuffer data;
+    private String tag;
+
+    public RDFLiteralSectionHandler() {
+      data = new StringBuffer();
+    }
+
+    protected StringBuffer getData() {
+      return data;
+    }
+
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      tag=aTag;
+      data.append("<"+tag+">");
+
+      return new RDFLiteralSectionHandler();
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+      data.append(((RDFLiteralSectionHandler) aHandler).getData());
+      data.append("</"+tag+">");
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+      data.append(aCharacters);
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+  }
+
+  private static class DiscardingSectionHandler extends XMLReader.AbstractSectionHandler {
+    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+      return this;
+    };
+
+    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    };
+
+    public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+    };
+
+    public void finishSection() throws XMLReader.XMLReaderExc {
+    };
+  }
+}
index 36b8461..2aa2543 100755 (executable)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.rss;\r
-\r
-import java.util.*;\r
-\r
-public class RSSToMapConverter {\r
-  private RSSToMapConverter() {\r
-  }\r
-\r
-  public static Map convertRSSItem(RSSItem anItem) {\r
-    Map result = new HashMap();\r
-\r
-    result.put("title", anItem.getTitle());\r
-    result.put("description", anItem.getDescription());\r
-    result.put("link", anItem.getLink());\r
-\r
-    return result;\r
-  }\r
-\r
-  public static Map convertRSSData(RSSData anRSSData) {\r
-    Map result = new HashMap();\r
-\r
-    Map channel = null;\r
-    if (anRSSData.getChannel()!=null) {\r
-      channel = new HashMap();\r
-      channel.put("title", anRSSData.getChannel().getTitle());\r
-      channel.put("description", anRSSData.getChannel().getDescription());\r
-      channel.put("link", anRSSData.getChannel().getLink());\r
-\r
-      List items = new Vector();\r
-      Iterator i = anRSSData.getChannel().getItems().iterator();\r
-\r
-      while (i.hasNext()) {\r
-        RSSItem item = (RSSItem) anRSSData.getItem().get(i.next());\r
-        if (item!=null) {\r
-          items.add(convertRSSItem(item));\r
-        }\r
-      }\r
-\r
-      channel.put("items", items);\r
-    }\r
-    result.put("channel", channel);\r
-    result.put("data", anRSSData);\r
-\r
-    return result;\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.rss;
+
+import java.util.*;
+
+public class RSSToMapConverter {
+  private RSSToMapConverter() {
+  }
+
+  public static Map convertRSSItem(RSSItem anItem) {
+    Map result = new HashMap();
+
+    result.put("title", anItem.getTitle());
+    result.put("description", anItem.getDescription());
+    result.put("link", anItem.getLink());
+
+    return result;
+  }
+
+  public static Map convertRSSData(RSSData anRSSData) {
+    Map result = new HashMap();
+
+    Map channel = null;
+    if (anRSSData.getChannel()!=null) {
+      channel = new HashMap();
+      channel.put("title", anRSSData.getChannel().getTitle());
+      channel.put("description", anRSSData.getChannel().getDescription());
+      channel.put("link", anRSSData.getChannel().getLink());
+
+      List items = new Vector();
+      Iterator i = anRSSData.getChannel().getItems().iterator();
+
+      while (i.hasNext()) {
+        RSSItem item = (RSSItem) anRSSData.getItem().get(i.next());
+        if (item!=null) {
+          items.add(convertRSSItem(item));
+        }
+      }
+
+      channel.put("items", items);
+    }
+    result.put("channel", channel);
+    result.put("data", anRSSData);
+
+    return result;
+  }
 }
\ No newline at end of file
index ecae535..f114804 100755 (executable)
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mir.servlet;
-
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import freemarker.template.SimpleHash;
-import freemarker.template.TemplateModelRoot;
-import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.misc.HTMLTemplateProcessor;
-import mir.misc.LineFilterWriter;
-import mir.module.AbstractModule;
-import mir.storage.StorageObject;
-import mir.util.HTTPRequestParser;
-
-
-
-
-/**
- * Abstract class ServletModule provides the base functionality for servlets.
- * Deriving a class from ServletModule enables class to insert/edit/update/delete
- * and list Entity from a Database via mainModule.
- *
- *
- *  Abstrakte Klasse ServletModule stellt die Basisfunktionalitaet der
- *  abgeleiteten ServletModule zur Verf?gung.
- *
- * @version 28.6.1999
- * @author RK
- */
-
-public abstract class ServletModule {
-
-  public String defaultAction;
-  protected LoggerWrapper logger;
-  protected MirPropertiesConfiguration configuration;
-  protected AbstractModule mainModule;
-  protected String templateListString;
-  protected String templateObjektString;
-  protected String templateConfirmString;
-
-
-  public ServletModule(){
-    try {
-      configuration = MirPropertiesConfiguration.instance();
-    }
-    catch (PropertiesConfigExc e) {
-      throw new RuntimeException("Can't get configuration: " + e.getMessage());
-    }
-  }
-
-
-  /**
-   * Singelton - Methode muss in den abgeleiteten Klassen ueberschrieben werden.
-   * @return ServletModule
-   */
-  public static ServletModule getInstance() {
-    return null;
-  }
-
-  /**
-   * get the module name to be used for generic operations like delete.
-   */
-  protected String getOperationModuleName() {
-    return getClass().getName().substring((new String("mircoders.servlet.ServletModule")).length());
-  }
-
-  /**
-   * get the session binded language
-   */
-  public String getLanguage(HttpServletRequest req) {
-    HttpSession session = req.getSession(false);
-    String language = (String) session.getAttribute("language");
-    if (language == null) {
-      language = configuration.getString("StandardLanguage");
-    }
-    return language;
-  }
-
-  /**
-   * get the locale either from the session or the accept-language header ot the request
-   * this supersedes getLanguage for the new i18n
-   */
-  public Locale getLocale(HttpServletRequest req) {
-    Locale loc = null;
-    HttpSession session = req.getSession(false);
-    if (session != null) {
-      // session can be null in case of logout
-      loc = (Locale) session.getAttribute("locale");
-    }
-    // if there is nothing in the session get it fron the accept-language
-    if (loc == null) {
-      loc = req.getLocale();
-    }
-    return loc;
-  }
-
-  public void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {
-    try {
-      aResponse.sendRedirect(MirPropertiesConfiguration.instance().getString("RootUri") + "/Mir?"+aQuery);
-    }
-    catch (Throwable t) {
-      throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);
-    }
-  }
-
-  /**
-   *  list(req,res) - generische Listmethode. Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   *
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-  public void list(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
-    try {
-      EntityList theList;
-      String offsetParam = req.getParameter("offset");
-      int offset = 0;
-      PrintWriter out = res.getWriter();
-
-      // hier offsetcode bearbeiten
-      if (offsetParam != null && !offsetParam.equals("")) {
-        offset = Integer.parseInt(offsetParam);
-      }
-      if (req.getParameter("next") != null) {
-        offset = Integer.parseInt(req.getParameter("nextoffset"));
-      }
-      else {
-        if (req.getParameter("prev") != null) {
-          offset = Integer.parseInt(req.getParameter("prevoffset"));
-        }
-      }
-      theList = mainModule.getByWhereClause(null, offset);
-
-      HTMLTemplateProcessor.process(res, templateListString, theList, out, getLocale(req));
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  add(req,res) - generische Addmethode. Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-  public void add(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-
-    try {
-      SimpleHash mergeData = new SimpleHash();
-      mergeData.put("new", "1");
-      deliver(req, res, mergeData, templateObjektString);
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  insert(req,res) - generische Insertmethode, folgt auf add.
-   *  Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   *
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-  public void insert(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-    try {
-      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());
-      logger.debug("--trying to add...");
-      String id = mainModule.add(withValues);
-      logger.debug("--trying to deliver..." + id);
-      list(req, res);
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  delete(req,res) - generic delete method. Can be overridden in subclasses.
-   *
-   */
-
-  public void delete(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-    try {
-      String idParam = req.getParameter("id");
-
-      if (idParam == null)
-        throw new ServletModuleExc("Invalid call to delete: no id supplied");
-
-      String confirmParam = req.getParameter("confirm");
-      String cancelParam = req.getParameter("cancel");
-      if (confirmParam == null && cancelParam == null) {
-        SimpleHash mergeData = new SimpleHash();
-
-        mergeData.put("module", getOperationModuleName());
-        mergeData.put("infoString", getOperationModuleName() + ": " + idParam);
-        mergeData.put("id", idParam);
-        mergeData.put("where", req.getParameter("where"));
-        mergeData.put("order", req.getParameter("order"));
-        mergeData.put("offset", req.getParameter("offset"));
-        // this stuff is to be compatible with the other more advanced
-        // search method used for media and comments
-        mergeData.put("query_media_folder", req.getParameter("query_media_folder"));
-        mergeData.put("query_is_published", req.getParameter("query_is_published"));
-        mergeData.put("query_text", req.getParameter("query_text"));
-        mergeData.put("query_field", req.getParameter("query_field"));
-
-        deliver(req, res, mergeData, templateConfirmString);
-      }
-      else {
-        if (confirmParam != null && !confirmParam.equals("")) {
-          //theLog.printInfo("delete confirmed!");
-          mainModule.deleteById(idParam);
-          list(req, res); // back to list
-        }
-        else {
-          if (req.getParameter("where") != null)
-            list(req, res);
-          else
-            edit(req, res);
-        }
-      }
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  edit(req,res) - generische Editmethode. Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   *
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-  public void edit(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-    edit(req, res, req.getParameter("id"));
-  }
-
-  /**
-   *  edit(req,res) - generische Editmethode. Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   *
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-  public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse, String anIdentifier)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-    try {
-      deliver(aRequest, aResponse, mainModule.getById(anIdentifier), templateObjektString);
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  update(req,res) - generische Updatemethode. Wennn die Funktionalitaet
-   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse
-   *  ueberschreiben werden.
-   *
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   */
-
-  public void update(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {
-    try {
-      String idParam = req.getParameter("id");
-      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());
-
-      String id = mainModule.set(withValues);
-      String whereParam = req.getParameter("where");
-      String orderParam = req.getParameter("order");
-
-      if ((whereParam != null && !whereParam.equals("")) || (orderParam != null && !orderParam.equals(""))) {
-        list(req, res);
-      }
-      else {
-        edit(req, res);
-      }
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   * deliver liefert das Template mit dem Filenamen templateFilename
-   * an den HttpServletResponse res aus, nachdem es mit den Daten aus
-   * TemplateModelRoot rtm gemischt wurde
-   *
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den
-   *   Daten, die ins Template gemerged werden sollen.
-   * @param tmpl Name des Templates
-   * @exception ServletModuleException
-   */
-  public void deliver(HttpServletRequest req, HttpServletResponse res, TemplateModelRoot rtm,
-         TemplateModelRoot popups, String templateFilename) throws ServletModuleFailure  {
-    if (rtm == null)
-      rtm = new SimpleHash();
-
-    try {
-      PrintWriter out = res.getWriter();
-      HTMLTemplateProcessor.process(res, templateFilename, rtm, popups, out, getLocale(req));
-
-      // we default to admin bundles here, which is not exactly beautiful...
-      // but this whole producer stuff is going to be rewritten soon.
-      // ServletModuleOpenIndy overwrites deliver() to use open bundles
-      // (br1)
-      out.close();
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-
-  /**
-   * deliver liefert das Template mit dem Filenamen templateFilename
-   * an den HttpServletResponse res aus, nachdem es mit den Daten aus
-   * TemplateModelRoot rtm gemischt wurde
-   *
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den
-   *   Daten, die ins Template gemerged werden sollen.
-   * @param tmpl Name des Templates
-   * @exception ServletModuleException
-   */
-  public void deliver(HttpServletRequest req, HttpServletResponse res,
-        TemplateModelRoot rtm, String templateFilename) throws ServletModuleFailure {
-    deliver(req, res, rtm, null, templateFilename);
-  }
-
-  /**
-   * deliver liefert das Template mit dem Filenamen templateFilename
-   * an den HttpServletResponse res aus, nachdem es mit den Daten aus
-   * TemplateModelRoot rtm gemischt wurde
-   *
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird
-   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den
-   *   Daten, die ins Template gemerged werden sollen.
-   * @param tmpl Name des Templates
-   * @exception ServletModuleException
-   */
-  public void deliver_compressed(HttpServletRequest req, HttpServletResponse res,
-                                 TemplateModelRoot rtm, String templateFilename)
-      throws ServletModuleFailure {
-    if (rtm == null) rtm = new SimpleHash();
-    try {
-      PrintWriter out = new LineFilterWriter(res.getWriter());
-      //PrintWriter out =  res.getWriter();
-      HTMLTemplateProcessor.process(res, templateFilename, rtm, out, getLocale(req));
-      out.close();
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   * deliver liefert das Template mit dem Filenamen templateFilename
-   * an den HttpServletResponse res aus, nachdem es mit den Daten aus
-   * TemplateModelRoot rtm gemischt wurde
-   *
-   * @param out ist der OutputStream, in den die gergten Daten geschickt werden sollen.
-   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den
-   *   Daten, die ins Template gemerged werden sollen.
-   * @param tmpl Name des Templates
-   * @exception ServletModuleException
-   */
-  private void deliver(HttpServletResponse res, HttpServletRequest req, PrintWriter out,
-                       TemplateModelRoot rtm, String templateFilename)
-      throws ServletModuleFailure {
-    try {
-      HTMLTemplateProcessor.process(res, templateFilename, rtm, out,
-                                    getLocale(req));
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  /**
-   *  Wenn die abgeleitete Klasse diese Methode ueberschreibt und einen String mit einem
-   *  Methodennamen zurueckliefert, dann wird diese Methode bei fehlender Angabe des
-   *  doParameters ausgefuehrt.
-   *
-   * @return Name der Default-Action
-   */
-  public String defaultAction() {
-    return defaultAction;
-  }
-
-  /**
-   * Gets the fields from a httprequest and matches them with the metadata from
-   * the storage object. Returns the keys that match, with their values.
-   *
-   * @return Map with the values
-   */
-  public Map getIntersectingValues(HttpServletRequest req, StorageObject theStorage)
-      throws ServletModuleExc, ServletModuleFailure {
-
-    try {
-      HTTPRequestParser parser;
-      List theFieldList;
-
-      logger.debug("using charset: " + req.getParameter("charset"));
-      logger.debug("using method: " + req.getParameter("do"));
-      if (req.getParameter("charset") != null) {
-        parser = new HTTPRequestParser(req, req.getParameter("charset"));
-        logger.debug("using charset: " + req.getParameter("charset"));
-        logger.debug("original charset: " + req.getCharacterEncoding());
-      }
-      else {
-        parser = new HTTPRequestParser(req);
-      }
-
-      theFieldList = theStorage.getFields();
-
-      Map withValues = new HashMap();
-      String aField, aValue;
-
-      for (int i = 0; i < theFieldList.size(); i++) {
-        aField = (String) theFieldList.get(i);
-
-        logger.debug("field " + aField + " = " + parser.getParameter(aField));
-
-        aValue = parser.getParameter(aField);
-        if (aValue != null)
-          withValues.put(aField, aValue);
-      }
-      return withValues;
-    }
-    catch (Throwable e) {
-      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
-      throw new ServletModuleFailure( "ServletModule.getIntersectingValues: " + e.getMessage(), e);
-    }
-  }
-
-}
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mir.servlet;\r
+\r
+import java.io.PrintWriter;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+import javax.servlet.http.HttpSession;\r
+\r
+import freemarker.template.SimpleHash;\r
+import freemarker.template.TemplateModelRoot;\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.config.MirPropertiesConfiguration$PropertiesConfigExc;\r
+import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
+import mir.misc.HTMLTemplateProcessor;\r
+import mir.misc.LineFilterWriter;\r
+import mir.module.AbstractModule;\r
+import mir.storage.StorageObject;\r
+import mir.util.HTTPRequestParser;\r
+\r
+\r
+\r
+\r
+/**\r
+ * Abstract class ServletModule provides the base functionality for servlets.\r
+ * Deriving a class from ServletModule enables class to insert/edit/update/delete\r
+ * and list Entity from a Database via mainModule.\r
+ *\r
+ *\r
+ *  Abstrakte Klasse ServletModule stellt die Basisfunktionalitaet der\r
+ *  abgeleiteten ServletModule zur Verf?gung.\r
+ *\r
+ * @version 28.6.1999\r
+ * @author RK\r
+ */\r
+\r
+public abstract class ServletModule {\r
+\r
+  public String defaultAction;\r
+  protected LoggerWrapper logger;\r
+  protected MirPropertiesConfiguration configuration;\r
+  protected AbstractModule mainModule;\r
+  protected Locale fallbackLocale;\r
+  protected String templateListString;\r
+  protected String templateObjektString;\r
+  protected String templateConfirmString;\r
+\r
+\r
+  public ServletModule(){\r
+    try {\r
+      configuration = MirPropertiesConfiguration.instance();\r
+    }\r
+    catch (PropertiesConfigExc e) {\r
+      throw new RuntimeException("Can't get configuration: " + e.getMessage());\r
+    }\r
+\r
+    fallbackLocale = new Locale(configuration.getString("Mir.Admin.FallbackLanguage", "en"), "");\r
+  }\r
+\r
+\r
+  /**\r
+   * Singelton - Methode muss in den abgeleiteten Klassen ueberschrieben werden.\r
+   * @return ServletModule\r
+   */\r
+  public static ServletModule getInstance() {\r
+    return null;\r
+  }\r
+\r
+  /**\r
+   * get the module name to be used for generic operations like delete.\r
+   */\r
+  protected String getOperationModuleName() {\r
+    return getClass().getName().substring((new String("mircoders.servlet.ServletModule")).length());\r
+  }\r
+\r
+  /**\r
+   * get the locale either from the session or the accept-language header ot the request\r
+   * this supersedes getLanguage for the new i18n\r
+   */\r
+  public Locale getLocale(HttpServletRequest req) {\r
+    Locale loc = null;\r
+    HttpSession session = req.getSession(false);\r
+    if (session != null) {\r
+      // session can be null in case of logout\r
+      loc = (Locale) session.getAttribute("locale");\r
+    }\r
+    // if there is nothing in the session get it fron the accept-language\r
+    if (loc == null) {\r
+      loc = req.getLocale();\r
+    }\r
+    return loc;\r
+  }\r
+\r
+  /**\r
+   * get the locale either from the session or the accept-language header ot the request\r
+   * this supersedes getLanguage for the new i18n\r
+   */\r
+  public Locale getFallbackLocale(HttpServletRequest req) {\r
+    return fallbackLocale;\r
+  }\r
+\r
+  public void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {\r
+    try {\r
+      aResponse.sendRedirect(MirPropertiesConfiguration.instance().getString("RootUri") + "/Mir?"+aQuery);\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  list(req,res) - generische Listmethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void list(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {\r
+    try {\r
+      EntityList theList;\r
+      String offsetParam = req.getParameter("offset");\r
+      int offset = 0;\r
+      PrintWriter out = res.getWriter();\r
+\r
+      // hier offsetcode bearbeiten\r
+      if (offsetParam != null && !offsetParam.equals("")) {\r
+        offset = Integer.parseInt(offsetParam);\r
+      }\r
+      if (req.getParameter("next") != null) {\r
+        offset = Integer.parseInt(req.getParameter("nextoffset"));\r
+      }\r
+      else {\r
+        if (req.getParameter("prev") != null) {\r
+          offset = Integer.parseInt(req.getParameter("prevoffset"));\r
+        }\r
+      }\r
+      theList = mainModule.getByWhereClause(null, offset);\r
+\r
+      HTMLTemplateProcessor.process(res, templateListString, theList, null, null, out, getLocale(req), getFallbackLocale(req));\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  add(req,res) - generische Addmethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void add(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+\r
+    try {\r
+      SimpleHash mergeData = new SimpleHash();\r
+      mergeData.put("new", "1");\r
+      deliver(req, res, mergeData, templateObjektString);\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  insert(req,res) - generische Insertmethode, folgt auf add.\r
+   *  Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void insert(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+    try {\r
+      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
+      logger.debug("--trying to add...");\r
+      String id = mainModule.add(withValues);\r
+      logger.debug("--trying to deliver..." + id);\r
+      list(req, res);\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  delete(req,res) - generic delete method. Can be overridden in subclasses.\r
+   *\r
+   */\r
+\r
+  public void delete(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+    try {\r
+      String idParam = req.getParameter("id");\r
+\r
+      if (idParam == null)\r
+        throw new ServletModuleExc("Invalid call to delete: no id supplied");\r
+\r
+      String confirmParam = req.getParameter("confirm");\r
+      String cancelParam = req.getParameter("cancel");\r
+      if (confirmParam == null && cancelParam == null) {\r
+        SimpleHash mergeData = new SimpleHash();\r
+\r
+        mergeData.put("module", getOperationModuleName());\r
+        mergeData.put("infoString", getOperationModuleName() + ": " + idParam);\r
+        mergeData.put("id", idParam);\r
+        mergeData.put("where", req.getParameter("where"));\r
+        mergeData.put("order", req.getParameter("order"));\r
+        mergeData.put("offset", req.getParameter("offset"));\r
+        // this stuff is to be compatible with the other more advanced\r
+        // search method used for media and comments\r
+        mergeData.put("query_media_folder", req.getParameter("query_media_folder"));\r
+        mergeData.put("query_is_published", req.getParameter("query_is_published"));\r
+        mergeData.put("query_text", req.getParameter("query_text"));\r
+        mergeData.put("query_field", req.getParameter("query_field"));\r
+\r
+        deliver(req, res, mergeData, templateConfirmString);\r
+      }\r
+      else {\r
+        if (confirmParam != null && !confirmParam.equals("")) {\r
+          //theLog.printInfo("delete confirmed!");\r
+          mainModule.deleteById(idParam);\r
+          list(req, res); // back to list\r
+        }\r
+        else {\r
+          if (req.getParameter("where") != null)\r
+            list(req, res);\r
+          else\r
+            edit(req, res);\r
+        }\r
+      }\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  edit(req,res) - generische Editmethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void edit(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+    edit(req, res, req.getParameter("id"));\r
+  }\r
+\r
+  /**\r
+   *  edit(req,res) - generische Editmethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse, String anIdentifier)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+    try {\r
+      deliver(aRequest, aResponse, mainModule.getById(anIdentifier), templateObjektString);\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  update(req,res) - generische Updatemethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+\r
+  public void update(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure  {\r
+    try {\r
+      String idParam = req.getParameter("id");\r
+      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
+\r
+      String id = mainModule.set(withValues);\r
+      String whereParam = req.getParameter("where");\r
+      String orderParam = req.getParameter("order");\r
+\r
+      if ((whereParam != null && !whereParam.equals("")) || (orderParam != null && !orderParam.equals(""))) {\r
+        list(req, res);\r
+      }\r
+      else {\r
+        edit(req, res);\r
+      }\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   * deliver liefert das Template mit dem Filenamen templateFilename\r
+   * an den HttpServletResponse res aus, nachdem es mit den Daten aus\r
+   * TemplateModelRoot rtm gemischt wurde\r
+   *\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den\r
+   *   Daten, die ins Template gemerged werden sollen.\r
+   * @param tmpl Name des Templates\r
+   * @exception ServletModuleException\r
+   */\r
+  public void deliver(HttpServletRequest req, HttpServletResponse res, TemplateModelRoot rtm,\r
+         TemplateModelRoot popups, String templateFilename) throws ServletModuleFailure  {\r
+    if (rtm == null)\r
+      rtm = new SimpleHash();\r
+\r
+    try {\r
+      PrintWriter out = res.getWriter();\r
+      HTMLTemplateProcessor.process(res, templateFilename, rtm, popups, out, getLocale(req), getFallbackLocale(req));\r
+\r
+      // we default to admin bundles here, which is not exactly beautiful...\r
+      // but this whole producer stuff is going to be rewritten soon.\r
+      // ServletModuleOpenIndy overwrites deliver() to use open bundles\r
+      // (br1)\r
+      out.close();\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+\r
+  /**\r
+   * deliver liefert das Template mit dem Filenamen templateFilename\r
+   * an den HttpServletResponse res aus, nachdem es mit den Daten aus\r
+   * TemplateModelRoot rtm gemischt wurde\r
+   *\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den\r
+   *   Daten, die ins Template gemerged werden sollen.\r
+   * @param tmpl Name des Templates\r
+   * @exception ServletModuleException\r
+   */\r
+  public void deliver(HttpServletRequest req, HttpServletResponse res,\r
+        TemplateModelRoot rtm, String templateFilename) throws ServletModuleFailure {\r
+    deliver(req, res, rtm, null, templateFilename);\r
+  }\r
+\r
+  /**\r
+   * deliver liefert das Template mit dem Filenamen templateFilename\r
+   * an den HttpServletResponse res aus, nachdem es mit den Daten aus\r
+   * TemplateModelRoot rtm gemischt wurde\r
+   *\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den\r
+   *   Daten, die ins Template gemerged werden sollen.\r
+   * @param tmpl Name des Templates\r
+   * @exception ServletModuleException\r
+   */\r
+  public void deliver_compressed(HttpServletRequest req, HttpServletResponse res,\r
+                                 TemplateModelRoot rtm, String templateFilename)\r
+      throws ServletModuleFailure {\r
+    if (rtm == null) rtm = new SimpleHash();\r
+    try {\r
+      PrintWriter out = new LineFilterWriter(res.getWriter());\r
+      //PrintWriter out =  res.getWriter();\r
+      HTMLTemplateProcessor.process(res, templateFilename, rtm, null, out, getLocale(req), getFallbackLocale(req));\r
+      out.close();\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   * deliver liefert das Template mit dem Filenamen templateFilename\r
+   * an den HttpServletResponse res aus, nachdem es mit den Daten aus\r
+   * TemplateModelRoot rtm gemischt wurde\r
+   *\r
+   * @param out ist der OutputStream, in den die gergten Daten geschickt werden sollen.\r
+   * @param rtm beinahalten das freemarker.template.TempalteModelRoot mit den\r
+   *   Daten, die ins Template gemerged werden sollen.\r
+   * @param tmpl Name des Templates\r
+   * @exception ServletModuleException\r
+   */\r
+  private void deliver(HttpServletResponse res, HttpServletRequest req, PrintWriter out,\r
+                       TemplateModelRoot rtm, String templateFilename)\r
+      throws ServletModuleFailure {\r
+    try {\r
+      HTMLTemplateProcessor.process(res, templateFilename, rtm, null, out, getLocale(req), getFallbackLocale(req));\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  /**\r
+   *  Wenn die abgeleitete Klasse diese Methode ueberschreibt und einen String mit einem\r
+   *  Methodennamen zurueckliefert, dann wird diese Methode bei fehlender Angabe des\r
+   *  doParameters ausgefuehrt.\r
+   *\r
+   * @return Name der Default-Action\r
+   */\r
+  public String defaultAction() {\r
+    return defaultAction;\r
+  }\r
+\r
+  /**\r
+   * Gets the fields from a httprequest and matches them with the metadata from\r
+   * the storage object. Returns the keys that match, with their values.\r
+   *\r
+   * @return Map with the values\r
+   */\r
+  public Map getIntersectingValues(HttpServletRequest req, StorageObject theStorage)\r
+      throws ServletModuleExc, ServletModuleFailure {\r
+\r
+    try {\r
+      HTTPRequestParser parser;\r
+      List theFieldList;\r
+\r
+      logger.debug("using charset: " + req.getParameter("charset"));\r
+      logger.debug("using method: " + req.getParameter("do"));\r
+      if (req.getParameter("charset") != null) {\r
+        parser = new HTTPRequestParser(req, req.getParameter("charset"));\r
+        logger.debug("using charset: " + req.getParameter("charset"));\r
+        logger.debug("original charset: " + req.getCharacterEncoding());\r
+      }\r
+      else {\r
+        parser = new HTTPRequestParser(req);\r
+      }\r
+\r
+      theFieldList = theStorage.getFields();\r
+\r
+      Map withValues = new HashMap();\r
+      String aField, aValue;\r
+\r
+      for (int i = 0; i < theFieldList.size(); i++) {\r
+        aField = (String) theFieldList.get(i);\r
+\r
+        logger.debug("field " + aField + " = " + parser.getParameter(aField));\r
+\r
+        aValue = parser.getParameter(aField);\r
+        if (aValue != null)\r
+          withValues.put(aField, aValue);\r
+      }\r
+      return withValues;\r
+    }\r
+    catch (Throwable e) {\r
+      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
+\r
+      throw new ServletModuleFailure( "ServletModule.getIntersectingValues: " + e.getMessage(), e);\r
+    }\r
+  }\r
+\r
+}\r
index d3d376d..7d7f8ba 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mir.servlet;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import freemarker.template.TemplateModelRoot;\r
-\r
-\r
-/**\r
- *  Standard ServletModule, dass eine Template anzeigt, und nicht\r
- *  mit Daten mischt. Damit ist es moeglich, einfache HTML-Seiten\r
- *  als templates zu benutzen. Damit kann auf einfache Weise die\r
- *  Funktionalitaet der Freemarker-Bibliothek (beispielsweise Navigationen\r
- *  per <code>include</code> einzubauen) benutzt werden. Die Templates\r
- *  werden aus dem per Konfiguration angegebenem template-Verzeichnis\r
- *  im Ordner "/html" genommen.\r
- *\r
- * @author RK\r
- */\r
-public class ServletModuleShow extends ServletModule {\r
-  private static ServletModuleShow instance = new ServletModuleShow();\r
-\r
-  /**\r
-   * Ein ServletModuleShow-Objekt wird ?ber getInstance geliefert. Es gibt zur\r
-   * Laufzeit nur ein Objekt (Singleton)\r
-   * @return ServletModuleShow\r
-   */\r
-  public static ServletModule getInstance() {\r
-    return instance;\r
-  }\r
-\r
-  /**\r
-   * Initialisierung leer.\r
-   */\r
-  private ServletModuleShow() {\r
-  }\r
-\r
-  /**\r
-   * defaultAction (s.a ServletModule)\r
-   * @return "show"\r
-   */\r
-  public String defaultAction() {\r
-    return "show";\r
-  }\r
-\r
-  /**\r
-   * Standardmethode, die die Funktionalitaet des ServletModules implementiert.\r
-   *\r
-   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
-   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
-   * @return String fuer Logfile\r
-   * @exception ServletModuleException\r
-   */\r
-  public void show(HttpServletRequest req, HttpServletResponse res) throws\r
-      ServletModuleExc {\r
-    try {\r
-      String idParam = req.getParameter("tmpl");\r
-      if (! (idParam == null || idParam.equals(""))) {\r
-        deliver(req, res, (TemplateModelRoot)null,\r
-                "html/" + idParam + ".template");\r
-      }\r
-      else {\r
-        throw new ServletModuleExc("Invalid template: " + idParam);\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-}\r
-\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mir.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import freemarker.template.TemplateModelRoot;
+
+
+/**
+ *  Standard ServletModule, dass eine Template anzeigt, und nicht
+ *  mit Daten mischt. Damit ist es moeglich, einfache HTML-Seiten
+ *  als templates zu benutzen. Damit kann auf einfache Weise die
+ *  Funktionalitaet der Freemarker-Bibliothek (beispielsweise Navigationen
+ *  per <code>include</code> einzubauen) benutzt werden. Die Templates
+ *  werden aus dem per Konfiguration angegebenem template-Verzeichnis
+ *  im Ordner "/html" genommen.
+ *
+ * @author RK
+ */
+public class ServletModuleShow extends ServletModule {
+  private static ServletModuleShow instance = new ServletModuleShow();
+
+  /**
+   * Ein ServletModuleShow-Objekt wird ?ber getInstance geliefert. Es gibt zur
+   * Laufzeit nur ein Objekt (Singleton)
+   * @return ServletModuleShow
+   */
+  public static ServletModule getInstance() {
+    return instance;
+  }
+
+  /**
+   * Initialisierung leer.
+   */
+  private ServletModuleShow() {
+  }
+
+  /**
+   * defaultAction (s.a ServletModule)
+   * @return "show"
+   */
+  public String defaultAction() {
+    return "show";
+  }
+
+  /**
+   * Standardmethode, die die Funktionalitaet des ServletModules implementiert.
+   *
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird
+   * @return String fuer Logfile
+   * @exception ServletModuleException
+   */
+  public void show(HttpServletRequest req, HttpServletResponse res) throws
+      ServletModuleExc {
+    try {
+      String idParam = req.getParameter("tmpl");
+      if (! (idParam == null || idParam.equals(""))) {
+        deliver(req, res, (TemplateModelRoot)null,
+                "html/" + idParam + ".template");
+      }
+      else {
+        throw new ServletModuleExc("Invalid template: " + idParam);
+      }
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+}
+
+
+
+
index 6621191..16b88e5 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-package mir.storage;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStreamReader;\r
-import java.sql.Connection;\r
-import java.sql.PreparedStatement;\r
-import java.sql.ResultSet;\r
-import java.sql.ResultSetMetaData;\r
-import java.sql.SQLException;\r
-import java.sql.Statement;\r
-import java.sql.Timestamp;\r
-import java.text.ParseException;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-import mir.entity.Entity;\r
-import mir.entity.EntityList;\r
-import mir.entity.StorableObjectEntity;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.HTMLTemplateProcessor;\r
-import mir.misc.StringUtil;\r
-import mir.storage.store.ObjectStore;\r
-import mir.storage.store.StorableObject;\r
-import mir.storage.store.StoreContainerType;\r
-import mir.storage.store.StoreIdentifier;\r
-import mir.storage.store.StoreUtil;\r
-import mir.util.JDBCStringRoutines;\r
-\r
-import com.codestudio.util.SQLManager;\r
-\r
-import freemarker.template.SimpleHash;\r
-import freemarker.template.SimpleList;\r
-\r
-\r
-/**\r
- * Diese Klasse implementiert die Zugriffsschicht auf die Datenbank.\r
- * Alle Projektspezifischen Datenbankklassen erben von dieser Klasse.\r
- * In den Unterklassen wird im Minimalfall nur die Tabelle angegeben.\r
- * Im Konfigurationsfile findet sich eine Verweis auf den verwendeten\r
- * Treiber, Host, User und Passwort, ueber den der Zugriff auf die\r
- * Datenbank erfolgt.\r
- *\r
- * @version $Id: Database.java,v 1.36 2003/03/05 19:23:15 idfx Exp $\r
- * @author rk\r
- *\r
- */\r
-public class Database implements StorageObject {\r
-  private static Class GENERIC_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;\r
-  private static Class STORABLE_OBJECT_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;\r
-\r
-\r
-  private static SimpleHash POPUP_EMPTYLINE = new SimpleHash();\r
-  protected static final ObjectStore o_store = ObjectStore.getInstance();\r
-  private static final int _millisPerHour = 60 * 60 * 1000;\r
-  private static final int _millisPerMinute = 60 * 1000;\r
-\r
-  static {\r
-    // always same object saves a little space\r
-    POPUP_EMPTYLINE.put("key", "");\r
-    POPUP_EMPTYLINE.put("value", "--");\r
-  }\r
-\r
-  protected LoggerWrapper logger;\r
-  protected MirPropertiesConfiguration configuration;\r
-  protected String theTable;\r
-  protected String theCoreTable = null;\r
-  protected String thePKeyName = "id";\r
-  protected int thePKeyType;\r
-  protected int thePKeyIndex;\r
-  protected boolean evaluatedMetaData = false;\r
-  protected ArrayList metadataFields;\r
-  protected ArrayList metadataLabels;\r
-  protected ArrayList metadataNotNullFields;\r
-  protected int[] metadataTypes;\r
-  protected Class theEntityClass;\r
-  protected StorageObject myselfDatabase;\r
-  protected SimpleList popupCache = null;\r
-  protected boolean hasPopupCache = false;\r
-  protected SimpleHash hashCache = null;\r
-  protected boolean hasTimestamp = true;\r
-  private String database_driver;\r
-  private String database_url;\r
-  private int defaultLimit;\r
-  protected DatabaseAdaptor theAdaptor;\r
-  private SimpleDateFormat _dateFormatterOut =\r
-    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
-  private SimpleDateFormat _dateFormatterIn =\r
-    new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
-  private Calendar _cal = new GregorianCalendar();\r
-\r
-  /**\r
-   * Kontruktor bekommt den Filenamen des Konfigurationsfiles ?bergeben.\r
-   * Aus diesem file werden <code>Database.Logfile</code>,\r
-   * <code>Database.Username</code>,<code>Database.Password</code>,\r
-   * <code>Database.Host</code> und <code>Database.Adaptor</code>\r
-   * ausgelesen und ein Broker f?r die Verbindugen zur Datenbank\r
-   * erzeugt.\r
-   *\r
-   * @param   String confFilename Dateiname der Konfigurationsdatei\r
-   */\r
-  public Database() throws StorageObjectFailure {\r
-    try {\r
-      configuration = MirPropertiesConfiguration.instance();\r
-    }\r
-    catch (PropertiesConfigExc e) {\r
-      throw new StorageObjectFailure(e);\r
-    }\r
-    logger = new LoggerWrapper("Database");\r
-\r
-    String theAdaptorName = configuration.getString("Database.Adaptor");\r
-    defaultLimit = Integer.parseInt(configuration.getString("Database.Limit"));\r
-\r
-    try {\r
-      theEntityClass = GENERIC_ENTITY_CLASS;\r
-      theAdaptor = (DatabaseAdaptor) Class.forName(theAdaptorName).newInstance();\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Error in Database() constructor with " + theAdaptorName + " -- " + e.getMessage());\r
-      throw new StorageObjectFailure("Error in Database() constructor.", e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Liefert die Entity-Klasse zur?ck, in der eine Datenbankzeile gewrappt\r
-   * wird. Wird die Entity-Klasse durch die erbende Klasse nicht ?berschrieben,\r
-   * wird eine mir.entity.GenericEntity erzeugt.\r
-   *\r
-   * @return Class-Objekt der Entity\r
-   */\r
-  public java.lang.Class getEntityClass() {\r
-    return theEntityClass;\r
-  }\r
-\r
-  /**\r
-   * Liefert die Standardbeschr?nkung von select-Statements zur?ck, also\r
-   * wieviel Datens?tze per Default selektiert werden.\r
-   *\r
-   * @return Standard-Anzahl der Datens?tze\r
-   */\r
-  public int getLimit() {\r
-    return defaultLimit;\r
-  }\r
-\r
-  /**\r
-   * Liefert den Namen des Primary-Keys zur?ck. Wird die Variable nicht von\r
-   * der erbenden Klasse ?berschrieben, so ist der Wert <code>PKEY</code>\r
-   * @return Name des Primary-Keys\r
-   */\r
-  public String getIdName() {\r
-    return thePKeyName;\r
-  }\r
-\r
-  /**\r
-   * Liefert den Namen der Tabelle, auf das sich das Datenbankobjekt bezieht.\r
-   *\r
-   * @return Name der Tabelle\r
-   */\r
-  public String getTableName() {\r
-    return theTable;\r
-  }\r
-\r
-  /*\r
-  *   Dient dazu vererbte Tabellen bei objectrelationalen DBMS\r
-  *   zu speichern, wenn die id einer Tabelle in der parenttabelle verwaltet\r
-  *   wird.\r
-  *   @return liefert theCoreTabel als String zurueck, wenn gesetzt, sonst\r
-  *    the Table\r
-   */\r
-  public String getCoreTable() {\r
-    if (theCoreTable != null) {\r
-      return theCoreTable;\r
-    } else {\r
-      return theTable;\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Liefert Feldtypen der Felder der Tabelle zurueck (s.a. java.sql.Types)\r
-   * @return int-Array mit den Typen der Felder\r
-   * @exception StorageObjectException\r
-   */\r
-  public int[] getTypes() throws StorageObjectFailure {\r
-    if (metadataTypes == null) {\r
-      get_meta_data();\r
-    }\r
-\r
-    return metadataTypes;\r
-  }\r
-\r
-  /**\r
-   * Liefert eine Liste der Labels der Tabellenfelder\r
-   * @return ArrayListe mit Labeln\r
-   * @exception StorageObjectException\r
-   */\r
-  public List getLabels() throws StorageObjectFailure {\r
-    if (metadataLabels == null) {\r
-      get_meta_data();\r
-    }\r
-\r
-    return metadataLabels;\r
-  }\r
-\r
-  /**\r
-   * Liefert eine Liste der Felder der Tabelle\r
-   * @return ArrayList mit Feldern\r
-   * @exception StorageObjectException\r
-   */\r
-  public List getFields() throws StorageObjectFailure {\r
-    if (metadataFields == null) {\r
-      get_meta_data();\r
-    }\r
-\r
-    return metadataFields;\r
-  }\r
-\r
-  /*\r
-  *   Gets value out of ResultSet according to type and converts to String\r
-  *   @param inValue  Wert aus ResultSet.\r
-  *   @param aType  Datenbanktyp.\r
-  *   @return liefert den Wert als String zurueck. Wenn keine Umwandlung moeglich\r
-  *           dann /unsupported value/\r
-   */\r
-  private String getValueAsString(ResultSet rs, int valueIndex, int aType)\r
-    throws StorageObjectFailure {\r
-    String outValue = null;\r
-\r
-    if (rs != null) {\r
-      try {\r
-        switch (aType) {\r
-        case java.sql.Types.BIT:\r
-          outValue = (rs.getBoolean(valueIndex) == true) ? "1" : "0";\r
-\r
-          break;\r
-\r
-        case java.sql.Types.INTEGER:\r
-        case java.sql.Types.SMALLINT:\r
-        case java.sql.Types.TINYINT:\r
-        case java.sql.Types.BIGINT:\r
-\r
-          int out = rs.getInt(valueIndex);\r
-\r
-          if (!rs.wasNull()) {\r
-            outValue = new Integer(out).toString();\r
-          }\r
-\r
-          break;\r
-\r
-        case java.sql.Types.NUMERIC:\r
-\r
-          /** @todo Numeric can be float or double depending upon\r
-           *  metadata.getScale() / especially with oracle */\r
-          long outl = rs.getLong(valueIndex);\r
-\r
-          if (!rs.wasNull()) {\r
-            outValue = new Long(outl).toString();\r
-          }\r
-\r
-          break;\r
-\r
-        case java.sql.Types.REAL:\r
-\r
-          float tempf = rs.getFloat(valueIndex);\r
-\r
-          if (!rs.wasNull()) {\r
-            tempf *= 10;\r
-            tempf += 0.5;\r
-\r
-            int tempf_int = (int) tempf;\r
-            tempf = (float) tempf_int;\r
-            tempf /= 10;\r
-            outValue = "" + tempf;\r
-            outValue = outValue.replace('.', ',');\r
-          }\r
-\r
-          break;\r
-\r
-        case java.sql.Types.DOUBLE:\r
-\r
-          double tempd = rs.getDouble(valueIndex);\r
-\r
-          if (!rs.wasNull()) {\r
-            tempd *= 10;\r
-            tempd += 0.5;\r
-\r
-            int tempd_int = (int) tempd;\r
-            tempd = (double) tempd_int;\r
-            tempd /= 10;\r
-            outValue = "" + tempd;\r
-            outValue = outValue.replace('.', ',');\r
-          }\r
-\r
-          break;\r
-\r
-        case java.sql.Types.CHAR:\r
-        case java.sql.Types.VARCHAR:\r
-        case java.sql.Types.LONGVARCHAR:\r
-          outValue = rs.getString(valueIndex);\r
-\r
-          break;\r
-\r
-        case java.sql.Types.LONGVARBINARY:\r
-          outValue = rs.getString(valueIndex);\r
-\r
-          break;\r
-\r
-        case java.sql.Types.TIMESTAMP:\r
-\r
-          // it's important to use Timestamp here as getting it\r
-          // as a string is undefined and is only there for debugging\r
-          // according to the API. we can make it a string through formatting.\r
-          // -mh\r
-          Timestamp timestamp = (rs.getTimestamp(valueIndex));\r
-\r
-          if (!rs.wasNull()) {\r
-            java.util.Date date = new java.util.Date(timestamp.getTime());\r
-            outValue = _dateFormatterOut.format(date);\r
-            _cal.setTime(date);\r
-\r
-            int offset =\r
-              _cal.get(Calendar.ZONE_OFFSET) + _cal.get(Calendar.DST_OFFSET);\r
-            String tzOffset =\r
-              StringUtil.zeroPaddingNumber(offset / _millisPerHour, 2, 2);\r
-            outValue = outValue + "+" + tzOffset;\r
-          }\r
-\r
-          break;\r
-\r
-        default:\r
-          outValue = "<unsupported value>";\r
-          logger.warn( "Unsupported Datatype: at " + valueIndex + " (" + aType + ")");\r
-        }\r
-      } catch (SQLException e) {\r
-        throw new StorageObjectFailure("Could not get Value out of Resultset -- ",\r
-          e);\r
-      }\r
-    }\r
-\r
-    return outValue;\r
-  }\r
-\r
-  /*\r
-  *   select-Operator um einen Datensatz zu bekommen.\r
-  *   @param id Primaerschluessel des Datensatzes.\r
-  *   @return liefert EntityObject des gefundenen Datensatzes oder null.\r
-   */\r
-  public Entity selectById(String id) throws StorageObjectExc {\r
-    if ((id == null) || id.equals("")) {\r
-      throw new StorageObjectExc("Database.selectById: Missing id");\r
-    }\r
-\r
-    // ask object store for object\r
-    if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-      String uniqueId = id;\r
-\r
-      if (theEntityClass.equals(StorableObjectEntity.class)) {\r
-        uniqueId += ("@" + theTable);\r
-      }\r
-\r
-      StoreIdentifier search_sid = new StoreIdentifier(theEntityClass, uniqueId);\r
-      logger.debug("CACHE: (dbg) looking for sid " + search_sid.toString());\r
-\r
-      Entity hit = (Entity) o_store.use(search_sid);\r
-\r
-      if (hit != null) {\r
-        return hit;\r
-      }\r
-    }\r
-\r
-    Statement stmt = null;\r
-    Connection con = getPooledCon();\r
-    Entity returnEntity = null;\r
-\r
-    try {\r
-      ResultSet rs;\r
-\r
-      /** @todo better prepared statement */\r
-      String selectSql =\r
-        "select * from " + theTable + " where " + thePKeyName + "=" + id;\r
-      stmt = con.createStatement();\r
-      rs = executeSql(stmt, selectSql);\r
-\r
-      if (rs != null) {\r
-        if (evaluatedMetaData == false) {\r
-          evalMetaData(rs.getMetaData());\r
-        }\r
-\r
-        if (rs.next()) {\r
-          returnEntity = makeEntityFromResultSet(rs);\r
-        }\r
-        else {\r
-          logger.debug("No data for id: " + id + " in table " + theTable);\r
-        }\r
-\r
-        rs.close();\r
-      }\r
-      else {\r
-        logger.debug("No Data for Id " + id + " in Table " + theTable);\r
-      }\r
-    }\r
-    catch (SQLException sqe) {\r
-      throwSQLException(sqe, "selectById");\r
-      return null;\r
-    }\r
-    catch (NumberFormatException e) {\r
-      logger.error("ID is no number: " + id);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    return returnEntity;\r
-  }\r
-\r
-  /**\r
-   *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.\r
-   *   @param key  Datenbankfeld der Bedingung.\r
-   *   @param value  Wert die der key anehmen muss.\r
-   *   @return EntityList mit den gematchten Entities\r
-   */\r
-  public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure {\r
-    return selectByFieldValue(aField, aValue, 0);\r
-  }\r
-\r
-  /**\r
-   *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.\r
-   *   @param key  Datenbankfeld der Bedingung.\r
-   *   @param value  Wert die der key anehmen muss.\r
-   *   @param offset  Gibt an ab welchem Datensatz angezeigt werden soll.\r
-   *   @return EntityList mit den gematchten Entities\r
-   */\r
-  public EntityList selectByFieldValue(String aField, String aValue, int offset) throws StorageObjectFailure {\r
-    return selectByWhereClause(aField + "=" + aValue, offset);\r
-  }\r
-\r
-  /**\r
-   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.\r
-   * Also offset wird der erste Datensatz genommen.\r
-   *\r
-   * @param wc where-Clause\r
-   * @return EntityList mit den gematchten Entities\r
-   * @exception StorageObjectException\r
-   */\r
-  public EntityList selectByWhereClause(String where)\r
-    throws StorageObjectFailure {\r
-    return selectByWhereClause(where, 0);\r
-  }\r
-\r
-  /**\r
-   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.\r
-   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.\r
-   *\r
-   * @param wc where-Clause\r
-   * @param offset ab welchem Datensatz.\r
-   * @return EntityList mit den gematchten Entities\r
-   * @exception StorageObjectException\r
-   */\r
-  public EntityList selectByWhereClause(String whereClause, int offset)\r
-    throws StorageObjectFailure {\r
-    return selectByWhereClause(whereClause, null, offset);\r
-  }\r
-\r
-  /**\r
-   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.\r
-   * Also offset wird der erste Datensatz genommen.\r
-   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.\r
-   *\r
-   * @param wc where-Clause\r
-   * @param ob orderBy-Clause\r
-   * @return EntityList mit den gematchten Entities\r
-   * @exception StorageObjectException\r
-   */\r
-  public EntityList selectByWhereClause(String where, String order)\r
-    throws StorageObjectFailure {\r
-    return selectByWhereClause(where, order, 0);\r
-  }\r
-\r
-  /**\r
-   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.\r
-   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.\r
-   *\r
-   * @param wc where-Clause\r
-   * @param ob orderBy-Clause\r
-   * @param offset ab welchem Datensatz\r
-   * @return EntityList mit den gematchten Entities\r
-   * @exception StorageObjectException\r
-   */\r
-  public EntityList selectByWhereClause(String whereClause, String orderBy,\r
-    int offset) throws StorageObjectFailure {\r
-    return selectByWhereClause(whereClause, orderBy, offset, defaultLimit);\r
-  }\r
-\r
-  /**\r
-   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.\r
-   * @param wc where-Clause\r
-   * @param ob orderBy-Clause\r
-   * @param offset ab welchem Datensatz\r
-   * @param limit wieviele Datens?tze\r
-   * @return EntityList mit den gematchten Entities\r
-   * @exception StorageObjectException\r
-   */\r
-  public EntityList selectByWhereClause(String wc, String ob, int offset,\r
-    int limit) throws StorageObjectFailure {\r
-    // check o_store for entitylist\r
-    if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-      StoreIdentifier search_sid =\r
-        new StoreIdentifier(theEntityClass,\r
-          StoreContainerType.STOC_TYPE_ENTITYLIST,\r
-          StoreUtil.getEntityListUniqueIdentifierFor(theTable, wc, ob, offset,\r
-            limit));\r
-      EntityList hit = (EntityList) o_store.use(search_sid);\r
-\r
-      if (hit != null) {\r
-        logger.debug("CACHE (hit): " + search_sid.toString());\r
-\r
-        return hit;\r
-      }\r
-    }\r
-\r
-    // local\r
-    EntityList theReturnList = null;\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    ResultSet rs;\r
-    int offsetCount = 0;\r
-    int count = 0;\r
-\r
-    // build sql-statement\r
-\r
-    /** @todo count sql string should only be assembled if we really count\r
-     *  see below at the end of method //rk */\r
-    if ((wc != null) && (wc.trim().length() == 0)) {\r
-      wc = null;\r
-    }\r
-\r
-    StringBuffer countSql =\r
-      new StringBuffer("select count(*) from ").append(theTable);\r
-    StringBuffer selectSql =\r
-      new StringBuffer("select * from ").append(theTable);\r
-\r
-    if (wc != null) {\r
-      selectSql.append(" where ").append(wc);\r
-      countSql.append(" where ").append(wc);\r
-    }\r
-\r
-    if ((ob != null) && !(ob.trim().length() == 0)) {\r
-      selectSql.append(" order by ").append(ob);\r
-    }\r
-\r
-    if (theAdaptor.hasLimit()) {\r
-      if ((limit > -1) && (offset > -1)) {\r
-        selectSql.append(" LIMIT ").append(limit).append(" OFFSET ").append(offset);\r
-      }\r
-    }\r
-\r
-    // execute sql\r
-    try {\r
-      con = getPooledCon();\r
-      stmt = con.createStatement();\r
-\r
-      // selecting...\r
-      rs = executeSql(stmt, selectSql.toString());\r
-\r
-      if (rs != null) {\r
-        if (!evaluatedMetaData) {\r
-          evalMetaData(rs.getMetaData());\r
-        }\r
-\r
-        theReturnList = new EntityList();\r
-\r
-        Entity theResultEntity;\r
-\r
-        while (rs.next()) {\r
-          theResultEntity = makeEntityFromResultSet(rs);\r
-          theReturnList.add(theResultEntity);\r
-          offsetCount++;\r
-        }\r
-\r
-        rs.close();\r
-      }\r
-\r
-      // making entitylist infos\r
-      if (!(theAdaptor.hasLimit())) {\r
-        count = offsetCount;\r
-      }\r
-\r
-      if (theReturnList != null) {\r
-        // now we decide if we have to know an overall count...\r
-        count = offsetCount;\r
-\r
-        if ((limit > -1) && (offset > -1)) {\r
-          if (offsetCount == limit) {\r
-            /** @todo counting should be deffered to entitylist\r
-             *  getSize() should be used */\r
-            rs = executeSql(stmt, countSql.toString());\r
-\r
-            if (rs != null) {\r
-              if (rs.next()) {\r
-                count = rs.getInt(1);\r
-              }\r
-\r
-              rs.close();\r
-            }\r
-            else {\r
-              logger.error("Could not count: " + countSql);\r
-            }\r
-          }\r
-        }\r
-\r
-        theReturnList.setCount(count);\r
-        theReturnList.setOffset(offset);\r
-        theReturnList.setWhere(wc);\r
-        theReturnList.setOrder(ob);\r
-        theReturnList.setStorage(this);\r
-        theReturnList.setLimit(limit);\r
-\r
-        if (offset >= limit) {\r
-          theReturnList.setPrevBatch(offset - limit);\r
-        }\r
-\r
-        if ((offset + offsetCount) < count) {\r
-          theReturnList.setNextBatch(offset + limit);\r
-        }\r
-\r
-        if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-          StoreIdentifier sid = theReturnList.getStoreIdentifier();\r
-          logger.debug("CACHE (add): " + sid.toString());\r
-          o_store.add(sid);\r
-        }\r
-      }\r
-    } catch (SQLException sqe) {\r
-      throwSQLException(sqe, "selectByWhereClause");\r
-    } finally {\r
-      try {\r
-        if (con != null) {\r
-          freeConnection(con, stmt);\r
-        }\r
-      } catch (Throwable t) {\r
-      }\r
-    }\r
-\r
-    return theReturnList;\r
-  }\r
-\r
-  /**\r
-   *  Bastelt aus einer Zeile der Datenbank ein EntityObjekt.\r
-   *\r
-   *  @param rs Das ResultSetObjekt.\r
-   *  @return Entity Die Entity.\r
-   */\r
-  private Entity makeEntityFromResultSet(ResultSet rs)\r
-    throws StorageObjectFailure {\r
-    /** @todo OS: get Pkey from ResultSet and consult ObjectStore */\r
-    Map theResultHash = new HashMap();\r
-    String theResult = null;\r
-    int theType;\r
-    Entity returnEntity = null;\r
-\r
-    try {\r
-      int size = metadataFields.size();\r
-\r
-      for (int i = 0; i < size; i++) {\r
-        // alle durchlaufen bis nix mehr da\r
-        theType = metadataTypes[i];\r
-\r
-        if (theType == java.sql.Types.LONGVARBINARY) {\r
-          InputStreamReader is =\r
-            (InputStreamReader) rs.getCharacterStream(i + 1);\r
-\r
-          if (is != null) {\r
-            char[] data = new char[32768];\r
-            StringBuffer theResultString = new StringBuffer();\r
-            int len;\r
-\r
-            while ((len = is.read(data)) > 0) {\r
-              theResultString.append(data, 0, len);\r
-            }\r
-\r
-            is.close();\r
-            theResult = theResultString.toString();\r
-          } else {\r
-            theResult = null;\r
-          }\r
-        } else {\r
-          theResult = getValueAsString(rs, (i + 1), theType);\r
-        }\r
-\r
-        if (theResult != null) {\r
-          theResultHash.put(metadataFields.get(i), theResult);\r
-        }\r
-      }\r
-\r
-      if (theEntityClass != null) {\r
-        returnEntity = (Entity) theEntityClass.newInstance();\r
-        returnEntity.setValues(theResultHash);\r
-        returnEntity.setStorage(myselfDatabase);\r
-\r
-        if (returnEntity instanceof StorableObject) {\r
-          logger.debug("CACHE: ( in) " + returnEntity.getId() + " :" + theTable);\r
-          o_store.add(((StorableObject) returnEntity).getStoreIdentifier());\r
-        }\r
-      } else {\r
-        throwStorageObjectException("Internal Error: theEntityClass not set!");\r
-      }\r
-    } catch (IllegalAccessException e) {\r
-      throwStorageObjectException("No access! -- " + e.getMessage());\r
-    } catch (IOException e) {\r
-      throwStorageObjectException("IOException! -- " + e.getMessage());\r
-    } catch (InstantiationException e) {\r
-      throwStorageObjectException("No Instatiation! -- " + e.getMessage());\r
-    } catch (SQLException sqe) {\r
-      throwSQLException(sqe, "makeEntityFromResultSet");\r
-\r
-      return null;\r
-    }\r
-\r
-    return returnEntity;\r
-  }\r
-\r
-  /**\r
-   * insert-Operator: f?gt eine Entity in die Tabelle ein. Eine Spalte WEBDB_CREATE\r
-   * wird automatisch mit dem aktuellen Datum gefuellt.\r
-   *\r
-   * @param theEntity\r
-   * @return der Wert des Primary-keys der eingef?gten Entity\r
-   */\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    //cache\r
-    invalidatePopupCache();\r
-\r
-    // invalidating all EntityLists corresponding with theEntityClass\r
-    if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-      StoreContainerType stoc_type =\r
-        StoreContainerType.valueOf(theEntityClass,\r
-          StoreContainerType.STOC_TYPE_ENTITYLIST);\r
-      o_store.invalidate(stoc_type);\r
-    }\r
-\r
-    String returnId = null;\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-\r
-    try {\r
-      List streamedInput = theEntity.streamedInput();\r
-      StringBuffer f = new StringBuffer();\r
-      StringBuffer v = new StringBuffer();\r
-      String aField;\r
-      String aValue;\r
-      boolean firstField = true;\r
-\r
-      // make sql-string\r
-      for (int i = 0; i < getFields().size(); i++) {\r
-        aField = (String) getFields().get(i);\r
-\r
-        if (!aField.equals(thePKeyName)) {\r
-          aValue = null;\r
-\r
-          // exceptions\r
-          if (aField.equals("webdb_create") ||\r
-              aField.equals("webdb_lastchange")) {\r
-            aValue = "NOW()";\r
-          } else {\r
-            if ((streamedInput != null) && streamedInput.contains(aField)) {\r
-              aValue = "?";\r
-            } else {\r
-              if (theEntity.hasValueForField(aField)) {\r
-                aValue =\r
-                  "'" +\r
-                  JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(\r
-                      aField)) + "'";\r
-              }\r
-            }\r
-          }\r
-\r
-          // wenn Wert gegeben, dann einbauen\r
-          if (aValue != null) {\r
-            if (firstField == false) {\r
-              f.append(",");\r
-              v.append(",");\r
-            }\r
-            else {\r
-              firstField = false;\r
-            }\r
-\r
-            f.append(aField);\r
-            v.append(aValue);\r
-          }\r
-        }\r
-      }\r
-       // end for\r
-\r
-      // insert into db\r
-      StringBuffer sqlBuf =\r
-        new StringBuffer("insert into ").append(theTable).append("(").append(f)\r
-                                        .append(") values (").append(v).append(")");\r
-      String sql = sqlBuf.toString();\r
-\r
-      //theLog.printInfo("INSERT: " + sql);\r
-      con = getPooledCon();\r
-      con.setAutoCommit(false);\r
-      pstmt = con.prepareStatement(sql);\r
-\r
-      if (streamedInput != null) {\r
-        for (int i = 0; i < streamedInput.size(); i++) {\r
-          String inputString =\r
-            (String) theEntity.getValue((String) streamedInput.get(i));\r
-          pstmt.setBytes(i + 1, inputString.getBytes());\r
-        }\r
-      }\r
-\r
-      int ret = pstmt.executeUpdate();\r
-\r
-      if (ret == 0) {\r
-        //insert failed\r
-        return null;\r
-      }\r
-\r
-      pstmt =\r
-        con.prepareStatement(theAdaptor.getLastInsertSQL(\r
-            (Database) myselfDatabase));\r
-\r
-      ResultSet rs = pstmt.executeQuery();\r
-      rs.next();\r
-      returnId = rs.getString(1);\r
-      theEntity.setId(returnId);\r
-    }\r
-    catch (SQLException sqe) {\r
-      throwSQLException(sqe, "insert");\r
-    }\r
-    finally {\r
-      try {\r
-        con.setAutoCommit(true);\r
-      }\r
-      catch (Exception e) {\r
-      }\r
-\r
-      freeConnection(con, pstmt);\r
-    }\r
-\r
-    /** @todo store entity in o_store */\r
-    return returnId;\r
-  }\r
-\r
-  /**\r
-   * update-Operator: aktualisiert eine Entity. Eine Spalte WEBDB_LASTCHANGE\r
-   * wird automatisch mit dem aktuellen Datum gefuellt.\r
-   *\r
-   * @param theEntity\r
-   */\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-\r
-    /** @todo this is stupid: why do we prepare statement, when we\r
-     *  throw it away afterwards. should be regular statement\r
-     *  update/insert could better be one routine called save()\r
-     *  that chooses to either insert or update depending if we\r
-     *  have a primary key in the entity. i don't know if we\r
-     *  still need the streamed input fields. // rk  */\r
-    /** @todo extension: check if Entity did change, otherwise we don't need\r
-     *  the roundtrip to the database */\r
-    /** invalidating corresponding entitylists in o_store*/\r
-    if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-      StoreContainerType stoc_type =\r
-        StoreContainerType.valueOf(theEntityClass,\r
-          StoreContainerType.STOC_TYPE_ENTITYLIST);\r
-      o_store.invalidate(stoc_type);\r
-    }\r
-\r
-    List streamedInput = theEntity.streamedInput();\r
-    String id = theEntity.getId();\r
-    String aField;\r
-    StringBuffer fv = new StringBuffer();\r
-    boolean firstField = true;\r
-\r
-    //cache\r
-    invalidatePopupCache();\r
-\r
-    // build sql statement\r
-    for (int i = 0; i < getFields().size(); i++) {\r
-      aField = (String) metadataFields.get(i);\r
-\r
-      // only normal cases\r
-      if (  !(aField.equals(thePKeyName) ||\r
-            aField.equals("webdb_create") ||\r
-            aField.equals("webdb_lastchange") ||\r
-            ((streamedInput != null) && streamedInput.contains(aField)))) {\r
-        if (theEntity.hasValueForField(aField)) {\r
-          if (firstField == false) {\r
-            fv.append(", ");\r
-          }\r
-          else {\r
-            firstField = false;\r
-          }\r
-\r
-          fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(aField))).append("'");\r
-\r
-          //              fv.append(aField).append("='").append(StringUtil.quote((String)theEntity.getValue(aField))).append("'");\r
-        }\r
-      }\r
-    }\r
-\r
-    StringBuffer sql =\r
-      new StringBuffer("update ").append(theTable).append(" set ").append(fv);\r
-\r
-    // exceptions\r
-    if (metadataFields.contains("webdb_lastchange")) {\r
-      sql.append(",webdb_lastchange=NOW()");\r
-    }\r
-\r
-    // special case: the webdb_create requires the field in yyyy-mm-dd HH:mm\r
-    // format so anything extra will be ignored. -mh\r
-    if (metadataFields.contains("webdb_create") &&\r
-        theEntity.hasValueForField("webdb_create")) {\r
-      // minimum of 10 (yyyy-mm-dd)...\r
-      if (theEntity.getValue("webdb_create").length() >= 10) {\r
-        String dateString = theEntity.getValue("webdb_create");\r
-\r
-        // if only 10, then add 00:00 so it doesn't throw a ParseException\r
-        if (dateString.length() == 10) {\r
-          dateString = dateString + " 00:00";\r
-        }\r
-\r
-        // TimeStamp stuff\r
-        try {\r
-          java.util.Date d = _dateFormatterIn.parse(dateString);\r
-          Timestamp tStamp = new Timestamp(d.getTime());\r
-          sql.append(",webdb_create='" + tStamp.toString() + "'");\r
-        } catch (ParseException e) {\r
-          throw new StorageObjectFailure(e);\r
-        }\r
-      }\r
-    }\r
-\r
-    if (streamedInput != null) {\r
-      for (int i = 0; i < streamedInput.size(); i++) {\r
-        sql.append(",").append(streamedInput.get(i)).append("=?");\r
-      }\r
-    }\r
-\r
-    sql.append(" where id=").append(id);\r
-\r
-    //theLog.printInfo("UPDATE: " + sql);\r
-    // execute sql\r
-    try {\r
-      con = getPooledCon();\r
-      con.setAutoCommit(false);\r
-      pstmt = con.prepareStatement(sql.toString());\r
-\r
-      if (streamedInput != null) {\r
-        for (int i = 0; i < streamedInput.size(); i++) {\r
-          String inputString =\r
-            theEntity.getValue((String) streamedInput.get(i));\r
-          pstmt.setBytes(i + 1, inputString.getBytes());\r
-        }\r
-      }\r
-\r
-      pstmt.executeUpdate();\r
-    } catch (SQLException sqe) {\r
-      throwSQLException(sqe, "update");\r
-    } finally {\r
-      try {\r
-        con.setAutoCommit(true);\r
-      } catch (Exception e) {\r
-        ;\r
-      }\r
-\r
-      freeConnection(con, pstmt);\r
-    }\r
-  }\r
-\r
-  /*\r
-  *   delete-Operator\r
-  *   @param id des zu loeschenden Datensatzes\r
-  *   @return boolean liefert true zurueck, wenn loeschen erfolgreich war.\r
-   */\r
-  public boolean delete(String id) throws StorageObjectFailure {\r
-    invalidatePopupCache();\r
-\r
-    // ostore send notification\r
-    if (StoreUtil.implementsStorableObject(theEntityClass)) {\r
-      String uniqueId = id;\r
-\r
-      if (theEntityClass.equals(StorableObjectEntity.class)) {\r
-        uniqueId += ("@" + theTable);\r
-      }\r
-\r
-      logger.debug("CACHE: (del) " + id);\r
-\r
-      StoreIdentifier search_sid =\r
-        new StoreIdentifier(theEntityClass,\r
-          StoreContainerType.STOC_TYPE_ENTITY, uniqueId);\r
-      o_store.invalidate(search_sid);\r
-    }\r
-\r
-    /** @todo could be prepared Statement */\r
-    Statement stmt = null;\r
-    Connection con = null;\r
-    int res = 0;\r
-    String sql =\r
-      "delete from " + theTable + " where " + thePKeyName + "='" + id + "'";\r
-\r
-    //theLog.printInfo("DELETE " + sql);\r
-    try {\r
-      con = getPooledCon();\r
-      stmt = con.createStatement();\r
-      res = stmt.executeUpdate(sql);\r
-    } catch (SQLException sqe) {\r
-      throwSQLException(sqe, "delete");\r
-    } finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    return (res > 0) ? true : false;\r
-  }\r
-\r
-  /* noch nicht implementiert.\r
-  * @return immer false\r
-   */\r
-  public boolean delete(EntityList theEntityList) {\r
-    invalidatePopupCache();\r
-\r
-    return false;\r
-  }\r
-\r
-  /**\r
-   * Diese Methode sollte ueberschrieben werden, wenn fuer die abgeleitete Database-Klasse\r
-   * eine SimpleList mit Standard-Popupdaten erzeugt werden koennen soll.\r
-   * @return null\r
-   */\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return null;\r
-  }\r
-\r
-  /**\r
-   *  Holt Daten fuer Popups.\r
-   *  @param name  Name des Feldes.\r
-   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.\r
-   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.\r
-   */\r
-  public SimpleList getPopupData(String name, boolean hasNullValue)\r
-    throws StorageObjectFailure {\r
-    return getPopupData(name, hasNullValue, null);\r
-  }\r
-\r
-  /**\r
-   *  Holt Daten fuer Popups.\r
-   *  @param name  Name des Feldes.\r
-   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.\r
-   *  @param where  Schraenkt die Selektion der Datensaetze ein.\r
-   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.\r
-   */\r
-  public SimpleList getPopupData(String name, boolean hasNullValue, String where)\r
-    throws StorageObjectFailure {\r
-    return getPopupData(name, hasNullValue, where, null);\r
-  }\r
-\r
-  /**\r
-   *  Holt Daten fuer Popups.\r
-   *  @param name  Name des Feldes.\r
-   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.\r
-   *  @param where  Schraenkt die Selektion der Datensaetze ein.\r
-   *  @param order  Gibt ein Feld als Sortierkriterium an.\r
-   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.\r
-   */\r
-  public SimpleList getPopupData(String name, boolean hasNullValue,\r
-    String where, String order) throws StorageObjectFailure {\r
-    // caching\r
-    if (hasPopupCache && (popupCache != null)) {\r
-      return popupCache;\r
-    }\r
-\r
-    SimpleList simpleList = null;\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-\r
-    // build sql\r
-    StringBuffer sql =\r
-      new StringBuffer("select ").append(thePKeyName).append(",").append(name)\r
-                                 .append(" from ").append(theTable);\r
-\r
-    if ((where != null) && !(where.length() == 0)) {\r
-      sql.append(" where ").append(where);\r
-    }\r
-\r
-    sql.append(" order by ");\r
-\r
-    if ((order != null) && !(order.length() == 0)) {\r
-      sql.append(order);\r
-    } else {\r
-      sql.append(name);\r
-    }\r
-\r
-    // execute sql\r
-    try {\r
-      con = getPooledCon();\r
-    } catch (Exception e) {\r
-      throw new StorageObjectFailure(e);\r
-    }\r
-\r
-    try {\r
-      stmt = con.createStatement();\r
-\r
-      ResultSet rs = executeSql(stmt, sql.toString());\r
-\r
-      if (rs != null) {\r
-        if (!evaluatedMetaData) {\r
-          get_meta_data();\r
-        }\r
-\r
-        simpleList = new SimpleList();\r
-\r
-        // if popup has null-selector\r
-        if (hasNullValue) {\r
-          simpleList.add(POPUP_EMPTYLINE);\r
-        }\r
-\r
-        SimpleHash popupDict;\r
-\r
-        while (rs.next()) {\r
-          popupDict = new SimpleHash();\r
-          popupDict.put("key", getValueAsString(rs, 1, thePKeyType));\r
-          popupDict.put("value", rs.getString(2));\r
-          simpleList.add(popupDict);\r
-        }\r
-\r
-        rs.close();\r
-      }\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("getPopupData: " + e.getMessage());\r
-      throw new StorageObjectFailure(e);\r
-    } finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    if (hasPopupCache) {\r
-      popupCache = simpleList;\r
-    }\r
-\r
-    return simpleList;\r
-  }\r
-\r
-  /**\r
-   * Liefert alle Daten der Tabelle als SimpleHash zurueck. Dies wird verwandt,\r
-   * wenn in den Templates ein Lookup-Table benoetigt wird. Sollte nur bei kleinen\r
-   * Tabellen Verwendung finden.\r
-   * @return SimpleHash mit den Tabellezeilen.\r
-   */\r
-  public SimpleHash getHashData() {\r
-    /** @todo dangerous! this should have a flag to be enabled, otherwise\r
-     *  very big Hashes could be returned */\r
-    if (hashCache == null) {\r
-      try {\r
-        hashCache =\r
-          HTMLTemplateProcessor.makeSimpleHash(selectByWhereClause("", -1));\r
-      }\r
-      catch (StorageObjectFailure e) {\r
-        logger.debug(e.getMessage());\r
-      }\r
-    }\r
-\r
-    return hashCache;\r
-  }\r
-\r
-  /* invalidates the popupCache\r
-   */\r
-  protected void invalidatePopupCache() {\r
-    /** @todo  invalidates toooo much */\r
-    popupCache = null;\r
-    hashCache = null;\r
-  }\r
-\r
-  /**\r
-   * Diese Methode fuehrt den Sqlstring <i>sql</i> aus und timed im Logfile.\r
-   * @param stmt Statemnt\r
-   * @param sql Sql-String\r
-   * @return ResultSet\r
-   * @exception StorageObjectException\r
-   */\r
-  public ResultSet executeSql(Statement stmt, String sql)\r
-                            throws StorageObjectFailure, SQLException {\r
-    ResultSet rs;\r
-    long startTime = System.currentTimeMillis();\r
-\r
-    try {\r
-      rs = stmt.executeQuery(sql);\r
-\r
-      logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-    }\r
-    catch (SQLException e) {\r
-      logger.error(e.getMessage() +"\n" + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-      throw e;\r
-    }\r
-\r
-    return rs;\r
-  }\r
-\r
-  /**\r
-   * returns the number of rows in the table\r
-   */\r
-  public int getSize(String where) throws SQLException, StorageObjectFailure {\r
-    long startTime = System.currentTimeMillis();\r
-    String sql = "SELECT Count(*) FROM " + theTable;\r
-\r
-    if ((where != null) && !(where.length() == 0)) {\r
-      sql = sql + " where " + where;\r
-    }\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    int result = 0;\r
-\r
-    try {\r
-      con = getPooledCon();\r
-      stmt = con.createStatement();\r
-\r
-      ResultSet rs = executeSql(stmt, sql);\r
-\r
-      while (rs.next()) {\r
-        result = rs.getInt(1);\r
-      }\r
-    }\r
-    catch (SQLException e) {\r
-      logger.error("Database.getSize: " + e.getMessage());\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    //theLog.printInfo(theTable + " has "+ result +" rows where " + where);\r
-    logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-\r
-    return result;\r
-  }\r
-\r
-  public int executeUpdate(Statement stmt, String sql)\r
-    throws StorageObjectFailure, SQLException {\r
-    int rs;\r
-    long startTime = System.currentTimeMillis();\r
-\r
-    try {\r
-      rs = stmt.executeUpdate(sql);\r
-\r
-      logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-    }\r
-    catch (SQLException e) {\r
-      logger.debug("Failed: " + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-      throw e;\r
-    }\r
-\r
-    return rs;\r
-  }\r
-\r
-  public int executeUpdate(String sql)\r
-    throws StorageObjectFailure, SQLException {\r
-    int result = -1;\r
-    long startTime = System.currentTimeMillis();\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-\r
-    try {\r
-      con = getPooledCon();\r
-      pstmt = con.prepareStatement(sql);\r
-      result = pstmt.executeUpdate();\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Database.executeUpdate(" + sql + "): " + e.getMessage());\r
-      throw new StorageObjectFailure("Database.executeUpdate(" + sql + "): " + e.getMessage(), e);\r
-    }\r
-    finally {\r
-      freeConnection(con, pstmt);\r
-    }\r
-\r
-    logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);\r
-    return result;\r
-  }\r
-\r
-  /**\r
-   * Wertet ResultSetMetaData aus und setzt interne Daten entsprechend\r
-   * @param md ResultSetMetaData\r
-   * @exception StorageObjectException\r
-   */\r
-  private void evalMetaData(ResultSetMetaData md) throws StorageObjectFailure {\r
-    this.evaluatedMetaData = true;\r
-    this.metadataFields = new ArrayList();\r
-    this.metadataLabels = new ArrayList();\r
-    this.metadataNotNullFields = new ArrayList();\r
-\r
-    try {\r
-      int numFields = md.getColumnCount();\r
-      this.metadataTypes = new int[numFields];\r
-\r
-      String aField;\r
-      int aType;\r
-\r
-      for (int i = 1; i <= numFields; i++) {\r
-        aField = md.getColumnName(i);\r
-        metadataFields.add(aField);\r
-        metadataLabels.add(md.getColumnLabel(i));\r
-        aType = md.getColumnType(i);\r
-        metadataTypes[i - 1] = aType;\r
-\r
-        if (aField.equals(thePKeyName)) {\r
-          thePKeyType = aType;\r
-          thePKeyIndex = i;\r
-        }\r
-\r
-        if (md.isNullable(i) == ResultSetMetaData.columnNullable) {\r
-          metadataNotNullFields.add(aField);\r
-        }\r
-      }\r
-    }\r
-    catch (SQLException e) {\r
-      throwSQLException(e, "evalMetaData");\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Wertet die Metadaten eines Resultsets fuer eine Tabelle aus,\r
-   *  um die alle Columns und Typen einer Tabelle zu ermitteln.\r
-   */\r
-  private void get_meta_data() throws StorageObjectFailure {\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-    String sql = "select * from " + theTable + " where 0=1";\r
-\r
-    try {\r
-      con = getPooledCon();\r
-      pstmt = con.prepareStatement(sql);\r
-\r
-      logger.debug("METADATA: " + sql);\r
-      ResultSet rs = pstmt.executeQuery();\r
-      evalMetaData(rs.getMetaData());\r
-      rs.close();\r
-    }\r
-    catch (SQLException e) {\r
-      throwSQLException(e, "get_meta_data");\r
-    }\r
-    finally {\r
-      freeConnection(con, pstmt);\r
-    }\r
-  }\r
-\r
-  public Connection getPooledCon() throws StorageObjectFailure {\r
-    Connection con = null;\r
-\r
-    try {\r
-      con = SQLManager.getInstance().requestConnection();\r
-    }\r
-    catch (SQLException e) {\r
-      logger.error("could not connect to the database " + e.getMessage());\r
-\r
-      throw new StorageObjectFailure("Could not connect to the database", e);\r
-    }\r
-\r
-    return con;\r
-  }\r
-\r
-  public void freeConnection(Connection con, Statement stmt)\r
-    throws StorageObjectFailure {\r
-    SQLManager.closeStatement(stmt);\r
-    SQLManager.getInstance().returnConnection(con);\r
-  }\r
-\r
-  /**\r
-   * Wertet SQLException aus und wirft dannach eine StorageObjectException\r
-   * @param sqe SQLException\r
-   * @param wo Funktonsname, in der die SQLException geworfen wurde\r
-   * @exception StorageObjectException\r
-   */\r
-  protected void throwSQLException(SQLException sqe, String aFunction)\r
-    throws StorageObjectFailure {\r
-    String state = "";\r
-    String message = "";\r
-    int vendor = 0;\r
-\r
-    if (sqe != null) {\r
-      state = sqe.getSQLState();\r
-      message = sqe.getMessage();\r
-      vendor = sqe.getErrorCode();\r
-    }\r
-\r
-    String information =\r
-        "SQL Error: " +\r
-        "state= " + state +\r
-        ", vendor= " + vendor +\r
-        ", message=" + message +\r
-        ", function= " + aFunction;\r
-\r
-    logger.error(information);\r
-\r
-    throw new StorageObjectFailure(information, sqe);\r
-  }\r
-\r
-  protected void _throwStorageObjectException(Exception e, String aFunction)\r
-    throws StorageObjectFailure {\r
-\r
-    if (e != null) {\r
-      logger.error(e.getMessage() + aFunction);\r
-      throw new StorageObjectFailure(aFunction, e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Loggt Fehlermeldung mit dem Parameter Message und wirft dannach\r
-   * eine StorageObjectException\r
-   * @param message Nachricht mit dem Fehler\r
-   * @exception StorageObjectException\r
-   */\r
-  void throwStorageObjectException(String aMessage) throws StorageObjectFailure {\r
-    logger.error(aMessage);\r
-    throw new StorageObjectFailure(aMessage, null);\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+package mir.storage;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.entity.StorableObjectEntity;
+import mir.log.LoggerWrapper;
+import mir.misc.HTMLTemplateProcessor;
+import mir.misc.StringUtil;
+import mir.storage.store.ObjectStore;
+import mir.storage.store.StorableObject;
+import mir.storage.store.StoreContainerType;
+import mir.storage.store.StoreIdentifier;
+import mir.storage.store.StoreUtil;
+import mir.util.JDBCStringRoutines;
+
+import com.codestudio.util.SQLManager;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+
+
+/**
+ * Diese Klasse implementiert die Zugriffsschicht auf die Datenbank.
+ * Alle Projektspezifischen Datenbankklassen erben von dieser Klasse.
+ * In den Unterklassen wird im Minimalfall nur die Tabelle angegeben.
+ * Im Konfigurationsfile findet sich eine Verweis auf den verwendeten
+ * Treiber, Host, User und Passwort, ueber den der Zugriff auf die
+ * Datenbank erfolgt.
+ *
+ * @version $Id: Database.java,v 1.37 2003/04/09 02:06:07 zapata Exp $
+ * @author rk
+ *
+ */
+public class Database implements StorageObject {
+  private static Class GENERIC_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;
+  private static Class STORABLE_OBJECT_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;
+
+
+  private static SimpleHash POPUP_EMPTYLINE = new SimpleHash();
+  protected static final ObjectStore o_store = ObjectStore.getInstance();
+  private static final int _millisPerHour = 60 * 60 * 1000;
+  private static final int _millisPerMinute = 60 * 1000;
+
+  static {
+    // always same object saves a little space
+    POPUP_EMPTYLINE.put("key", "");
+    POPUP_EMPTYLINE.put("value", "--");
+  }
+
+  protected LoggerWrapper logger;
+  protected MirPropertiesConfiguration configuration;
+  protected String theTable;
+  protected String theCoreTable = null;
+  protected String thePKeyName = "id";
+  protected int thePKeyType;
+  protected int thePKeyIndex;
+  protected boolean evaluatedMetaData = false;
+  protected ArrayList metadataFields;
+  protected ArrayList metadataLabels;
+  protected ArrayList metadataNotNullFields;
+  protected int[] metadataTypes;
+  protected Class theEntityClass;
+  protected StorageObject myselfDatabase;
+  protected SimpleList popupCache = null;
+  protected boolean hasPopupCache = false;
+  protected SimpleHash hashCache = null;
+  protected boolean hasTimestamp = true;
+  private String database_driver;
+  private String database_url;
+  private int defaultLimit;
+  protected DatabaseAdaptor theAdaptor;
+  private SimpleDateFormat _dateFormatterOut =
+    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private SimpleDateFormat _dateFormatterIn =
+    new SimpleDateFormat("yyyy-MM-dd HH:mm");
+  private Calendar _cal = new GregorianCalendar();
+
+  /**
+   * Kontruktor bekommt den Filenamen des Konfigurationsfiles ?bergeben.
+   * Aus diesem file werden <code>Database.Logfile</code>,
+   * <code>Database.Username</code>,<code>Database.Password</code>,
+   * <code>Database.Host</code> und <code>Database.Adaptor</code>
+   * ausgelesen und ein Broker f?r die Verbindugen zur Datenbank
+   * erzeugt.
+   *
+   * @param   String confFilename Dateiname der Konfigurationsdatei
+   */
+  public Database() throws StorageObjectFailure {
+    try {
+      configuration = MirPropertiesConfiguration.instance();
+    }
+    catch (PropertiesConfigExc e) {
+      throw new StorageObjectFailure(e);
+    }
+    logger = new LoggerWrapper("Database");
+
+    String theAdaptorName = configuration.getString("Database.Adaptor");
+    defaultLimit = Integer.parseInt(configuration.getString("Database.Limit"));
+
+    try {
+      theEntityClass = GENERIC_ENTITY_CLASS;
+      theAdaptor = (DatabaseAdaptor) Class.forName(theAdaptorName).newInstance();
+    }
+    catch (Throwable e) {
+      logger.error("Error in Database() constructor with " + theAdaptorName + " -- " + e.getMessage());
+      throw new StorageObjectFailure("Error in Database() constructor.", e);
+    }
+  }
+
+  /**
+   * Liefert die Entity-Klasse zur?ck, in der eine Datenbankzeile gewrappt
+   * wird. Wird die Entity-Klasse durch die erbende Klasse nicht ?berschrieben,
+   * wird eine mir.entity.GenericEntity erzeugt.
+   *
+   * @return Class-Objekt der Entity
+   */
+  public java.lang.Class getEntityClass() {
+    return theEntityClass;
+  }
+
+  /**
+   * Liefert die Standardbeschr?nkung von select-Statements zur?ck, also
+   * wieviel Datens?tze per Default selektiert werden.
+   *
+   * @return Standard-Anzahl der Datens?tze
+   */
+  public int getLimit() {
+    return defaultLimit;
+  }
+
+  /**
+   * Liefert den Namen des Primary-Keys zur?ck. Wird die Variable nicht von
+   * der erbenden Klasse ?berschrieben, so ist der Wert <code>PKEY</code>
+   * @return Name des Primary-Keys
+   */
+  public String getIdName() {
+    return thePKeyName;
+  }
+
+  /**
+   * Liefert den Namen der Tabelle, auf das sich das Datenbankobjekt bezieht.
+   *
+   * @return Name der Tabelle
+   */
+  public String getTableName() {
+    return theTable;
+  }
+
+  /*
+  *   Dient dazu vererbte Tabellen bei objectrelationalen DBMS
+  *   zu speichern, wenn die id einer Tabelle in der parenttabelle verwaltet
+  *   wird.
+  *   @return liefert theCoreTabel als String zurueck, wenn gesetzt, sonst
+  *    the Table
+   */
+  public String getCoreTable() {
+    if (theCoreTable != null) {
+      return theCoreTable;
+    } else {
+      return theTable;
+    }
+  }
+
+  /**
+   * Liefert Feldtypen der Felder der Tabelle zurueck (s.a. java.sql.Types)
+   * @return int-Array mit den Typen der Felder
+   * @exception StorageObjectException
+   */
+  public int[] getTypes() throws StorageObjectFailure {
+    if (metadataTypes == null) {
+      get_meta_data();
+    }
+
+    return metadataTypes;
+  }
+
+  /**
+   * Liefert eine Liste der Labels der Tabellenfelder
+   * @return ArrayListe mit Labeln
+   * @exception StorageObjectException
+   */
+  public List getLabels() throws StorageObjectFailure {
+    if (metadataLabels == null) {
+      get_meta_data();
+    }
+
+    return metadataLabels;
+  }
+
+  /**
+   * Liefert eine Liste der Felder der Tabelle
+   * @return ArrayList mit Feldern
+   * @exception StorageObjectException
+   */
+  public List getFields() throws StorageObjectFailure {
+    if (metadataFields == null) {
+      get_meta_data();
+    }
+
+    return metadataFields;
+  }
+
+  /*
+  *   Gets value out of ResultSet according to type and converts to String
+  *   @param inValue  Wert aus ResultSet.
+  *   @param aType  Datenbanktyp.
+  *   @return liefert den Wert als String zurueck. Wenn keine Umwandlung moeglich
+  *           dann /unsupported value/
+   */
+  private String getValueAsString(ResultSet rs, int valueIndex, int aType)
+    throws StorageObjectFailure {
+    String outValue = null;
+
+    if (rs != null) {
+      try {
+        switch (aType) {
+        case java.sql.Types.BIT:
+          outValue = (rs.getBoolean(valueIndex) == true) ? "1" : "0";
+
+          break;
+
+        case java.sql.Types.INTEGER:
+        case java.sql.Types.SMALLINT:
+        case java.sql.Types.TINYINT:
+        case java.sql.Types.BIGINT:
+
+          int out = rs.getInt(valueIndex);
+
+          if (!rs.wasNull()) {
+            outValue = new Integer(out).toString();
+          }
+
+          break;
+
+        case java.sql.Types.NUMERIC:
+
+          /** @todo Numeric can be float or double depending upon
+           *  metadata.getScale() / especially with oracle */
+          long outl = rs.getLong(valueIndex);
+
+          if (!rs.wasNull()) {
+            outValue = new Long(outl).toString();
+          }
+
+          break;
+
+        case java.sql.Types.REAL:
+
+          float tempf = rs.getFloat(valueIndex);
+
+          if (!rs.wasNull()) {
+            tempf *= 10;
+            tempf += 0.5;
+
+            int tempf_int = (int) tempf;
+            tempf = (float) tempf_int;
+            tempf /= 10;
+            outValue = "" + tempf;
+            outValue = outValue.replace('.', ',');
+          }
+
+          break;
+
+        case java.sql.Types.DOUBLE:
+
+          double tempd = rs.getDouble(valueIndex);
+
+          if (!rs.wasNull()) {
+            tempd *= 10;
+            tempd += 0.5;
+
+            int tempd_int = (int) tempd;
+            tempd = (double) tempd_int;
+            tempd /= 10;
+            outValue = "" + tempd;
+            outValue = outValue.replace('.', ',');
+          }
+
+          break;
+
+        case java.sql.Types.CHAR:
+        case java.sql.Types.VARCHAR:
+        case java.sql.Types.LONGVARCHAR:
+          outValue = rs.getString(valueIndex);
+
+          break;
+
+        case java.sql.Types.LONGVARBINARY:
+          outValue = rs.getString(valueIndex);
+
+          break;
+
+        case java.sql.Types.TIMESTAMP:
+
+          // it's important to use Timestamp here as getting it
+          // as a string is undefined and is only there for debugging
+          // according to the API. we can make it a string through formatting.
+          // -mh
+          Timestamp timestamp = (rs.getTimestamp(valueIndex));
+
+          if (!rs.wasNull()) {
+            java.util.Date date = new java.util.Date(timestamp.getTime());
+            outValue = _dateFormatterOut.format(date);
+            _cal.setTime(date);
+
+            int offset =
+              _cal.get(Calendar.ZONE_OFFSET) + _cal.get(Calendar.DST_OFFSET);
+            String tzOffset =
+              StringUtil.zeroPaddingNumber(offset / _millisPerHour, 2, 2);
+            outValue = outValue + "+" + tzOffset;
+          }
+
+          break;
+
+        default:
+          outValue = "<unsupported value>";
+          logger.warn( "Unsupported Datatype: at " + valueIndex + " (" + aType + ")");
+        }
+      } catch (SQLException e) {
+        throw new StorageObjectFailure("Could not get Value out of Resultset -- ",
+          e);
+      }
+    }
+
+    return outValue;
+  }
+
+  /*
+  *   select-Operator um einen Datensatz zu bekommen.
+  *   @param id Primaerschluessel des Datensatzes.
+  *   @return liefert EntityObject des gefundenen Datensatzes oder null.
+   */
+  public Entity selectById(String id) throws StorageObjectExc {
+    if ((id == null) || id.equals("")) {
+      throw new StorageObjectExc("Database.selectById: Missing id");
+    }
+
+    // ask object store for object
+    if (StoreUtil.implementsStorableObject(theEntityClass)) {
+      String uniqueId = id;
+
+      if (theEntityClass.equals(StorableObjectEntity.class)) {
+        uniqueId += ("@" + theTable);
+      }
+
+      StoreIdentifier search_sid = new StoreIdentifier(theEntityClass, uniqueId);
+      logger.debug("CACHE: (dbg) looking for sid " + search_sid.toString());
+
+      Entity hit = (Entity) o_store.use(search_sid);
+
+      if (hit != null) {
+        return hit;
+      }
+    }
+
+    Statement stmt = null;
+    Connection con = getPooledCon();
+    Entity returnEntity = null;
+
+    try {
+      ResultSet rs;
+
+      /** @todo better prepared statement */
+      String selectSql =
+        "select * from " + theTable + " where " + thePKeyName + "=" + id;
+      stmt = con.createStatement();
+      rs = executeSql(stmt, selectSql);
+
+      if (rs != null) {
+        if (evaluatedMetaData == false) {
+          evalMetaData(rs.getMetaData());
+        }
+
+        if (rs.next()) {
+          returnEntity = makeEntityFromResultSet(rs);
+        }
+        else {
+          logger.debug("No data for id: " + id + " in table " + theTable);
+        }
+
+        rs.close();
+      }
+      else {
+        logger.debug("No Data for Id " + id + " in Table " + theTable);
+      }
+    }
+    catch (SQLException sqe) {
+      throwSQLException(sqe, "selectById");
+      return null;
+    }
+    catch (NumberFormatException e) {
+      logger.error("ID is no number: " + id);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+
+    return returnEntity;
+  }
+
+  /**
+   *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.
+   *   @param key  Datenbankfeld der Bedingung.
+   *   @param value  Wert die der key anehmen muss.
+   *   @return EntityList mit den gematchten Entities
+   */
+  public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure {
+    return selectByFieldValue(aField, aValue, 0);
+  }
+
+  /**
+   *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.
+   *   @param key  Datenbankfeld der Bedingung.
+   *   @param value  Wert die der key anehmen muss.
+   *   @param offset  Gibt an ab welchem Datensatz angezeigt werden soll.
+   *   @return EntityList mit den gematchten Entities
+   */
+  public EntityList selectByFieldValue(String aField, String aValue, int offset) throws StorageObjectFailure {
+    return selectByWhereClause(aField + "=" + aValue, offset);
+  }
+
+  /**
+   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
+   * Also offset wird der erste Datensatz genommen.
+   *
+   * @param wc where-Clause
+   * @return EntityList mit den gematchten Entities
+   * @exception StorageObjectException
+   */
+  public EntityList selectByWhereClause(String where)
+    throws StorageObjectFailure {
+    return selectByWhereClause(where, 0);
+  }
+
+  /**
+   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
+   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
+   *
+   * @param wc where-Clause
+   * @param offset ab welchem Datensatz.
+   * @return EntityList mit den gematchten Entities
+   * @exception StorageObjectException
+   */
+  public EntityList selectByWhereClause(String whereClause, int offset)
+    throws StorageObjectFailure {
+    return selectByWhereClause(whereClause, null, offset);
+  }
+
+  /**
+   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
+   * Also offset wird der erste Datensatz genommen.
+   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
+   *
+   * @param wc where-Clause
+   * @param ob orderBy-Clause
+   * @return EntityList mit den gematchten Entities
+   * @exception StorageObjectException
+   */
+  public EntityList selectByWhereClause(String where, String order)
+    throws StorageObjectFailure {
+    return selectByWhereClause(where, order, 0);
+  }
+
+  /**
+   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
+   * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
+   *
+   * @param wc where-Clause
+   * @param ob orderBy-Clause
+   * @param offset ab welchem Datensatz
+   * @return EntityList mit den gematchten Entities
+   * @exception StorageObjectException
+   */
+  public EntityList selectByWhereClause(String whereClause, String orderBy,
+    int offset) throws StorageObjectFailure {
+    return selectByWhereClause(whereClause, orderBy, offset, defaultLimit);
+  }
+
+  /**
+   * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
+   * @param wc where-Clause
+   * @param ob orderBy-Clause
+   * @param offset ab welchem Datensatz
+   * @param limit wieviele Datens?tze
+   * @return EntityList mit den gematchten Entities
+   * @exception StorageObjectException
+   */
+  public EntityList selectByWhereClause(String wc, String ob, int offset,
+    int limit) throws StorageObjectFailure {
+    // check o_store for entitylist
+    if (StoreUtil.implementsStorableObject(theEntityClass)) {
+      StoreIdentifier search_sid =
+        new StoreIdentifier(theEntityClass,
+          StoreContainerType.STOC_TYPE_ENTITYLIST,
+          StoreUtil.getEntityListUniqueIdentifierFor(theTable, wc, ob, offset,
+            limit));
+      EntityList hit = (EntityList) o_store.use(search_sid);
+
+      if (hit != null) {
+        logger.debug("CACHE (hit): " + search_sid.toString());
+
+        return hit;
+      }
+    }
+
+    // local
+    EntityList theReturnList = null;
+    Connection con = null;
+    Statement stmt = null;
+    ResultSet rs;
+    int offsetCount = 0;
+    int count = 0;
+
+    // build sql-statement
+
+    /** @todo count sql string should only be assembled if we really count
+     *  see below at the end of method //rk */
+    if ((wc != null) && (wc.trim().length() == 0)) {
+      wc = null;
+    }
+
+    StringBuffer countSql =
+      new StringBuffer("select count(*) from ").append(theTable);
+    StringBuffer selectSql =
+      new StringBuffer("select * from ").append(theTable);
+
+    if (wc != null) {
+      selectSql.append(" where ").append(wc);
+      countSql.append(" where ").append(wc);
+    }
+
+    if ((ob != null) && !(ob.trim().length() == 0)) {
+      selectSql.append(" order by ").append(ob);
+    }
+
+    if (theAdaptor.hasLimit()) {
+      if ((limit > -1) && (offset > -1)) {
+        selectSql.append(" LIMIT ").append(limit).append(" OFFSET ").append(offset);
+      }
+    }
+
+    // execute sql
+    try {
+      con = getPooledCon();
+      stmt = con.createStatement();
+
+      // selecting...
+      rs = executeSql(stmt, selectSql.toString());
+
+      if (rs != null) {
+        if (!evaluatedMetaData) {
+          evalMetaData(rs.getMetaData());
+        }
+
+        theReturnList = new EntityList();
+
+        Entity theResultEntity;
+
+        while (rs.next()) {
+          theResultEntity = makeEntityFromResultSet(rs);
+          theReturnList.add(theResultEntity);
+          offsetCount++;
+        }
+
+        rs.close();
+      }
+
+      // making entitylist infos
+      if (!(theAdaptor.hasLimit())) {
+        count = offsetCount;
+      }
+
+      if (theReturnList != null) {
+        // now we decide if we have to know an overall count...
+        count = offsetCount;
+
+        if ((limit > -1) && (offset > -1)) {
+          if (offsetCount == limit) {
+            /** @todo counting should be deffered to entitylist
+             *  getSize() should be used */
+            rs = executeSql(stmt, countSql.toString());
+
+            if (rs != null) {
+              if (rs.next()) {
+                count = rs.getInt(1);
+              }
+
+              rs.close();
+            }
+            else {
+              logger.error("Could not count: " + countSql);
+            }
+          }
+        }
+
+        theReturnList.setCount(count);
+        theReturnList.setOffset(offset);
+        theReturnList.setWhere(wc);
+        theReturnList.setOrder(ob);
+        theReturnList.setStorage(this);
+        theReturnList.setLimit(limit);
+
+        if (offset >= limit) {
+          theReturnList.setPrevBatch(offset - limit);
+        }
+
+        if ((offset + offsetCount) < count) {
+          theReturnList.setNextBatch(offset + limit);
+        }
+
+        if (StoreUtil.implementsStorableObject(theEntityClass)) {
+          StoreIdentifier sid = theReturnList.getStoreIdentifier();
+          logger.debug("CACHE (add): " + sid.toString());
+          o_store.add(sid);
+        }
+      }
+    } catch (SQLException sqe) {
+      throwSQLException(sqe, "selectByWhereClause");
+    } finally {
+      try {
+        if (con != null) {
+          freeConnection(con, stmt);
+        }
+      } catch (Throwable t) {
+      }
+    }
+
+    return theReturnList;
+  }
+
+  /**
+   *  Bastelt aus einer Zeile der Datenbank ein EntityObjekt.
+   *
+   *  @param rs Das ResultSetObjekt.
+   *  @return Entity Die Entity.
+   */
+  private Entity makeEntityFromResultSet(ResultSet rs)
+    throws StorageObjectFailure {
+    /** @todo OS: get Pkey from ResultSet and consult ObjectStore */
+    Map theResultHash = new HashMap();
+    String theResult = null;
+    int theType;
+    Entity returnEntity = null;
+
+    try {
+      int size = metadataFields.size();
+
+      for (int i = 0; i < size; i++) {
+        // alle durchlaufen bis nix mehr da
+        theType = metadataTypes[i];
+
+        if (theType == java.sql.Types.LONGVARBINARY) {
+          InputStreamReader is =
+            (InputStreamReader) rs.getCharacterStream(i + 1);
+
+          if (is != null) {
+            char[] data = new char[32768];
+            StringBuffer theResultString = new StringBuffer();
+            int len;
+
+            while ((len = is.read(data)) > 0) {
+              theResultString.append(data, 0, len);
+            }
+
+            is.close();
+            theResult = theResultString.toString();
+          } else {
+            theResult = null;
+          }
+        } else {
+          theResult = getValueAsString(rs, (i + 1), theType);
+        }
+
+        if (theResult != null) {
+          theResultHash.put(metadataFields.get(i), theResult);
+        }
+      }
+
+      if (theEntityClass != null) {
+        returnEntity = (Entity) theEntityClass.newInstance();
+        returnEntity.setValues(theResultHash);
+        returnEntity.setStorage(myselfDatabase);
+
+        if (returnEntity instanceof StorableObject) {
+          logger.debug("CACHE: ( in) " + returnEntity.getId() + " :" + theTable);
+          o_store.add(((StorableObject) returnEntity).getStoreIdentifier());
+        }
+      } else {
+        throwStorageObjectException("Internal Error: theEntityClass not set!");
+      }
+    } catch (IllegalAccessException e) {
+      throwStorageObjectException("No access! -- " + e.getMessage());
+    } catch (IOException e) {
+      throwStorageObjectException("IOException! -- " + e.getMessage());
+    } catch (InstantiationException e) {
+      throwStorageObjectException("No Instatiation! -- " + e.getMessage());
+    } catch (SQLException sqe) {
+      throwSQLException(sqe, "makeEntityFromResultSet");
+
+      return null;
+    }
+
+    return returnEntity;
+  }
+
+  /**
+   * insert-Operator: f?gt eine Entity in die Tabelle ein. Eine Spalte WEBDB_CREATE
+   * wird automatisch mit dem aktuellen Datum gefuellt.
+   *
+   * @param theEntity
+   * @return der Wert des Primary-keys der eingef?gten Entity
+   */
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    //cache
+    invalidatePopupCache();
+
+    // invalidating all EntityLists corresponding with theEntityClass
+    if (StoreUtil.implementsStorableObject(theEntityClass)) {
+      StoreContainerType stoc_type =
+        StoreContainerType.valueOf(theEntityClass,
+          StoreContainerType.STOC_TYPE_ENTITYLIST);
+      o_store.invalidate(stoc_type);
+    }
+
+    String returnId = null;
+    Connection con = null;
+    PreparedStatement pstmt = null;
+
+    try {
+      List streamedInput = theEntity.streamedInput();
+      StringBuffer f = new StringBuffer();
+      StringBuffer v = new StringBuffer();
+      String aField;
+      String aValue;
+      boolean firstField = true;
+
+      // make sql-string
+      for (int i = 0; i < getFields().size(); i++) {
+        aField = (String) getFields().get(i);
+
+        if (!aField.equals(thePKeyName)) {
+          aValue = null;
+
+          // exceptions
+          if (aField.equals("webdb_create") ||
+              aField.equals("webdb_lastchange")) {
+            aValue = "NOW()";
+          } else {
+            if ((streamedInput != null) && streamedInput.contains(aField)) {
+              aValue = "?";
+            } else {
+              if (theEntity.hasValueForField(aField)) {
+                aValue =
+                  "'" +
+                  JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(
+                      aField)) + "'";
+              }
+            }
+          }
+
+          // wenn Wert gegeben, dann einbauen
+          if (aValue != null) {
+            if (firstField == false) {
+              f.append(",");
+              v.append(",");
+            }
+            else {
+              firstField = false;
+            }
+
+            f.append(aField);
+            v.append(aValue);
+          }
+        }
+      }
+       // end for
+
+      // insert into db
+      StringBuffer sqlBuf =
+        new StringBuffer("insert into ").append(theTable).append("(").append(f)
+                                        .append(") values (").append(v).append(")");
+      String sql = sqlBuf.toString();
+
+      //theLog.printInfo("INSERT: " + sql);
+      con = getPooledCon();
+      con.setAutoCommit(false);
+      pstmt = con.prepareStatement(sql);
+
+      if (streamedInput != null) {
+        for (int i = 0; i < streamedInput.size(); i++) {
+          String inputString =
+            (String) theEntity.getValue((String) streamedInput.get(i));
+          pstmt.setBytes(i + 1, inputString.getBytes());
+        }
+      }
+
+      int ret = pstmt.executeUpdate();
+
+      if (ret == 0) {
+        //insert failed
+        return null;
+      }
+
+      pstmt =
+        con.prepareStatement(theAdaptor.getLastInsertSQL(
+            (Database) myselfDatabase));
+
+      ResultSet rs = pstmt.executeQuery();
+      rs.next();
+      returnId = rs.getString(1);
+      theEntity.setId(returnId);
+    }
+    catch (SQLException sqe) {
+      throwSQLException(sqe, "insert");
+    }
+    finally {
+      try {
+        con.setAutoCommit(true);
+      }
+      catch (Exception e) {
+      }
+
+      freeConnection(con, pstmt);
+    }
+
+    /** @todo store entity in o_store */
+    return returnId;
+  }
+
+  /**
+   * update-Operator: aktualisiert eine Entity. Eine Spalte WEBDB_LASTCHANGE
+   * wird automatisch mit dem aktuellen Datum gefuellt.
+   *
+   * @param theEntity
+   */
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    Connection con = null;
+    PreparedStatement pstmt = null;
+
+    /** @todo this is stupid: why do we prepare statement, when we
+     *  throw it away afterwards. should be regular statement
+     *  update/insert could better be one routine called save()
+     *  that chooses to either insert or update depending if we
+     *  have a primary key in the entity. i don't know if we
+     *  still need the streamed input fields. // rk  */
+    /** @todo extension: check if Entity did change, otherwise we don't need
+     *  the roundtrip to the database */
+    /** invalidating corresponding entitylists in o_store*/
+    if (StoreUtil.implementsStorableObject(theEntityClass)) {
+      StoreContainerType stoc_type =
+        StoreContainerType.valueOf(theEntityClass,
+          StoreContainerType.STOC_TYPE_ENTITYLIST);
+      o_store.invalidate(stoc_type);
+    }
+
+    List streamedInput = theEntity.streamedInput();
+    String id = theEntity.getId();
+    String aField;
+    StringBuffer fv = new StringBuffer();
+    boolean firstField = true;
+
+    //cache
+    invalidatePopupCache();
+
+    // build sql statement
+    for (int i = 0; i < getFields().size(); i++) {
+      aField = (String) metadataFields.get(i);
+
+      // only normal cases
+      if (  !(aField.equals(thePKeyName) ||
+            aField.equals("webdb_create") ||
+            aField.equals("webdb_lastchange") ||
+            ((streamedInput != null) && streamedInput.contains(aField)))) {
+        if (theEntity.hasValueForField(aField)) {
+          if (firstField == false) {
+            fv.append(", ");
+          }
+          else {
+            firstField = false;
+          }
+
+          fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(aField))).append("'");
+
+          //              fv.append(aField).append("='").append(StringUtil.quote((String)theEntity.getValue(aField))).append("'");
+        }
+      }
+    }
+
+    StringBuffer sql =
+      new StringBuffer("update ").append(theTable).append(" set ").append(fv);
+
+    // exceptions
+    if (metadataFields.contains("webdb_lastchange")) {
+      sql.append(",webdb_lastchange=NOW()");
+    }
+
+    // special case: the webdb_create requires the field in yyyy-mm-dd HH:mm
+    // format so anything extra will be ignored. -mh
+    if (metadataFields.contains("webdb_create") &&
+        theEntity.hasValueForField("webdb_create")) {
+      // minimum of 10 (yyyy-mm-dd)...
+      if (theEntity.getValue("webdb_create").length() >= 10) {
+        String dateString = theEntity.getValue("webdb_create");
+
+        // if only 10, then add 00:00 so it doesn't throw a ParseException
+        if (dateString.length() == 10) {
+          dateString = dateString + " 00:00";
+        }
+
+        // TimeStamp stuff
+        try {
+          java.util.Date d = _dateFormatterIn.parse(dateString);
+          Timestamp tStamp = new Timestamp(d.getTime());
+          sql.append(",webdb_create='" + tStamp.toString() + "'");
+        } catch (ParseException e) {
+          throw new StorageObjectFailure(e);
+        }
+      }
+    }
+
+    if (streamedInput != null) {
+      for (int i = 0; i < streamedInput.size(); i++) {
+        sql.append(",").append(streamedInput.get(i)).append("=?");
+      }
+    }
+
+    sql.append(" where id=").append(id);
+
+    //theLog.printInfo("UPDATE: " + sql);
+    // execute sql
+    try {
+      con = getPooledCon();
+      con.setAutoCommit(false);
+      pstmt = con.prepareStatement(sql.toString());
+
+      if (streamedInput != null) {
+        for (int i = 0; i < streamedInput.size(); i++) {
+          String inputString =
+            theEntity.getValue((String) streamedInput.get(i));
+          pstmt.setBytes(i + 1, inputString.getBytes());
+        }
+      }
+
+      pstmt.executeUpdate();
+    } catch (SQLException sqe) {
+      throwSQLException(sqe, "update");
+    } finally {
+      try {
+        con.setAutoCommit(true);
+      } catch (Exception e) {
+        ;
+      }
+
+      freeConnection(con, pstmt);
+    }
+  }
+
+  /*
+  *   delete-Operator
+  *   @param id des zu loeschenden Datensatzes
+  *   @return boolean liefert true zurueck, wenn loeschen erfolgreich war.
+   */
+  public boolean delete(String id) throws StorageObjectFailure {
+    invalidatePopupCache();
+
+    // ostore send notification
+    if (StoreUtil.implementsStorableObject(theEntityClass)) {
+      String uniqueId = id;
+
+      if (theEntityClass.equals(StorableObjectEntity.class)) {
+        uniqueId += ("@" + theTable);
+      }
+
+      logger.debug("CACHE: (del) " + id);
+
+      StoreIdentifier search_sid =
+        new StoreIdentifier(theEntityClass,
+          StoreContainerType.STOC_TYPE_ENTITY, uniqueId);
+      o_store.invalidate(search_sid);
+    }
+
+    /** @todo could be prepared Statement */
+    Statement stmt = null;
+    Connection con = null;
+    int res = 0;
+    String sql =
+      "delete from " + theTable + " where " + thePKeyName + "='" + id + "'";
+
+    //theLog.printInfo("DELETE " + sql);
+    try {
+      con = getPooledCon();
+      stmt = con.createStatement();
+      res = stmt.executeUpdate(sql);
+    } catch (SQLException sqe) {
+      throwSQLException(sqe, "delete");
+    } finally {
+      freeConnection(con, stmt);
+    }
+
+    return (res > 0) ? true : false;
+  }
+
+  /* noch nicht implementiert.
+  * @return immer false
+   */
+  public boolean delete(EntityList theEntityList) {
+    invalidatePopupCache();
+
+    return false;
+  }
+
+  /**
+   * Diese Methode sollte ueberschrieben werden, wenn fuer die abgeleitete Database-Klasse
+   * eine SimpleList mit Standard-Popupdaten erzeugt werden koennen soll.
+   * @return null
+   */
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return null;
+  }
+
+  /**
+   *  Holt Daten fuer Popups.
+   *  @param name  Name des Feldes.
+   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.
+   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
+   */
+  public SimpleList getPopupData(String name, boolean hasNullValue)
+    throws StorageObjectFailure {
+    return getPopupData(name, hasNullValue, null);
+  }
+
+  /**
+   *  Holt Daten fuer Popups.
+   *  @param name  Name des Feldes.
+   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.
+   *  @param where  Schraenkt die Selektion der Datensaetze ein.
+   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
+   */
+  public SimpleList getPopupData(String name, boolean hasNullValue, String where)
+    throws StorageObjectFailure {
+    return getPopupData(name, hasNullValue, where, null);
+  }
+
+  /**
+   *  Holt Daten fuer Popups.
+   *  @param name  Name des Feldes.
+   *  @param hasNullValue  Wenn true wird eine leerer  Eintrag fuer die Popups erzeugt.
+   *  @param where  Schraenkt die Selektion der Datensaetze ein.
+   *  @param order  Gibt ein Feld als Sortierkriterium an.
+   *  @return SimpleList Gibt freemarker.template.SimpleList zurueck.
+   */
+  public SimpleList getPopupData(String name, boolean hasNullValue,
+    String where, String order) throws StorageObjectFailure {
+    // caching
+    if (hasPopupCache && (popupCache != null)) {
+      return popupCache;
+    }
+
+    SimpleList simpleList = null;
+    Connection con = null;
+    Statement stmt = null;
+
+    // build sql
+    StringBuffer sql =
+      new StringBuffer("select ").append(thePKeyName).append(",").append(name)
+                                 .append(" from ").append(theTable);
+
+    if ((where != null) && !(where.length() == 0)) {
+      sql.append(" where ").append(where);
+    }
+
+    sql.append(" order by ");
+
+    if ((order != null) && !(order.length() == 0)) {
+      sql.append(order);
+    } else {
+      sql.append(name);
+    }
+
+    // execute sql
+    try {
+      con = getPooledCon();
+    } catch (Exception e) {
+      throw new StorageObjectFailure(e);
+    }
+
+    try {
+      stmt = con.createStatement();
+
+      ResultSet rs = executeSql(stmt, sql.toString());
+
+      if (rs != null) {
+        if (!evaluatedMetaData) {
+          get_meta_data();
+        }
+
+        simpleList = new SimpleList();
+
+        // if popup has null-selector
+        if (hasNullValue) {
+          simpleList.add(POPUP_EMPTYLINE);
+        }
+
+        SimpleHash popupDict;
+
+        while (rs.next()) {
+          popupDict = new SimpleHash();
+          popupDict.put("key", getValueAsString(rs, 1, thePKeyType));
+          popupDict.put("value", rs.getString(2));
+          simpleList.add(popupDict);
+        }
+
+        rs.close();
+      }
+    }
+    catch (Exception e) {
+      logger.error("getPopupData: " + e.getMessage());
+      throw new StorageObjectFailure(e);
+    } finally {
+      freeConnection(con, stmt);
+    }
+
+    if (hasPopupCache) {
+      popupCache = simpleList;
+    }
+
+    return simpleList;
+  }
+
+  /**
+   * Liefert alle Daten der Tabelle als SimpleHash zurueck. Dies wird verwandt,
+   * wenn in den Templates ein Lookup-Table benoetigt wird. Sollte nur bei kleinen
+   * Tabellen Verwendung finden.
+   * @return SimpleHash mit den Tabellezeilen.
+   */
+  public SimpleHash getHashData() {
+    /** @todo dangerous! this should have a flag to be enabled, otherwise
+     *  very big Hashes could be returned */
+    if (hashCache == null) {
+      try {
+        hashCache =
+          HTMLTemplateProcessor.makeSimpleHash(selectByWhereClause("", -1));
+      }
+      catch (StorageObjectFailure e) {
+        logger.debug(e.getMessage());
+      }
+    }
+
+    return hashCache;
+  }
+
+  /* invalidates the popupCache
+   */
+  protected void invalidatePopupCache() {
+    /** @todo  invalidates toooo much */
+    popupCache = null;
+    hashCache = null;
+  }
+
+  /**
+   * Diese Methode fuehrt den Sqlstring <i>sql</i> aus und timed im Logfile.
+   * @param stmt Statemnt
+   * @param sql Sql-String
+   * @return ResultSet
+   * @exception StorageObjectException
+   */
+  public ResultSet executeSql(Statement stmt, String sql)
+                            throws StorageObjectFailure, SQLException {
+    ResultSet rs;
+    long startTime = System.currentTimeMillis();
+
+    try {
+      rs = stmt.executeQuery(sql);
+
+      logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+    }
+    catch (SQLException e) {
+      logger.error(e.getMessage() +"\n" + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+      throw e;
+    }
+
+    return rs;
+  }
+
+  /**
+   * returns the number of rows in the table
+   */
+  public int getSize(String where) throws SQLException, StorageObjectFailure {
+    long startTime = System.currentTimeMillis();
+    String sql = "SELECT Count(*) FROM " + theTable;
+
+    if ((where != null) && !(where.length() == 0)) {
+      sql = sql + " where " + where;
+    }
+
+    Connection con = null;
+    Statement stmt = null;
+    int result = 0;
+
+    try {
+      con = getPooledCon();
+      stmt = con.createStatement();
+
+      ResultSet rs = executeSql(stmt, sql);
+
+      while (rs.next()) {
+        result = rs.getInt(1);
+      }
+    }
+    catch (SQLException e) {
+      logger.error("Database.getSize: " + e.getMessage());
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+
+    //theLog.printInfo(theTable + " has "+ result +" rows where " + where);
+    logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+
+    return result;
+  }
+
+  public int executeUpdate(Statement stmt, String sql)
+    throws StorageObjectFailure, SQLException {
+    int rs;
+    long startTime = System.currentTimeMillis();
+
+    try {
+      rs = stmt.executeUpdate(sql);
+
+      logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+    }
+    catch (SQLException e) {
+      logger.debug("Failed: " + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+      throw e;
+    }
+
+    return rs;
+  }
+
+  public int executeUpdate(String sql)
+    throws StorageObjectFailure, SQLException {
+    int result = -1;
+    long startTime = System.currentTimeMillis();
+    Connection con = null;
+    PreparedStatement pstmt = null;
+
+    try {
+      con = getPooledCon();
+      pstmt = con.prepareStatement(sql);
+      result = pstmt.executeUpdate();
+    }
+    catch (Throwable e) {
+      logger.error("Database.executeUpdate(" + sql + "): " + e.getMessage());
+      throw new StorageObjectFailure("Database.executeUpdate(" + sql + "): " + e.getMessage(), e);
+    }
+    finally {
+      freeConnection(con, pstmt);
+    }
+
+    logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+    return result;
+  }
+
+  /**
+   * Wertet ResultSetMetaData aus und setzt interne Daten entsprechend
+   * @param md ResultSetMetaData
+   * @exception StorageObjectException
+   */
+  private void evalMetaData(ResultSetMetaData md) throws StorageObjectFailure {
+    this.evaluatedMetaData = true;
+    this.metadataFields = new ArrayList();
+    this.metadataLabels = new ArrayList();
+    this.metadataNotNullFields = new ArrayList();
+
+    try {
+      int numFields = md.getColumnCount();
+      this.metadataTypes = new int[numFields];
+
+      String aField;
+      int aType;
+
+      for (int i = 1; i <= numFields; i++) {
+        aField = md.getColumnName(i);
+        metadataFields.add(aField);
+        metadataLabels.add(md.getColumnLabel(i));
+        aType = md.getColumnType(i);
+        metadataTypes[i - 1] = aType;
+
+        if (aField.equals(thePKeyName)) {
+          thePKeyType = aType;
+          thePKeyIndex = i;
+        }
+
+        if (md.isNullable(i) == ResultSetMetaData.columnNullable) {
+          metadataNotNullFields.add(aField);
+        }
+      }
+    }
+    catch (SQLException e) {
+      throwSQLException(e, "evalMetaData");
+    }
+  }
+
+  /**
+   *  Wertet die Metadaten eines Resultsets fuer eine Tabelle aus,
+   *  um die alle Columns und Typen einer Tabelle zu ermitteln.
+   */
+  private void get_meta_data() throws StorageObjectFailure {
+    Connection con = null;
+    PreparedStatement pstmt = null;
+    String sql = "select * from " + theTable + " where 0=1";
+
+    try {
+      con = getPooledCon();
+      pstmt = con.prepareStatement(sql);
+
+      logger.debug("METADATA: " + sql);
+      ResultSet rs = pstmt.executeQuery();
+      evalMetaData(rs.getMetaData());
+      rs.close();
+    }
+    catch (SQLException e) {
+      throwSQLException(e, "get_meta_data");
+    }
+    finally {
+      freeConnection(con, pstmt);
+    }
+  }
+
+  public Connection getPooledCon() throws StorageObjectFailure {
+    Connection con = null;
+
+    try {
+      con = SQLManager.getInstance().requestConnection();
+    }
+    catch (SQLException e) {
+      logger.error("could not connect to the database " + e.getMessage());
+
+      throw new StorageObjectFailure("Could not connect to the database", e);
+    }
+
+    return con;
+  }
+
+  public void freeConnection(Connection con, Statement stmt)
+    throws StorageObjectFailure {
+    SQLManager.closeStatement(stmt);
+    SQLManager.getInstance().returnConnection(con);
+  }
+
+  /**
+   * Wertet SQLException aus und wirft dannach eine StorageObjectException
+   * @param sqe SQLException
+   * @param wo Funktonsname, in der die SQLException geworfen wurde
+   * @exception StorageObjectException
+   */
+  protected void throwSQLException(SQLException sqe, String aFunction)
+    throws StorageObjectFailure {
+    String state = "";
+    String message = "";
+    int vendor = 0;
+
+    if (sqe != null) {
+      state = sqe.getSQLState();
+      message = sqe.getMessage();
+      vendor = sqe.getErrorCode();
+    }
+
+    String information =
+        "SQL Error: " +
+        "state= " + state +
+        ", vendor= " + vendor +
+        ", message=" + message +
+        ", function= " + aFunction;
+
+    logger.error(information);
+
+    throw new StorageObjectFailure(information, sqe);
+  }
+
+  protected void _throwStorageObjectException(Exception e, String aFunction)
+    throws StorageObjectFailure {
+
+    if (e != null) {
+      logger.error(e.getMessage() + aFunction);
+      throw new StorageObjectFailure(aFunction, e);
+    }
+  }
+
+  /**
+   * Loggt Fehlermeldung mit dem Parameter Message und wirft dannach
+   * eine StorageObjectException
+   * @param message Nachricht mit dem Fehler
+   * @exception StorageObjectException
+   */
+  void throwStorageObjectException(String aMessage) throws StorageObjectFailure {
+    logger.error(aMessage);
+    throw new StorageObjectFailure(aMessage, null);
+  }
+}
index de9803a..c23f786 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.storage.store;\r
-\r
-/**\r
- * Title:         ObjectStore for StorableObjects\r
- * Description:   ObjectStore holds a Map of @see StoreContainer for all possible\r
- *                @see StoreIdentifier.\r
- *\r
- *                @see StorageIdentifier - identitfies one object in the ObjectStore\r
- *                      i.e. in its apropriate bucket. It holds a unique identifier\r
- *                      of a StorableObject and a reference on the StorableObject.\r
- *\r
- *                @see StoreContainer - "Buckets" to store different types of Objects\r
- *                      in one Container. These buckets are cofigurable via\r
- *                      config.properties.\r
- *\r
- *                @see StoreContainerType - is a signature for all StoreContainer\r
- *                      and StoreIdentifier.\r
- *\r
- *                @see StorableObjects - Interface Object have to implement to\r
- *                      be handled by the ObjectStore\r
- *\r
- *                @see ServletStoreInfo - Maintenance Servlet for ObjectStore.\r
- *                      Displays information about current content of the\r
- *                      ObjectStore.\r
- *\r
- *\r
- * Copyright:     Copyright (c) 2002\r
- * Company:       indy\r
- * @author        rk\r
- * @version 1.0\r
- */\r
-\r
-import java.io.BufferedInputStream;\r
-import java.io.FileInputStream;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-import java.util.MissingResourceException;\r
-import java.util.Properties;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.log.LoggerWrapper;\r
-\r
-public class ObjectStore {\r
-\r
-  private final static ObjectStore INSTANCE = new ObjectStore();\r
-  private final static Map containerMap = new HashMap(); // StoreContainerType/StoreContainer\r
-  private static long storeHit = 0, storeMiss = 0;\r
-  private Properties ostoreConf;\r
-  private LoggerWrapper logger;\r
-\r
-  private ObjectStore() {\r
-    String confName = null;\r
-\r
-    logger = new LoggerWrapper("Database.ObjectStore");\r
-    Properties conf = new Properties();\r
-\r
-    try {\r
-      confName =\r
-          MirPropertiesConfiguration.instance().getString("Home") +\r
-          "etc/objectstore.properties";\r
-      conf.load(new BufferedInputStream(new FileInputStream(confName)));\r
-    }\r
-    catch (java.io.FileNotFoundException fnfe) {\r
-      logger.error("could not read config file. not found: " + confName);\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("could not get config: " + t.getMessage());\r
-    }\r
-    ostoreConf = conf;\r
-  }\r
-\r
-  public static ObjectStore getInstance() {\r
-    return INSTANCE;\r
-  }\r
-\r
-  /**\r
-   *  Method:       use\r
-   *  Description:  The ObjectStore tries to find the @see StoreIdentifier sid\r
-   *                and returns the stored Object.\r
-   *\r
-   *  @return       StorableObject is null when no StorableObject for the\r
-   *                StoreIdentifier sid is found.\r
-   */\r
-  public StorableObject use(StoreIdentifier sid) {\r
-    if (sid != null) {\r
-      StorableObject storeObject = null;\r
-      StoreContainer stoc = getStoreContainerForSid(sid);\r
-      if (stoc != null)\r
-        storeObject = stoc.use(sid);\r
-      else\r
-        logger.warn("container not found for: " + sid.toString());\r
-      if (storeObject != null) {\r
-        storeHit++;\r
-        return storeObject;\r
-      }\r
-    }\r
-    storeMiss++;\r
-    return null;\r
-\r
-  }\r
-\r
-  /**\r
-   *  Method:       add\r
-   *  Description:  A StoreIdentifier is added to the ObjectStore, if it\r
-   *                contains a reference to a @see StorableObject.\r
-   */\r
-  public void add(StoreIdentifier sid) {\r
-    if (sid != null && sid.hasReference()) {\r
-      // find the right StoreContainer for sid\r
-      StoreContainer stoc = getStoreContainerForSid(sid);\r
-      if (stoc == null) {\r
-        // we have to make new StoreContainer\r
-        StoreContainerType stocType = sid.getStoreContainerType();\r
-        stoc = new StoreContainer(stocType);\r
-        containerMap.put(stocType, stoc);\r
-      }\r
-      stoc.add(sid);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method:       invalidate(StorableObject sto)\r
-   *  Description:  ObjectStore is notified of change of a @see StorableObject\r
-   *                sto and invalidates all relevant cache entries.\r
-   */\r
-\r
-  public void invalidate(StoreIdentifier sid) {\r
-    // propagate invalidation to StoreContainer\r
-    if (sid != null) {\r
-      StoreContainer stoc = getStoreContainerForSid(sid);\r
-      stoc.invalidate(sid);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method:       invalidate(StoreContainerType)\r
-   *  Description:  serves to invalidate a whole StoreContainer\r
-   *\r
-   *  @return\r
-   */\r
-  public void invalidate(StoreContainerType stoc_type) {\r
-    if (stoc_type != null) {\r
-      /** @todo invalidates too much:\r
-       *  improvement: if instanceof StoreContainerEntity && EntityList\r
-       *  then invalidate only StoreIdentifier matching the right table\r
-       */\r
-      StoreContainer stoc = getStoreContainerForStocType(stoc_type);\r
-      if (stoc != null)\r
-        stoc.invalidate();\r
-    }\r
-\r
-  }\r
-\r
-  // internal methods for StoreContainer managment\r
-\r
-  /**\r
-   *  Method:       getStoreContainerForSid\r
-   *  Description:  private method to find the right @see StoreContainer for\r
-   *                the @see StoreIdentifier sid.\r
-   *\r
-   *  @return       StoreContainer is null when no Container is found.\r
-   */\r
-  private StoreContainer getStoreContainerForSid(StoreIdentifier sid) {\r
-    // find apropriate container for a specific sid\r
-    if (sid != null) {\r
-      StoreContainerType stoc_type = sid.getStoreContainerType();\r
-      return getStoreContainerForStocType(stoc_type);\r
-    }\r
-    return null;\r
-  }\r
-\r
-  private StoreContainer getStoreContainerForStocType(StoreContainerType\r
-      stoc_type) {\r
-    if (stoc_type != null && containerMap.containsKey(stoc_type))\r
-      return (StoreContainer) containerMap.get(stoc_type);\r
-    return null;\r
-  }\r
-\r
-  private boolean has(StoreIdentifier sid) {\r
-    StoreContainer stoc = getStoreContainerForSid(sid);\r
-    return (stoc != null && stoc.has(sid)) ? true : false;\r
-  }\r
-\r
-  public String getConfProperty(String name) {\r
-    if (name != null) {\r
-      String returnValue = "";\r
-      try {\r
-        return ostoreConf.getProperty(name);\r
-      }\r
-      catch (MissingResourceException e) {\r
-        logger.error("getConfProperty: " + e.toString());\r
-      }\r
-    }\r
-    return null;\r
-  }\r
-\r
-  /**\r
-   *  Method:       toString()\r
-   *  Description:  Displays statistical information about the ObjectStore.\r
-       *                Further information is gathered from all @see StoreContainer\r
-   *\r
-   *  @return       String\r
-   */\r
-  public String toString() {\r
-    return toHtml(null);\r
-  }\r
-\r
-  public String toHtml(HttpServletRequest req) {\r
-    float hitRatio = 0;\r
-    long divisor = storeHit + storeMiss;\r
-    if (divisor > 0)\r
-      hitRatio = (float) storeHit / (float) divisor;\r
-    hitRatio *= 100;\r
-\r
-    StringBuffer sb = new StringBuffer("Mir-ObjectStore ");\r
-    sb.append( ( (req != null) ? html_version() : version())).append("\n");\r
-    sb.append("ObjectStore overall hits/misses/ratio: ").append(storeHit);\r
-    sb.append("/").append(storeMiss).append("/").append(hitRatio);\r
-    sb.append("%\nCurrently ").append(containerMap.size());\r
-    sb.append(" StoreContainer in use - listing information:\n");\r
-\r
-    // ask container for information\r
-    StoreContainer currentStoc;\r
-    for (Iterator it = containerMap.keySet().iterator(); it.hasNext(); ) {\r
-      currentStoc = (StoreContainer) containerMap.get(it.next());\r
-      sb.append(currentStoc.toHtml(req));\r
-    }\r
-\r
-    return sb.toString();\r
-  }\r
-\r
-  /**\r
-   *  Method:       html_version()\r
-       *  Description:  returns ObjectStore version as String for HTML representation\r
-   *\r
-   *  @return       String\r
-   */\r
-  private String html_version() {\r
-    return "<i>" + version() + "</i>";\r
-  }\r
-\r
-  /**\r
-   *  Method:       version()\r
-   *  Description:  returns ObjectStore version as String\r
-   *\r
-   *  @return       String\r
-   */\r
-  private String version() {\r
-    return "v_sstart3__1.0";\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.storage.store;
+
+/**
+ * Title:         ObjectStore for StorableObjects
+ * Description:   ObjectStore holds a Map of @see StoreContainer for all possible
+ *                @see StoreIdentifier.
+ *
+ *                @see StorageIdentifier - identitfies one object in the ObjectStore
+ *                      i.e. in its apropriate bucket. It holds a unique identifier
+ *                      of a StorableObject and a reference on the StorableObject.
+ *
+ *                @see StoreContainer - "Buckets" to store different types of Objects
+ *                      in one Container. These buckets are cofigurable via
+ *                      config.properties.
+ *
+ *                @see StoreContainerType - is a signature for all StoreContainer
+ *                      and StoreIdentifier.
+ *
+ *                @see StorableObjects - Interface Object have to implement to
+ *                      be handled by the ObjectStore
+ *
+ *                @see ServletStoreInfo - Maintenance Servlet for ObjectStore.
+ *                      Displays information about current content of the
+ *                      ObjectStore.
+ *
+ *
+ * Copyright:     Copyright (c) 2002
+ * Company:       indy
+ * @author        rk
+ * @version 1.0
+ */
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+
+import javax.servlet.http.HttpServletRequest;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.log.LoggerWrapper;
+
+public class ObjectStore {
+
+  private final static ObjectStore INSTANCE = new ObjectStore();
+  private final static Map containerMap = new HashMap(); // StoreContainerType/StoreContainer
+  private static long storeHit = 0, storeMiss = 0;
+  private Properties ostoreConf;
+  private LoggerWrapper logger;
+
+  private ObjectStore() {
+    String confName = null;
+
+    logger = new LoggerWrapper("Database.ObjectStore");
+    Properties conf = new Properties();
+
+    try {
+      confName =
+          MirPropertiesConfiguration.instance().getString("Home") +
+          "etc/objectstore.properties";
+      conf.load(new BufferedInputStream(new FileInputStream(confName)));
+    }
+    catch (java.io.FileNotFoundException fnfe) {
+      logger.error("could not read config file. not found: " + confName);
+    }
+    catch (Throwable t) {
+      logger.error("could not get config: " + t.getMessage());
+    }
+    ostoreConf = conf;
+  }
+
+  public static ObjectStore getInstance() {
+    return INSTANCE;
+  }
+
+  /**
+   *  Method:       use
+   *  Description:  The ObjectStore tries to find the @see StoreIdentifier sid
+   *                and returns the stored Object.
+   *
+   *  @return       StorableObject is null when no StorableObject for the
+   *                StoreIdentifier sid is found.
+   */
+  public StorableObject use(StoreIdentifier sid) {
+    if (sid != null) {
+      StorableObject storeObject = null;
+      StoreContainer stoc = getStoreContainerForSid(sid);
+      if (stoc != null)
+        storeObject = stoc.use(sid);
+      else
+        logger.warn("container not found for: " + sid.toString());
+      if (storeObject != null) {
+        storeHit++;
+        return storeObject;
+      }
+    }
+    storeMiss++;
+    return null;
+
+  }
+
+  /**
+   *  Method:       add
+   *  Description:  A StoreIdentifier is added to the ObjectStore, if it
+   *                contains a reference to a @see StorableObject.
+   */
+  public void add(StoreIdentifier sid) {
+    if (sid != null && sid.hasReference()) {
+      // find the right StoreContainer for sid
+      StoreContainer stoc = getStoreContainerForSid(sid);
+      if (stoc == null) {
+        // we have to make new StoreContainer
+        StoreContainerType stocType = sid.getStoreContainerType();
+        stoc = new StoreContainer(stocType);
+        containerMap.put(stocType, stoc);
+      }
+      stoc.add(sid);
+    }
+  }
+
+  /**
+   *  Method:       invalidate(StorableObject sto)
+   *  Description:  ObjectStore is notified of change of a @see StorableObject
+   *                sto and invalidates all relevant cache entries.
+   */
+
+  public void invalidate(StoreIdentifier sid) {
+    // propagate invalidation to StoreContainer
+    if (sid != null) {
+      StoreContainer stoc = getStoreContainerForSid(sid);
+      stoc.invalidate(sid);
+    }
+  }
+
+  /**
+   *  Method:       invalidate(StoreContainerType)
+   *  Description:  serves to invalidate a whole StoreContainer
+   *
+   *  @return
+   */
+  public void invalidate(StoreContainerType stoc_type) {
+    if (stoc_type != null) {
+      /** @todo invalidates too much:
+       *  improvement: if instanceof StoreContainerEntity && EntityList
+       *  then invalidate only StoreIdentifier matching the right table
+       */
+      StoreContainer stoc = getStoreContainerForStocType(stoc_type);
+      if (stoc != null)
+        stoc.invalidate();
+    }
+
+  }
+
+  // internal methods for StoreContainer managment
+
+  /**
+   *  Method:       getStoreContainerForSid
+   *  Description:  private method to find the right @see StoreContainer for
+   *                the @see StoreIdentifier sid.
+   *
+   *  @return       StoreContainer is null when no Container is found.
+   */
+  private StoreContainer getStoreContainerForSid(StoreIdentifier sid) {
+    // find apropriate container for a specific sid
+    if (sid != null) {
+      StoreContainerType stoc_type = sid.getStoreContainerType();
+      return getStoreContainerForStocType(stoc_type);
+    }
+    return null;
+  }
+
+  private StoreContainer getStoreContainerForStocType(StoreContainerType
+      stoc_type) {
+    if (stoc_type != null && containerMap.containsKey(stoc_type))
+      return (StoreContainer) containerMap.get(stoc_type);
+    return null;
+  }
+
+  private boolean has(StoreIdentifier sid) {
+    StoreContainer stoc = getStoreContainerForSid(sid);
+    return (stoc != null && stoc.has(sid)) ? true : false;
+  }
+
+  public String getConfProperty(String name) {
+    if (name != null) {
+      String returnValue = "";
+      try {
+        return ostoreConf.getProperty(name);
+      }
+      catch (MissingResourceException e) {
+        logger.error("getConfProperty: " + e.toString());
+      }
+    }
+    return null;
+  }
+
+  /**
+   *  Method:       toString()
+   *  Description:  Displays statistical information about the ObjectStore.
+       *                Further information is gathered from all @see StoreContainer
+   *
+   *  @return       String
+   */
+  public String toString() {
+    return toHtml(null);
+  }
+
+  public String toHtml(HttpServletRequest req) {
+    float hitRatio = 0;
+    long divisor = storeHit + storeMiss;
+    if (divisor > 0)
+      hitRatio = (float) storeHit / (float) divisor;
+    hitRatio *= 100;
+
+    StringBuffer sb = new StringBuffer("Mir-ObjectStore ");
+    sb.append( ( (req != null) ? html_version() : version())).append("\n");
+    sb.append("ObjectStore overall hits/misses/ratio: ").append(storeHit);
+    sb.append("/").append(storeMiss).append("/").append(hitRatio);
+    sb.append("%\nCurrently ").append(containerMap.size());
+    sb.append(" StoreContainer in use - listing information:\n");
+
+    // ask container for information
+    StoreContainer currentStoc;
+    for (Iterator it = containerMap.keySet().iterator(); it.hasNext(); ) {
+      currentStoc = (StoreContainer) containerMap.get(it.next());
+      sb.append(currentStoc.toHtml(req));
+    }
+
+    return sb.toString();
+  }
+
+  /**
+   *  Method:       html_version()
+       *  Description:  returns ObjectStore version as String for HTML representation
+   *
+   *  @return       String
+   */
+  private String html_version() {
+    return "<i>" + version() + "</i>";
+  }
+
+  /**
+   *  Method:       version()
+   *  Description:  returns ObjectStore version as String
+   *
+   *  @return       String
+   */
+  private String version() {
+    return "v_sstart3__1.0";
+  }
+
 }
\ No newline at end of file
index dde90a6..d4df0a2 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.storage.store;\r
-\r
-/**\r
- * Title:         StoreContainerType\r
- *\r
- * Description:   StoreContainerTypes are uniqe Objects and are generated\r
- *                via @see valueOf(Class stocClass, int stocType).\r
- *                For every combination of stocClass and stocType there is\r
- *                only one Object instantiated.\r
- *\r
- * Copyright:     Copyright (c) 2002\r
- * Company:       indy\r
- *\r
- * @author        rk\r
- * @version 1.0\r
- */\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import mir.misc.StringUtil;\r
-\r
-public class StoreContainerType {\r
-\r
-  public final static int STOC_TYPE_UNKNOWN = -1;\r
-  public final static int STOC_TYPE_ENTITY = 0;\r
-  public final static int STOC_TYPE_ENTITYLIST = 1;\r
-  public final static int STOC_TYPE_MAX = STOC_TYPE_ENTITYLIST;\r
-\r
-  private static Map[] uniqueTypes = new HashMap[STOC_TYPE_MAX + 1];\r
-  private static ObjectStore o_store = ObjectStore.getInstance();\r
-  private Class stocClass = null;\r
-  private int stocType = STOC_TYPE_UNKNOWN;\r
-\r
-  static {\r
-    uniqueTypes[STOC_TYPE_ENTITY] = new HashMap();\r
-    uniqueTypes[STOC_TYPE_ENTITYLIST] = new HashMap();\r
-  }\r
-\r
-  private StoreContainerType() {}\r
-\r
-  private StoreContainerType(Class stocClass, int stocType) {\r
-    this.stocClass = stocClass;\r
-    this.stocType = stocType;\r
-  }\r
-\r
-  public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {\r
-    StoreContainerType returnStocType = null;\r
-    if (stoc_type >= 0 && stoc_type <= STOC_TYPE_MAX) {\r
-      Map current = uniqueTypes[stoc_type];\r
-      if (current.containsKey(stoc_class))\r
-        returnStocType = (StoreContainerType) current.get(stoc_class);\r
-      else {\r
-        returnStocType = new StoreContainerType(stoc_class, stoc_type);\r
-        current.put(stoc_class, returnStocType);\r
-      }\r
-    }\r
-    return returnStocType;\r
-  }\r
-\r
-  public int getStocType() {\r
-    return stocType;\r
-  }\r
-\r
-  public Class getStocClass() {\r
-    return stocClass;\r
-  }\r
-\r
-  public String getConfPrefix() {\r
-    return StoreUtil.getPropNameFor(stocClass) + "." +\r
-        stringForStoreType(stocType);\r
-  }\r
-\r
-  public int getDefaultSize() {\r
-    String confProperty = "StoreContainer." + stringForStoreType(stocType) +\r
-        ".DefaultSize";\r
-    return\r
-        StringUtil.parseInt(o_store.getConfProperty(confProperty), 10);\r
-  }\r
-\r
-  public String toString() {\r
-    StringBuffer sb = new StringBuffer(this.stocClass.toString());\r
-    sb.append("@").append(stringForStoreType(stocType));\r
-    return sb.toString();\r
-  }\r
-\r
-  private static String stringForStoreType(int stocType) {\r
-    switch (stocType) {\r
-      case STOC_TYPE_ENTITY:\r
-        return "Entity";\r
-      case STOC_TYPE_ENTITYLIST:\r
-        return "EntityList";\r
-      default:\r
-        return "UNKNOWN";\r
-    }\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.storage.store;
+
+/**
+ * Title:         StoreContainerType
+ *
+ * Description:   StoreContainerTypes are uniqe Objects and are generated
+ *                via @see valueOf(Class stocClass, int stocType).
+ *                For every combination of stocClass and stocType there is
+ *                only one Object instantiated.
+ *
+ * Copyright:     Copyright (c) 2002
+ * Company:       indy
+ *
+ * @author        rk
+ * @version 1.0
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import mir.misc.StringUtil;
+
+public class StoreContainerType {
+
+  public final static int STOC_TYPE_UNKNOWN = -1;
+  public final static int STOC_TYPE_ENTITY = 0;
+  public final static int STOC_TYPE_ENTITYLIST = 1;
+  public final static int STOC_TYPE_MAX = STOC_TYPE_ENTITYLIST;
+
+  private static Map[] uniqueTypes = new HashMap[STOC_TYPE_MAX + 1];
+  private static ObjectStore o_store = ObjectStore.getInstance();
+  private Class stocClass = null;
+  private int stocType = STOC_TYPE_UNKNOWN;
+
+  static {
+    uniqueTypes[STOC_TYPE_ENTITY] = new HashMap();
+    uniqueTypes[STOC_TYPE_ENTITYLIST] = new HashMap();
+  }
+
+  private StoreContainerType() {}
+
+  private StoreContainerType(Class stocClass, int stocType) {
+    this.stocClass = stocClass;
+    this.stocType = stocType;
+  }
+
+  public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {
+    StoreContainerType returnStocType = null;
+    if (stoc_type >= 0 && stoc_type <= STOC_TYPE_MAX) {
+      Map current = uniqueTypes[stoc_type];
+      if (current.containsKey(stoc_class))
+        returnStocType = (StoreContainerType) current.get(stoc_class);
+      else {
+        returnStocType = new StoreContainerType(stoc_class, stoc_type);
+        current.put(stoc_class, returnStocType);
+      }
+    }
+    return returnStocType;
+  }
+
+  public int getStocType() {
+    return stocType;
+  }
+
+  public Class getStocClass() {
+    return stocClass;
+  }
+
+  public String getConfPrefix() {
+    return StoreUtil.getPropNameFor(stocClass) + "." +
+        stringForStoreType(stocType);
+  }
+
+  public int getDefaultSize() {
+    String confProperty = "StoreContainer." + stringForStoreType(stocType) +
+        ".DefaultSize";
+    return
+        StringUtil.parseInt(o_store.getConfProperty(confProperty), 10);
+  }
+
+  public String toString() {
+    StringBuffer sb = new StringBuffer(this.stocClass.toString());
+    sb.append("@").append(stringForStoreType(stocType));
+    return sb.toString();
+  }
+
+  private static String stringForStoreType(int stocType) {
+    switch (stocType) {
+      case STOC_TYPE_ENTITY:
+        return "Entity";
+      case STOC_TYPE_ENTITYLIST:
+        return "EntityList";
+      default:
+        return "UNKNOWN";
+    }
+  }
 }
\ No newline at end of file
index 91949aa..e5fa927 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.storage.store;\r
-\r
-/**\r
- * Title:         Class StoreIdentifier\r
- * Description:   StoreIdentifier has two functions.\r
- *                A) StoreIdenfier holds a reference to a @see StorableObject\r
- *                or B) StoreIdentifier is used too search for a @see StorableObject\r
- *                in the @see StoreContainer that matches its\r
- *\r
- * Copyright:     Copyright (c) 2002\r
- * Company:       indy\r
- * @author        rk\r
- * @version 1.0\r
- */\r
-import java.util.Iterator;\r
-import java.util.Set;\r
-\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-\r
-public class StoreIdentifier {\r
-\r
-  /** @todo check if invalidating already to avoid deadlocks\r
-   *  what about concurrency? */\r
-\r
-  private static ObjectStore o_store = ObjectStore.getInstance();\r
-\r
-  private StoreContainerType stocType = null;\r
-  private StorableObject reference = null;\r
-  private String uniqueIdentifier = null; // id for Entity & sql for EntityList\r
-  private long timesUsed;\r
-  private boolean invalidating = false;\r
-\r
-  protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");\r
-\r
-  /** @todo initialize logfile  */\r
-\r
-  private StoreIdentifier() {}\r
-\r
-  public StoreIdentifier(StorableObject reference, int storeType,\r
-                         String uniqueIdentifier) {\r
-    Class theClass;\r
-    if (reference instanceof EntityList)\r
-      theClass = ( (EntityList) reference).getStorage().getEntityClass();\r
-    else\r
-      theClass = reference.getClass();\r
-    this.uniqueIdentifier = uniqueIdentifier;\r
-    this.stocType = StoreContainerType.valueOf(theClass, storeType);\r
-    this.reference = reference;\r
-  }\r
-\r
-  public StoreIdentifier(StorableObject reference, String uniqueIdentifier) {\r
-    this(reference, StoreContainerType.STOC_TYPE_ENTITY, uniqueIdentifier);\r
-  }\r
-\r
-  public StoreIdentifier(Class theClass, String uniqueIdentifier) {\r
-    this(theClass, StoreContainerType.STOC_TYPE_ENTITY, uniqueIdentifier);\r
-  }\r
-\r
-  public StoreIdentifier(Class theClass, int storeType, String uniqueIdentifier) {\r
-    this.uniqueIdentifier = uniqueIdentifier;\r
-    this.stocType = StoreContainerType.valueOf(theClass, storeType);\r
-  }\r
-\r
-  /**\r
-   *  Method:       ivalidate\r
-   *  Description:\r
-   *\r
-   *  @return\r
-   */\r
-  public void invalidate() {\r
-    logger.info("Invalidating: " + toString());\r
-    // avoid deadlock due to propagation.\r
-    if (!invalidating) {\r
-      invalidating = true;\r
-      if (stocType != null &&\r
-          stocType.getStocType() == StoreContainerType.STOC_TYPE_ENTITY) {\r
-        logger.info("Propagating invalidation to EntityList for " + toString());\r
-        // we should invalidate related ENTITY_LIST\r
-        StoreContainerType entityListStocType =\r
-            StoreContainerType.valueOf(stocType.getStocClass(),\r
-                                       StoreContainerType.STOC_TYPE_ENTITYLIST);\r
-        o_store.invalidate(entityListStocType);\r
-      }\r
-\r
-      // propagate invalidation to Set\r
-      Set set = reference.getNotifyOnReleaseSet();\r
-      if (set != null) {\r
-        for (Iterator it = set.iterator(); it.hasNext(); ) {\r
-          Object o = it.next();\r
-          if (o instanceof StoreIdentifier) {\r
-            logger.info("Propagating invalidation to StoreIdentifier: " + o.toString());\r
-            // propagate invalidation to a specific StoreIdentifier in cache\r
-            o_store.invalidate( (StoreIdentifier) o);\r
-          }\r
-          else if (o instanceof StoreContainerType) {\r
-            logger.info("Propagating invalidation to StoreContainer: " + o.toString());\r
-            // propagate invalidation to a whole StoreContainer\r
-            o_store.invalidate( (StoreContainerType) o);\r
-          }\r
-\r
-        }\r
-      }\r
-      release();\r
-    }\r
-  }\r
-\r
-  public void release() {\r
-    this.reference = null;\r
-    this.uniqueIdentifier = null;\r
-    this.stocType = null;\r
-  }\r
-\r
-  public StorableObject use() {\r
-    timesUsed++;\r
-    return reference;\r
-  }\r
-\r
-  /**\r
-   *  Method equals for comparison between two identifier\r
-   *\r
-   *  @return true if yes otherwise false\r
-   *\r
-   */\r
-  public boolean equals(Object sid) {\r
-    if (! (sid instanceof StoreIdentifier))\r
-      return false;\r
-    if ( ( (StoreIdentifier) sid).getStoreContainerType() == stocType &&\r
-        ( (StoreIdentifier) sid).getUniqueIdentifier().equals(uniqueIdentifier)) {\r
-      return true;\r
-    }\r
-    return false;\r
-  }\r
-\r
-  public StoreContainerType getStoreContainerType() {\r
-    return stocType;\r
-  }\r
-\r
-  public String getUniqueIdentifier() {\r
-    return uniqueIdentifier;\r
-  }\r
-\r
-  public boolean hasReference() {\r
-    return (reference == null) ? false : true;\r
-  }\r
-\r
-  public String toString() {\r
-    StringBuffer id = new StringBuffer(uniqueIdentifier);\r
-    id.append("@storetype: ").append(stocType.toString());\r
-    if (reference != null)\r
-      id.append(" (" + timesUsed).append(") times used.");\r
-    return id.toString();\r
-  }\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.storage.store;
+
+/**
+ * Title:         Class StoreIdentifier
+ * Description:   StoreIdentifier has two functions.
+ *                A) StoreIdenfier holds a reference to a @see StorableObject
+ *                or B) StoreIdentifier is used too search for a @see StorableObject
+ *                in the @see StoreContainer that matches its
+ *
+ * Copyright:     Copyright (c) 2002
+ * Company:       indy
+ * @author        rk
+ * @version 1.0
+ */
+import java.util.Iterator;
+import java.util.Set;
+
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+
+public class StoreIdentifier {
+
+  /** @todo check if invalidating already to avoid deadlocks
+   *  what about concurrency? */
+
+  private static ObjectStore o_store = ObjectStore.getInstance();
+
+  private StoreContainerType stocType = null;
+  private StorableObject reference = null;
+  private String uniqueIdentifier = null; // id for Entity & sql for EntityList
+  private long timesUsed;
+  private boolean invalidating = false;
+
+  protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");
+
+  /** @todo initialize logfile  */
+
+  private StoreIdentifier() {}
+
+  public StoreIdentifier(StorableObject reference, int storeType,
+                         String uniqueIdentifier) {
+    Class theClass;
+    if (reference instanceof EntityList)
+      theClass = ( (EntityList) reference).getStorage().getEntityClass();
+    else
+      theClass = reference.getClass();
+    this.uniqueIdentifier = uniqueIdentifier;
+    this.stocType = StoreContainerType.valueOf(theClass, storeType);
+    this.reference = reference;
+  }
+
+  public StoreIdentifier(StorableObject reference, String uniqueIdentifier) {
+    this(reference, StoreContainerType.STOC_TYPE_ENTITY, uniqueIdentifier);
+  }
+
+  public StoreIdentifier(Class theClass, String uniqueIdentifier) {
+    this(theClass, StoreContainerType.STOC_TYPE_ENTITY, uniqueIdentifier);
+  }
+
+  public StoreIdentifier(Class theClass, int storeType, String uniqueIdentifier) {
+    this.uniqueIdentifier = uniqueIdentifier;
+    this.stocType = StoreContainerType.valueOf(theClass, storeType);
+  }
+
+  /**
+   *  Method:       ivalidate
+   *  Description:
+   *
+   *  @return
+   */
+  public void invalidate() {
+    logger.info("Invalidating: " + toString());
+    // avoid deadlock due to propagation.
+    if (!invalidating) {
+      invalidating = true;
+      if (stocType != null &&
+          stocType.getStocType() == StoreContainerType.STOC_TYPE_ENTITY) {
+        logger.info("Propagating invalidation to EntityList for " + toString());
+        // we should invalidate related ENTITY_LIST
+        StoreContainerType entityListStocType =
+            StoreContainerType.valueOf(stocType.getStocClass(),
+                                       StoreContainerType.STOC_TYPE_ENTITYLIST);
+        o_store.invalidate(entityListStocType);
+      }
+
+      // propagate invalidation to Set
+      Set set = reference.getNotifyOnReleaseSet();
+      if (set != null) {
+        for (Iterator it = set.iterator(); it.hasNext(); ) {
+          Object o = it.next();
+          if (o instanceof StoreIdentifier) {
+            logger.info("Propagating invalidation to StoreIdentifier: " + o.toString());
+            // propagate invalidation to a specific StoreIdentifier in cache
+            o_store.invalidate( (StoreIdentifier) o);
+          }
+          else if (o instanceof StoreContainerType) {
+            logger.info("Propagating invalidation to StoreContainer: " + o.toString());
+            // propagate invalidation to a whole StoreContainer
+            o_store.invalidate( (StoreContainerType) o);
+          }
+
+        }
+      }
+      release();
+    }
+  }
+
+  public void release() {
+    this.reference = null;
+    this.uniqueIdentifier = null;
+    this.stocType = null;
+  }
+
+  public StorableObject use() {
+    timesUsed++;
+    return reference;
+  }
+
+  /**
+   *  Method equals for comparison between two identifier
+   *
+   *  @return true if yes otherwise false
+   *
+   */
+  public boolean equals(Object sid) {
+    if (! (sid instanceof StoreIdentifier))
+      return false;
+    if ( ( (StoreIdentifier) sid).getStoreContainerType() == stocType &&
+        ( (StoreIdentifier) sid).getUniqueIdentifier().equals(uniqueIdentifier)) {
+      return true;
+    }
+    return false;
+  }
+
+  public StoreContainerType getStoreContainerType() {
+    return stocType;
+  }
+
+  public String getUniqueIdentifier() {
+    return uniqueIdentifier;
+  }
+
+  public boolean hasReference() {
+    return (reference == null) ? false : true;
+  }
+
+  public String toString() {
+    StringBuffer id = new StringBuffer(uniqueIdentifier);
+    id.append("@storetype: ").append(stocType.toString());
+    if (reference != null)
+      id.append(" (" + timesUsed).append(") times used.");
+    return id.toString();
+  }
+
+
 }
\ No newline at end of file
index bdca26a..20d20e5 100755 (executable)
-package mir.util;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.io.FilenameFilter;\r
-\r
-import gnu.regexp.RE;\r
-\r
-public class FileFunctions {\r
-  protected static final int FILE_COPY_BUFFER_SIZE = 65536;\r
-\r
-  private FileFunctions() {\r
-  }\r
-\r
-  public static void copyFile(File aSourceFile, File aDestinationFile) throws IOException {\r
-    FileInputStream inputStream;\r
-    FileOutputStream outputStream;\r
-    int nrBytesRead;\r
-    byte[] buffer = new byte[FILE_COPY_BUFFER_SIZE];\r
-\r
-    inputStream = new FileInputStream(aSourceFile);\r
-    try {\r
-      File directory = new File(aDestinationFile.getParent());\r
-        if (directory!=null && !directory.exists()){\r
-          directory.mkdirs();\r
-      }\r
-      outputStream = new FileOutputStream(aDestinationFile);\r
-      try {\r
-        do {\r
-          nrBytesRead = inputStream.read(buffer);\r
-          if (nrBytesRead>0)\r
-            outputStream.write(buffer, 0, nrBytesRead);\r
-        }\r
-        while (nrBytesRead>=0);\r
-      }\r
-      finally {\r
-        outputStream.close();\r
-      }\r
-    }\r
-    finally {\r
-      inputStream.close();\r
-    }\r
-  }\r
-\r
-  public static void copyDirectory(File aSourceDirectory, File aDestinationDirectory) throws IOException {\r
-    int i;\r
-    File sourceFile;\r
-    File destinationFile;\r
-    File[] files = aSourceDirectory.listFiles();\r
-\r
-    if (!aDestinationDirectory.exists())\r
-      aDestinationDirectory.mkdirs();\r
-\r
-    for (i=0; i<files.length; i++) {\r
-      sourceFile = files[i];\r
-      destinationFile=new File(aDestinationDirectory, sourceFile.getName());\r
-      if (sourceFile.isDirectory()) {\r
-        if (!destinationFile.exists())\r
-          destinationFile.mkdir();\r
-        copyDirectory(sourceFile, destinationFile);\r
-      }\r
-      else {\r
-        copyFile(sourceFile, destinationFile);\r
-      }\r
-    }\r
-  }\r
-\r
-  public static void copy(File aSource, File aDestination) throws IOException {\r
-    if (aSource.isDirectory()) {\r
-      copyDirectory(aSource, aDestination);\r
-    }\r
-    else if (aDestination.isDirectory()) {\r
-      copyFile(aSource, new File(aDestination, aSource.getName()));\r
-    }\r
-    else {\r
-      copyFile(aSource, aDestination);\r
-    }\r
-  }\r
-\r
-  public static class RegExpFileFilter implements FilenameFilter {\r
-    private RE expression;\r
-\r
-    public RegExpFileFilter(String anExpression) {\r
-      try {\r
-        expression = new RE(anExpression);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-\r
-    public boolean accept(File aDir, String aName) {\r
-      return expression.isMatch(aName) && !new File(aDir, aName).isDirectory();\r
-    }\r
-  }\r
-\r
-  public static class DirectoryFilter implements FilenameFilter {\r
-    public DirectoryFilter() {\r
-    }\r
-\r
-    public boolean accept(File aDir, String aName) {\r
-      return new File(aDir, aName).isDirectory();\r
-    }\r
-\r
-  }\r
-\r
+package mir.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.FilenameFilter;
+
+import gnu.regexp.RE;
+
+public class FileFunctions {
+  protected static final int FILE_COPY_BUFFER_SIZE = 65536;
+
+  private FileFunctions() {
+  }
+
+  public static void copyFile(File aSourceFile, File aDestinationFile) throws IOException {
+    FileInputStream inputStream;
+    FileOutputStream outputStream;
+    int nrBytesRead;
+    byte[] buffer = new byte[FILE_COPY_BUFFER_SIZE];
+
+    inputStream = new FileInputStream(aSourceFile);
+    try {
+      File directory = new File(aDestinationFile.getParent());
+        if (directory!=null && !directory.exists()){
+          directory.mkdirs();
+      }
+      outputStream = new FileOutputStream(aDestinationFile);
+      try {
+        do {
+          nrBytesRead = inputStream.read(buffer);
+          if (nrBytesRead>0)
+            outputStream.write(buffer, 0, nrBytesRead);
+        }
+        while (nrBytesRead>=0);
+      }
+      finally {
+        outputStream.close();
+      }
+    }
+    finally {
+      inputStream.close();
+    }
+  }
+
+  public static void copyDirectory(File aSourceDirectory, File aDestinationDirectory) throws IOException {
+    int i;
+    File sourceFile;
+    File destinationFile;
+    File[] files = aSourceDirectory.listFiles();
+
+    if (!aDestinationDirectory.exists())
+      aDestinationDirectory.mkdirs();
+
+    for (i=0; i<files.length; i++) {
+      sourceFile = files[i];
+      destinationFile=new File(aDestinationDirectory, sourceFile.getName());
+      if (sourceFile.isDirectory()) {
+        if (!destinationFile.exists())
+          destinationFile.mkdir();
+        copyDirectory(sourceFile, destinationFile);
+      }
+      else {
+        copyFile(sourceFile, destinationFile);
+      }
+    }
+  }
+
+  public static void copy(File aSource, File aDestination) throws IOException {
+    if (aSource.isDirectory()) {
+      copyDirectory(aSource, aDestination);
+    }
+    else if (aDestination.isDirectory()) {
+      copyFile(aSource, new File(aDestination, aSource.getName()));
+    }
+    else {
+      copyFile(aSource, aDestination);
+    }
+  }
+
+  public static class RegExpFileFilter implements FilenameFilter {
+    private RE expression;
+
+    public RegExpFileFilter(String anExpression) {
+      try {
+        expression = new RE(anExpression);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+
+    public boolean accept(File aDir, String aName) {
+      return expression.isMatch(aName) && !new File(aDir, aName).isDirectory();
+    }
+  }
+
+  public static class DirectoryFilter implements FilenameFilter {
+    public DirectoryFilter() {
+    }
+
+    public boolean accept(File aDir, String aName) {
+      return new File(aDir, aName).isDirectory();
+    }
+
+  }
+
 }
\ No newline at end of file
index 3e4c583..24211cb 100755 (executable)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import java.net.URLEncoder;\r
-\r
-public class HTMLRoutines {\r
-\r
-  public static String encodeURL(String aString) {\r
-    return URLEncoder.encode(aString);\r
-  }\r
-\r
-  /**\r
-   *\r
-   *\r
-   * @param aString\r
-   * @param anEncoding the encoding to use (Note: JDK 1.3 does not seem to support custom\r
-   *             encodings, so this parameter is ignored for now)\r
-   * @return\r
-   */\r
-\r
-  public static String encodeURL(String aString, String anEncoding) {\r
-    try {\r
-      return URLEncoder.encode(aString);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-  }\r
-\r
-  public static String encodeHTML(String aText) {\r
-    final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"' };\r
-    final String[] ESCAPE_CODES = { "&amp;", "&lt;", "&gt;", "&quot;" };\r
-\r
-    return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES);\r
-  }\r
-\r
-  public static String encodeXML(String aText) {\r
-    final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"', '\'' };\r
-    final String[] ESCAPE_CODES = { "&amp;", "&lt;", "&gt;", "&quot;", "&apos;" };\r
-\r
-    return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES);\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.util;
+
+import java.net.URLEncoder;
+
+public class HTMLRoutines {
+
+  public static String encodeURL(String aString) {
+    return URLEncoder.encode(aString);
+  }
+
+  /**
+   *
+   *
+   * @param aString
+   * @param anEncoding the encoding to use (Note: JDK 1.3 does not seem to support custom
+   *             encodings, so this parameter is ignored for now)
+   * @return
+   */
+
+  public static String encodeURL(String aString, String anEncoding) {
+    try {
+      return URLEncoder.encode(aString);
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.getMessage());
+    }
+  }
+
+  public static String encodeHTML(String aText) {
+    final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"' };
+    final String[] ESCAPE_CODES = { "&amp;", "&lt;", "&gt;", "&quot;" };
+
+    return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES);
+  }
+
+  public static String encodeXML(String aText) {
+    final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"', '\'' };
+    final String[] ESCAPE_CODES = { "&amp;", "&lt;", "&gt;", "&quot;", "&apos;" };
+
+    return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES);
+  }
 }
\ No newline at end of file
index 5303102..20bfd91 100755 (executable)
@@ -1,58 +1,58 @@
-package mir.util;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-public class HTTPRequestParser {\r
-  private HttpServletRequest request;\r
-  private String encoding;\r
-\r
-  public HTTPRequestParser(HttpServletRequest aRequest) {\r
-    this(aRequest, aRequest.getCharacterEncoding());\r
-  }\r
-\r
-  public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) {\r
-    request = aRequest;\r
-    encoding = anEncoding;\r
-  }\r
-\r
-  public boolean hasParameter(String aName) {\r
-    return request.getParameter(aName)!=null;\r
-  }\r
-\r
-  public String getParameterWithDefault(String aName, String aDefault) {\r
-    if (hasParameter(aName))\r
-      return getParameter(aName);\r
-    else\r
-      return aDefault;\r
-  }\r
-\r
-  public String getParameter(String aName) {\r
-    try {\r
-      String result = request.getParameter(aName);\r
-      String requestEncoding = request.getCharacterEncoding();\r
-      if (requestEncoding==null)\r
-        requestEncoding = "ISO-8859-1";\r
-\r
-      if (result != null && encoding!=null && !encoding.equals(requestEncoding)) {\r
-        result = new String(result.getBytes(requestEncoding), encoding);\r
-      }\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage());\r
-    }\r
-  }\r
-\r
-  public int getIntegerWithDefault(String aName, int aDefault) {\r
-    int result = aDefault;\r
-    String value = getParameter(aName);\r
-\r
-    try {\r
-      result = Integer.parseInt(value);\r
-    }\r
-    catch (Throwable t) {\r
-    }\r
-    return result;\r
-  }\r
+package mir.util;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class HTTPRequestParser {
+  private HttpServletRequest request;
+  private String encoding;
+
+  public HTTPRequestParser(HttpServletRequest aRequest) {
+    this(aRequest, aRequest.getCharacterEncoding());
+  }
+
+  public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) {
+    request = aRequest;
+    encoding = anEncoding;
+  }
+
+  public boolean hasParameter(String aName) {
+    return request.getParameter(aName)!=null;
+  }
+
+  public String getParameterWithDefault(String aName, String aDefault) {
+    if (hasParameter(aName))
+      return getParameter(aName);
+    else
+      return aDefault;
+  }
+
+  public String getParameter(String aName) {
+    try {
+      String result = request.getParameter(aName);
+      String requestEncoding = request.getCharacterEncoding();
+      if (requestEncoding==null)
+        requestEncoding = "ISO-8859-1";
+
+      if (result != null && encoding!=null && !encoding.equals(requestEncoding)) {
+        result = new String(result.getBytes(requestEncoding), encoding);
+      }
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage());
+    }
+  }
+
+  public int getIntegerWithDefault(String aName, int aDefault) {
+    int result = aDefault;
+    String value = getParameter(aName);
+
+    try {
+      result = Integer.parseInt(value);
+    }
+    catch (Throwable t) {
+    }
+    return result;
+  }
 }
\ No newline at end of file
index 31bd19e..a60a8ca 100755 (executable)
-package mir.util;\r
-\r
-import java.io.InputStream;\r
-import java.io.InputStreamReader;\r
-import java.io.LineNumberReader;\r
-import java.io.OutputStream;\r
-import java.io.*;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import multex.Exc;\r
-import multex.Failure;\r
-\r
-public class PropertiesManipulator {\r
-  private List entries;\r
-  private Map values;\r
-\r
-  public PropertiesManipulator() {\r
-    entries = new Vector();\r
-    values = new HashMap();\r
-  }\r
-\r
-  public void addEmptyLine() {\r
-    entries.add(new EmptyLine());\r
-  }\r
-\r
-  public void addComment(String aComment) {\r
-    entries.add(new Comment(aComment));\r
-  }\r
-\r
-  public void addEntry(String aKey, String aValue) {\r
-    entries.add(new Entry(aKey, aValue));\r
-    values.put(aKey, aValue);\r
-  }\r
-\r
-  public Iterator getEntries() {\r
-    return entries.iterator();\r
-  }\r
-\r
-  public String get(String aKey) {\r
-    return (String) values.get(aKey);\r
-  }\r
-\r
-  public boolean containsKey(String aKey) {\r
-    return values.containsKey(aKey);\r
-  }\r
-\r
-  public static class Comment {\r
-    private String comment;\r
-\r
-    public Comment(String aComment) {\r
-      comment = aComment;\r
-    }\r
-\r
-    public String getComment() {\r
-      return comment;\r
-    }\r
-  }\r
-\r
-  public static class EmptyLine {\r
-    public EmptyLine() {\r
-    }\r
-  }\r
-\r
-  public static class Entry {\r
-    private String key;\r
-    private String value;\r
-\r
-    public Entry(String aKey, String aValue) {\r
-      key = aKey;\r
-      value = aValue;\r
-    }\r
-\r
-    public String getKey() {\r
-      return key;\r
-    }\r
-\r
-    public String getValue() {\r
-      return value;\r
-    }\r
-  }\r
-\r
-  private final static String PLAIN= "[^\\\\]*";\r
-  private final static String ESCAPE= "\\\\[ tn]";\r
-  private final static String UNICODE= "\\\\u[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]";\r
-\r
-\r
-  private static String decode(String aValue) {\r
-    try {\r
-      SimpleParser parser = new SimpleParser(aValue);\r
-      StringBuffer result = new StringBuffer();\r
-\r
-      while (!parser.isAtEnd()) {\r
-        result.append(parser.parse(PLAIN));\r
-\r
-        if (!parser.isAtEnd()) {\r
-          if (parser.parses(UNICODE)) {\r
-            String unicode = parser.parse(UNICODE);\r
-\r
-            result.append((char) Integer.parseInt(unicode.substring(2,6), 16));\r
-          }\r
-          else if (parser.parses(ESCAPE)) {\r
-            String escape = parser.parse(ESCAPE);\r
-            result.append(escape.substring(1));\r
-          }\r
-          else\r
-            throw new PropertiesManipulatorExc("Invalid escape code: " + parser.remainingData());\r
-        }\r
-      }\r
-\r
-      return result.toString();\r
-    }\r
-    catch (Throwable t) {\r
-      throw new PropertiesManipulatorFailure(t);\r
-    }\r
-  }\r
-\r
-  private static String encode(String aValue, boolean aUseUnicodeEscapes) {\r
-    try {\r
-      StringBuffer result = new StringBuffer();\r
-      boolean leadingspace=true;\r
-\r
-      for (int i = 0; i<aValue.length(); i++) {\r
-        char c = aValue.charAt(i);\r
-\r
-        if (aUseUnicodeEscapes && (c<0x20 || c>0x7e)) {\r
-          String code=Integer.toHexString(c);\r
-          result.append("\\u");\r
-          for (int j=0; j<4-code.length(); j++)\r
-            result.append("0");\r
-          result.append(code);\r
-        }\r
-        else if (c=='\\')\r
-        {\r
-          result.append("\\\\");\r
-        }\r
-        else if (c=='\n')\r
-        {\r
-          result.append("\\n");\r
-        }\r
-        else if (c=='\r')\r
-        {\r
-          result.append("\\r");\r
-        }\r
-        else if (c=='\t')\r
-        {\r
-          result.append("\\t");\r
-        }\r
-        else if (c==' ' && leadingspace) {\r
-          result.append("\\ ");\r
-        }\r
-        else {\r
-          result.append(c);\r
-        }\r
-\r
-        leadingspace = leadingspace && c ==' ';\r
-      }\r
-\r
-      return result.toString();\r
-    }\r
-    catch (Throwable t) {\r
-      throw new PropertiesManipulatorFailure(t);\r
-    }\r
-  }\r
-\r
-  // ML: to be fixed\r
-  private final static String SPACE = "[\t\n\r ]*";\r
-  private final static String KEY = "(([\\\\].)|([^\\\\=: \t\n\r]))*";\r
-  private final static String SEPARATOR = "[\t\n\r ]*[:=]?[\t\n\r ]*";\r
-  private final static String VALUE = "(([\\\\].)|([^\\\\]))*";\r
-\r
-\r
-  public static PropertiesManipulator readProperties(InputStream anInputStream) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {\r
-    return readProperties(anInputStream, "ISO-8859-1");\r
-  }\r
-\r
-  public static PropertiesManipulator readProperties(InputStream anInputStream, String anEncoding) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {\r
-    try {\r
-      PropertiesManipulator result = new PropertiesManipulator();\r
-      LineNumberReader reader = new LineNumberReader(new InputStreamReader(anInputStream, anEncoding));\r
-\r
-      String line = reader.readLine();\r
-\r
-      while (line != null) {\r
-        String trimmedLine = line.trim();\r
-\r
-        if (trimmedLine.length() == 0) {\r
-          result.addEmptyLine();\r
-        }\r
-        else if (trimmedLine.startsWith("!") || trimmedLine.startsWith("#")) {\r
-          result.addComment(line);\r
-        }\r
-        else {\r
-          SimpleParser parser = new SimpleParser(line);\r
-          parser.skip(SPACE);\r
-          String key = parser.parse(KEY);\r
-          parser.skip(SEPARATOR);\r
-          String value = parser.parse(VALUE);\r
-          while (parser.remainingData().length()>0) {\r
-            if (!parser.remainingData().equals("\\"))\r
-              throw new PropertiesManipulatorExc("internal error: remainingData = " + parser.remainingData());\r
-\r
-            line = reader.readLine();\r
-            if (line==null) {\r
-              throw new PropertiesManipulatorExc("Unexpected end of file");\r
-            }\r
-            parser = new SimpleParser(line);\r
-            parser.skip(SPACE);\r
-            value = value + parser.parse(VALUE);\r
-          }\r
-\r
-          result.addEntry(decode(key), decode(value));\r
-        }\r
-        line = reader.readLine();\r
-      }\r
-\r
-      reader.close();\r
-\r
-      return result;\r
-    }\r
-    catch (PropertiesManipulatorExc t) {\r
-      throw t;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new PropertiesManipulatorFailure(t);\r
-    }\r
-  }\r
-\r
-  public static void writeProperties(PropertiesManipulator aProperties, OutputStream anOutputStream) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {\r
-    writeProperties(aProperties, anOutputStream, "ISO-8859-1", true);\r
-  }\r
-\r
-  public static void writeProperties(PropertiesManipulator aProperties, OutputStream anOutputStream, String anEncoding, boolean aUseUnicodeEscapes) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {\r
-    try {\r
-      PrintWriter p = new PrintWriter(new OutputStreamWriter(anOutputStream, anEncoding));\r
-\r
-      try {\r
-        Iterator i = aProperties.getEntries();\r
-\r
-        while (i.hasNext()) {\r
-          Object entry = i.next();\r
-\r
-          if (entry instanceof EmptyLine) {\r
-            p.println();\r
-          }\r
-          else if (entry instanceof Comment) {\r
-            p.println(((Comment) entry).getComment());\r
-          }\r
-          else if (entry instanceof Entry) {\r
-            String key = encode( ( (Entry) entry).getKey(), aUseUnicodeEscapes);\r
-            String value = "";\r
-            if ( ( (Entry) entry).getValue() != null)\r
-              value = encode( ( (Entry) entry).getValue(), aUseUnicodeEscapes);\r
-\r
-            String line = key + " = " + value;\r
-\r
-            p.println(line);\r
-\r
-          }\r
-          else throw new PropertiesManipulatorExc("Unknown entry class: " +entry.getClass().getName());\r
-        }\r
-      }\r
-      finally {\r
-        p.close();\r
-      }\r
-    }\r
-    catch (Throwable t) {\r
-      throw new PropertiesManipulatorFailure(t);\r
-    }\r
-  }\r
-\r
-  public static class PropertiesManipulatorFailure extends Failure {\r
-    public PropertiesManipulatorFailure(Throwable aThrowable) {\r
-      super(aThrowable.getMessage(), aThrowable);\r
-    }\r
-\r
-    public PropertiesManipulatorFailure(String aMessage, Throwable aThrowable) {\r
-      super(aMessage, aThrowable);\r
-    }\r
-  }\r
-\r
-  public static class PropertiesManipulatorExc extends Exc {\r
-    public PropertiesManipulatorExc(String aMessage) {\r
-      super(aMessage);\r
-    }\r
-  }\r
+package mir.util;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.OutputStream;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import multex.Exc;
+import multex.Failure;
+
+public class PropertiesManipulator {
+  private List entries;
+  private Map values;
+
+  public PropertiesManipulator() {
+    entries = new Vector();
+    values = new HashMap();
+  }
+
+  public void addEmptyLine() {
+    entries.add(new EmptyLine());
+  }
+
+  public void addComment(String aComment) {
+    entries.add(new Comment(aComment));
+  }
+
+  public void addEntry(String aKey, String aValue) {
+    entries.add(new Entry(aKey, aValue));
+    values.put(aKey, aValue);
+  }
+
+  public Iterator getEntries() {
+    return entries.iterator();
+  }
+
+  public String get(String aKey) {
+    return (String) values.get(aKey);
+  }
+
+  public boolean containsKey(String aKey) {
+    return values.containsKey(aKey);
+  }
+
+  public static class Comment {
+    private String comment;
+
+    public Comment(String aComment) {
+      comment = aComment;
+    }
+
+    public String getComment() {
+      return comment;
+    }
+  }
+
+  public static class EmptyLine {
+    public EmptyLine() {
+    }
+  }
+
+  public static class Entry {
+    private String key;
+    private String value;
+
+    public Entry(String aKey, String aValue) {
+      key = aKey;
+      value = aValue;
+    }
+
+    public String getKey() {
+      return key;
+    }
+
+    public String getValue() {
+      return value;
+    }
+  }
+
+  private final static String PLAIN= "[^\\\\]*";
+  private final static String ESCAPE= "\\\\[ tn]";
+  private final static String UNICODE= "\\\\u[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]";
+
+
+  private static String decode(String aValue) {
+    try {
+      SimpleParser parser = new SimpleParser(aValue);
+      StringBuffer result = new StringBuffer();
+
+      while (!parser.isAtEnd()) {
+        result.append(parser.parse(PLAIN));
+
+        if (!parser.isAtEnd()) {
+          if (parser.parses(UNICODE)) {
+            String unicode = parser.parse(UNICODE);
+
+            result.append((char) Integer.parseInt(unicode.substring(2,6), 16));
+          }
+          else if (parser.parses(ESCAPE)) {
+            String escape = parser.parse(ESCAPE);
+            result.append(escape.substring(1));
+          }
+          else
+            throw new PropertiesManipulatorExc("Invalid escape code: " + parser.remainingData());
+        }
+      }
+
+      return result.toString();
+    }
+    catch (Throwable t) {
+      throw new PropertiesManipulatorFailure(t);
+    }
+  }
+
+  private static String encode(String aValue, boolean aUseUnicodeEscapes) {
+    try {
+      StringBuffer result = new StringBuffer();
+      boolean leadingspace=true;
+
+      for (int i = 0; i<aValue.length(); i++) {
+        char c = aValue.charAt(i);
+
+        if (aUseUnicodeEscapes && (c<0x20 || c>0x7e)) {
+          String code=Integer.toHexString(c);
+          result.append("\\u");
+          for (int j=0; j<4-code.length(); j++)
+            result.append("0");
+          result.append(code);
+        }
+        else if (c=='\\')
+        {
+          result.append("\\\\");
+        }
+        else if (c=='\n')
+        {
+          result.append("\\n");
+        }
+        else if (c=='\r')
+        {
+          result.append("\\r");
+        }
+        else if (c=='\t')
+        {
+          result.append("\\t");
+        }
+        else if (c==' ' && leadingspace) {
+          result.append("\\ ");
+        }
+        else {
+          result.append(c);
+        }
+
+        leadingspace = leadingspace && c ==' ';
+      }
+
+      return result.toString();
+    }
+    catch (Throwable t) {
+      throw new PropertiesManipulatorFailure(t);
+    }
+  }
+
+  // ML: to be fixed
+  private final static String SPACE = "[\t\n\r ]*";
+  private final static String KEY = "(([\\\\].)|([^\\\\=: \t\n\r]))*";
+  private final static String SEPARATOR = "[\t\n\r ]*[:=]?[\t\n\r ]*";
+  private final static String VALUE = "(([\\\\].)|([^\\\\]))*";
+
+
+  public static PropertiesManipulator readProperties(InputStream anInputStream) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {
+    return readProperties(anInputStream, "ISO-8859-1");
+  }
+
+  public static PropertiesManipulator readProperties(InputStream anInputStream, String anEncoding) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {
+    try {
+      PropertiesManipulator result = new PropertiesManipulator();
+      LineNumberReader reader = new LineNumberReader(new InputStreamReader(anInputStream, anEncoding));
+
+      String line = reader.readLine();
+
+      while (line != null) {
+        String trimmedLine = line.trim();
+
+        if (trimmedLine.length() == 0) {
+          result.addEmptyLine();
+        }
+        else if (trimmedLine.startsWith("!") || trimmedLine.startsWith("#")) {
+          result.addComment(line);
+        }
+        else {
+          SimpleParser parser = new SimpleParser(line);
+          parser.skip(SPACE);
+          String key = parser.parse(KEY);
+          parser.skip(SEPARATOR);
+          String value = parser.parse(VALUE);
+          while (parser.remainingData().length()>0) {
+            if (!parser.remainingData().equals("\\"))
+              throw new PropertiesManipulatorExc("internal error: remainingData = " + parser.remainingData());
+
+            line = reader.readLine();
+            if (line==null) {
+              throw new PropertiesManipulatorExc("Unexpected end of file");
+            }
+            parser = new SimpleParser(line);
+            parser.skip(SPACE);
+            value = value + parser.parse(VALUE);
+          }
+
+          result.addEntry(decode(key), decode(value));
+        }
+        line = reader.readLine();
+      }
+
+      reader.close();
+
+      return result;
+    }
+    catch (PropertiesManipulatorExc t) {
+      throw t;
+    }
+    catch (Throwable t) {
+      throw new PropertiesManipulatorFailure(t);
+    }
+  }
+
+  public static void writeProperties(PropertiesManipulator aProperties, OutputStream anOutputStream) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {
+    writeProperties(aProperties, anOutputStream, "ISO-8859-1", true);
+  }
+
+  public static void writeProperties(PropertiesManipulator aProperties, OutputStream anOutputStream, String anEncoding, boolean aUseUnicodeEscapes) throws PropertiesManipulatorExc, PropertiesManipulatorFailure {
+    try {
+      PrintWriter p = new PrintWriter(new OutputStreamWriter(anOutputStream, anEncoding));
+
+      try {
+        Iterator i = aProperties.getEntries();
+
+        while (i.hasNext()) {
+          Object entry = i.next();
+
+          if (entry instanceof EmptyLine) {
+            p.println();
+          }
+          else if (entry instanceof Comment) {
+            p.println(((Comment) entry).getComment());
+          }
+          else if (entry instanceof Entry) {
+            String key = encode( ( (Entry) entry).getKey(), aUseUnicodeEscapes);
+            String value = "";
+            if ( ( (Entry) entry).getValue() != null)
+              value = encode( ( (Entry) entry).getValue(), aUseUnicodeEscapes);
+
+            String line = key + " = " + value;
+
+            p.println(line);
+
+          }
+          else throw new PropertiesManipulatorExc("Unknown entry class: " +entry.getClass().getName());
+        }
+      }
+      finally {
+        p.close();
+      }
+    }
+    catch (Throwable t) {
+      throw new PropertiesManipulatorFailure(t);
+    }
+  }
+
+  public static class PropertiesManipulatorFailure extends Failure {
+    public PropertiesManipulatorFailure(Throwable aThrowable) {
+      super(aThrowable.getMessage(), aThrowable);
+    }
+
+    public PropertiesManipulatorFailure(String aMessage, Throwable aThrowable) {
+      super(aMessage, aThrowable);
+    }
+  }
+
+  public static class PropertiesManipulatorExc extends Exc {
+    public PropertiesManipulatorExc(String aMessage) {
+      super(aMessage);
+    }
+  }
 }
\ No newline at end of file
index 5571c31..e27ce23 100755 (executable)
@@ -1,89 +1,94 @@
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mir.util;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Vector;
-
-import mir.generator.Generator;
-import mir.generator.GeneratorExc;
-
-import org.apache.struts.util.MessageResources;
-
-public class ResourceBundleGeneratorFunction implements Generator.GeneratorFunction {
-  private List messages;
-  private Locale locale;
-
-  public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages) {
-    this(aLocale, new MessageResources[] {aMessages} );
-  }
-
-  public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages1, MessageResources aMessages2) {
-    this(aLocale, new MessageResources[] {aMessages1, aMessages2} );
-  }
-
-  public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources[] aMessages) {
-    locale = aLocale;
-    messages = new Vector();
-
-    for(int i=0; i<aMessages.length; i++) {
-      this.messages.add(aMessages[i]);
-    }
-  }
-
-  public Object perform(List aParameters) throws GeneratorExc {
-    List extraParameters = new Vector(aParameters);
-
-    if (aParameters.size()<1)
-      throw new GeneratorExc("ResourceBundleGeneratorFunction: at least 1 parameter expected");
-
-    if (!(aParameters.get(0) instanceof String))
-      throw new GeneratorExc("encodeHTMLGeneratorFunction: parameters must be strings");
-
-    String key = (String) aParameters.get(0);
-    extraParameters.remove(0);
-
-    String message=null;
-    Iterator i = messages.iterator();
-    while (i.hasNext() && message==null)
-      message = ((MessageResources) i.next()).getMessage(locale, key, extraParameters.toArray());
-
-    if (message == null) {
-      return new String("??" + key + "??");
-    }
-    else {
-      return message;
-    }
-  };
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mir.util;\r
+\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.Locale;\r
+import java.util.Vector;\r
+\r
+import org.apache.struts.util.MessageResources;\r
+import mir.generator.Generator;\r
+import mir.generator.GeneratorExc;\r
+\r
+public class ResourceBundleGeneratorFunction implements Generator.GeneratorFunction {\r
+  private List messages;\r
+  private List locales;\r
+\r
+  public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages) {\r
+    this(new Locale[] { aLocale}, new MessageResources[] {aMessages} );\r
+  }\r
+\r
+  public ResourceBundleGeneratorFunction(Locale[] aLocales, MessageResources[] aMessages) {\r
+    locales = new Vector();\r
+    messages = new Vector();\r
+\r
+    for(int i=0; i<aMessages.length; i++) {\r
+      messages.add(aMessages[i]);\r
+    }\r
+\r
+    for(int i=0; i<aLocales.length; i++) {\r
+      locales.add(aLocales[i]);\r
+    }\r
+  }\r
+\r
+  public Object perform(List aParameters) throws GeneratorExc {\r
+    List extraParameters = new Vector(aParameters);\r
+\r
+    if (aParameters.size()<1)\r
+      throw new GeneratorExc("ResourceBundleGeneratorFunction: at least 1 parameter expected");\r
+\r
+    if (!(aParameters.get(0) instanceof String))\r
+      throw new GeneratorExc("encodeHTMLGeneratorFunction: parameters must be strings");\r
+\r
+    String key = (String) aParameters.get(0);\r
+    extraParameters.remove(0);\r
+\r
+    String message=null;\r
+    Iterator j = locales.iterator();\r
+    while (j.hasNext() && (message == null || message.trim().length()==0)) {\r
+      Locale locale = (Locale) j.next();\r
+\r
+      Iterator i = messages.iterator();\r
+      while (i.hasNext() && (message == null || message.trim().length()==0)) {\r
+        message = ( (MessageResources) i.next()).getMessage(locale, key, extraParameters.toArray());\r
+      }\r
+    }\r
+\r
+    if (message == null) {\r
+      return new String("??" + key + "??");\r
+    }\r
+    else {\r
+      return message;\r
+    }\r
+  };\r
 }
\ No newline at end of file
index 1810466..1be8cfe 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import gnu.regexp.RE;\r
-import gnu.regexp.REException;\r
-import gnu.regexp.REMatch;\r
-import multex.Exc;\r
-import multex.Failure;\r
-\r
-/**\r
- * a class to do some basic, regexp based parsing of character data\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
-public class SimpleParser {\r
-  private String data;\r
-  private int position;\r
-\r
-  /**\r
-   *\r
-   * @param aData\r
-   */\r
-\r
-  public SimpleParser(String aData) {\r
-    data=aData;\r
-    position=0;\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param aRegularExpression\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   */\r
-\r
-  public boolean parses(RE aRegularExpression) throws SimpleParserExc {\r
-    REMatch match = aRegularExpression.getMatch(data, position);\r
-\r
-    return (match!=null && match.getStartIndex()==position) ;\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param aRegularExpression\r
-   * @param aMessage\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   */\r
-\r
-  public String parse(RE aRegularExpression, String aMessage) throws SimpleParserExc {\r
-    REMatch match = aRegularExpression.getMatch(data, position);\r
-\r
-    if (match==null || match.getStartIndex()!=position)\r
-      throw new SimpleParserExc(aMessage+" at position "+position+" in '"+data+"'");\r
-\r
-    position=match.getEndIndex();\r
-\r
-    return match.toString();\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param aRegularExpression\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   */\r
-\r
-  public String parse(RE aRegularExpression) throws SimpleParserExc {\r
-    return parse( aRegularExpression, "No match found for '"+aRegularExpression.toString()+"'");\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param aRegularExpression\r
-   * @throws SimpleParserExc\r
-   */\r
-\r
-  public void skip(RE aRegularExpression) throws SimpleParserExc {\r
-    REMatch match = aRegularExpression.getMatch(data, position);\r
-\r
-    if (match!=null && match.getStartIndex()==position)\r
-      position=match.getEndIndex();\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param anExpression\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   */\r
-\r
-  public boolean parses(String anExpression) throws SimpleParserExc {\r
-    try {\r
-      return parses(new RE(anExpression));\r
-    }\r
-    catch (SimpleParserExc e) {\r
-      throw e;\r
-    }\r
-    catch (REException e) {\r
-      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new SimpleParserFailure( t );\r
-    }\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param anExpression\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   * @throws SimpleParserFailure\r
-   */\r
-\r
-  public String parse(String anExpression) throws SimpleParserExc, SimpleParserFailure {\r
-    try {\r
-      return parse(new RE(anExpression));\r
-    }\r
-    catch (SimpleParserExc e) {\r
-      throw e;\r
-    }\r
-    catch (REException e) {\r
-      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new SimpleParserFailure( t );\r
-    }\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param anExpression\r
-   * @param aMessage\r
-   * @return\r
-   * @throws SimpleParserExc\r
-   * @throws SimpleParserFailure\r
-   */\r
-\r
-  public String parse(String anExpression, String aMessage) throws SimpleParserExc, SimpleParserFailure {\r
-    try {\r
-      return parse(new RE(anExpression), aMessage);\r
-    }\r
-    catch (SimpleParserExc e) {\r
-      throw e;\r
-    }\r
-    catch (REException e) {\r
-      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new SimpleParserFailure( t );\r
-    }\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @param anExpression\r
-   * @throws SimpleParserExc\r
-   * @throws SimpleParserFailure\r
-   */\r
-\r
-  public void skip(String anExpression) throws SimpleParserExc, SimpleParserFailure {\r
-    try {\r
-      skip(new RE(anExpression));\r
-    }\r
-    catch (SimpleParserExc e) {\r
-      throw e;\r
-    }\r
-    catch (REException e) {\r
-      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new SimpleParserFailure( t );\r
-    }\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @return true if the parser is at the end of the data\r
-   */\r
-\r
-  public boolean isAtEnd() {\r
-    return position>=data.length();\r
-  }\r
-\r
-  /**\r
-   *\r
-   * @return\r
-   */\r
-  public String remainingData() {\r
-    return data.substring(position);\r
-  }\r
-\r
-  /**\r
-   *\r
-   * <p>Title: </p>\r
-   * <p>Description: </p>\r
-   * <p>Copyright: Copyright (c) 2003</p>\r
-   * <p>Company: </p>\r
-   * @author not attributable\r
-   * @version 1.0\r
-   */\r
-\r
-  public static class SimpleParserFailure extends Failure {\r
-    public SimpleParserFailure(Throwable aThrowable) {\r
-      super(aThrowable.getMessage(), aThrowable);\r
-    }\r
-\r
-    public SimpleParserFailure(String aMessage, Throwable aThrowable) {\r
-      super(aMessage, aThrowable);\r
-    }\r
-  }\r
-\r
-  public static class SimpleParserExc extends Exc {\r
-    public SimpleParserExc(String aMessage) {\r
-      super(aMessage);\r
-    }\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.util;
+
+import gnu.regexp.RE;
+import gnu.regexp.REException;
+import gnu.regexp.REMatch;
+import multex.Exc;
+import multex.Failure;
+
+/**
+ * a class to do some basic, regexp based parsing of character data
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+public class SimpleParser {
+  private String data;
+  private int position;
+
+  /**
+   *
+   * @param aData
+   */
+
+  public SimpleParser(String aData) {
+    data=aData;
+    position=0;
+  }
+
+  /**
+   *
+   * @param aRegularExpression
+   * @return
+   * @throws SimpleParserExc
+   */
+
+  public boolean parses(RE aRegularExpression) throws SimpleParserExc {
+    REMatch match = aRegularExpression.getMatch(data, position);
+
+    return (match!=null && match.getStartIndex()==position) ;
+  }
+
+  /**
+   *
+   * @param aRegularExpression
+   * @param aMessage
+   * @return
+   * @throws SimpleParserExc
+   */
+
+  public String parse(RE aRegularExpression, String aMessage) throws SimpleParserExc {
+    REMatch match = aRegularExpression.getMatch(data, position);
+
+    if (match==null || match.getStartIndex()!=position)
+      throw new SimpleParserExc(aMessage+" at position "+position+" in '"+data+"'");
+
+    position=match.getEndIndex();
+
+    return match.toString();
+  }
+
+  /**
+   *
+   * @param aRegularExpression
+   * @return
+   * @throws SimpleParserExc
+   */
+
+  public String parse(RE aRegularExpression) throws SimpleParserExc {
+    return parse( aRegularExpression, "No match found for '"+aRegularExpression.toString()+"'");
+  }
+
+  /**
+   *
+   * @param aRegularExpression
+   * @throws SimpleParserExc
+   */
+
+  public void skip(RE aRegularExpression) throws SimpleParserExc {
+    REMatch match = aRegularExpression.getMatch(data, position);
+
+    if (match!=null && match.getStartIndex()==position)
+      position=match.getEndIndex();
+  }
+
+  /**
+   *
+   * @param anExpression
+   * @return
+   * @throws SimpleParserExc
+   */
+
+  public boolean parses(String anExpression) throws SimpleParserExc {
+    try {
+      return parses(new RE(anExpression));
+    }
+    catch (SimpleParserExc e) {
+      throw e;
+    }
+    catch (REException e) {
+      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);
+    }
+    catch (Throwable t) {
+      throw new SimpleParserFailure( t );
+    }
+  }
+
+  /**
+   *
+   * @param anExpression
+   * @return
+   * @throws SimpleParserExc
+   * @throws SimpleParserFailure
+   */
+
+  public String parse(String anExpression) throws SimpleParserExc, SimpleParserFailure {
+    try {
+      return parse(new RE(anExpression));
+    }
+    catch (SimpleParserExc e) {
+      throw e;
+    }
+    catch (REException e) {
+      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);
+    }
+    catch (Throwable t) {
+      throw new SimpleParserFailure( t );
+    }
+  }
+
+  /**
+   *
+   * @param anExpression
+   * @param aMessage
+   * @return
+   * @throws SimpleParserExc
+   * @throws SimpleParserFailure
+   */
+
+  public String parse(String anExpression, String aMessage) throws SimpleParserExc, SimpleParserFailure {
+    try {
+      return parse(new RE(anExpression), aMessage);
+    }
+    catch (SimpleParserExc e) {
+      throw e;
+    }
+    catch (REException e) {
+      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);
+    }
+    catch (Throwable t) {
+      throw new SimpleParserFailure( t );
+    }
+  }
+
+  /**
+   *
+   * @param anExpression
+   * @throws SimpleParserExc
+   * @throws SimpleParserFailure
+   */
+
+  public void skip(String anExpression) throws SimpleParserExc, SimpleParserFailure {
+    try {
+      skip(new RE(anExpression));
+    }
+    catch (SimpleParserExc e) {
+      throw e;
+    }
+    catch (REException e) {
+      throw new SimpleParserFailure( "Error compiling regular expression '" + anExpression + "': " + e.getMessage(), e);
+    }
+    catch (Throwable t) {
+      throw new SimpleParserFailure( t );
+    }
+  }
+
+  /**
+   *
+   * @return true if the parser is at the end of the data
+   */
+
+  public boolean isAtEnd() {
+    return position>=data.length();
+  }
+
+  /**
+   *
+   * @return
+   */
+  public String remainingData() {
+    return data.substring(position);
+  }
+
+  /**
+   *
+   * <p>Title: </p>
+   * <p>Description: </p>
+   * <p>Copyright: Copyright (c) 2003</p>
+   * <p>Company: </p>
+   * @author not attributable
+   * @version 1.0
+   */
+
+  public static class SimpleParserFailure extends Failure {
+    public SimpleParserFailure(Throwable aThrowable) {
+      super(aThrowable.getMessage(), aThrowable);
+    }
+
+    public SimpleParserFailure(String aMessage, Throwable aThrowable) {
+      super(aMessage, aThrowable);
+    }
+  }
+
+  public static class SimpleParserExc extends Exc {
+    public SimpleParserExc(String aMessage) {
+      super(aMessage);
+    }
+  }
 }
\ No newline at end of file
index b8bc9e3..23e0823 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.StringReader;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Stack;\r
-\r
-import javax.xml.parsers.ParserConfigurationException;\r
-import javax.xml.parsers.SAXParser;\r
-import javax.xml.parsers.SAXParserFactory;\r
-\r
-import multex.Exc;\r
-import multex.Failure;\r
-\r
-import org.xml.sax.Attributes;\r
-import org.xml.sax.InputSource;\r
-import org.xml.sax.Locator;\r
-import org.xml.sax.SAXException;\r
-import org.xml.sax.SAXParseException;\r
-import org.xml.sax.helpers.DefaultHandler;\r
-\r
-public class XMLReader {\r
-  private Locator locator;\r
-  private String filename;\r
-  private boolean namespaceAware;\r
-\r
-  public XMLReader() {\r
-    this(false);\r
-  }\r
-\r
-  public XMLReader(boolean aNameSpaceAware) {\r
-    namespaceAware = aNameSpaceAware;\r
-    filename="";\r
-  }\r
-\r
-  public void parseFile(String aFileName, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {\r
-    filename= aFileName;\r
-    try {\r
-      parseInputStream(new FileInputStream(aFileName), aRootHandler);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new XMLReaderFailure(t);\r
-    }\r
-  }\r
-\r
-  public void parseInputStream(InputStream anInputStream, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {\r
-    try {\r
-      SAXParserFactory parserFactory = SAXParserFactory.newInstance();\r
-\r
-      parserFactory.setNamespaceAware(namespaceAware);\r
-      parserFactory.setValidating(true);\r
-\r
-      XMLReaderHandler handler = new XMLReaderHandler(parserFactory, aRootHandler);\r
-\r
-      handler.processInputStream(anInputStream);\r
-    }\r
-    catch (Throwable e) {\r
-      Throwable t = ExceptionFunctions.traceCauseException(e);\r
-\r
-      if (t instanceof XMLReaderExc) {\r
-        if (locator!=null && filename!=null)\r
-          ((XMLReaderExc) t).setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());\r
-        throw (XMLReaderExc) t;\r
-      }\r
-\r
-      if (t instanceof XMLReaderFailure) {\r
-        throw (XMLReaderFailure) t;\r
-      }\r
-\r
-      throw new XMLReaderFailure(t);\r
-    }\r
-  }\r
-\r
-  private class XMLReaderHandler extends DefaultHandler {\r
-    private SAXParserFactory parserFactory;\r
-    private SectionsManager manager;\r
-    private InputSource inputSource;\r
-\r
-    public XMLReaderHandler(SAXParserFactory aParserFactory, SectionHandler aRootHandler) {\r
-      super();\r
-\r
-      parserFactory=aParserFactory;\r
-      manager = new SectionsManager();\r
-      manager.pushHandler(aRootHandler);\r
-   }\r
-\r
-    public void setDocumentLocator(Locator aLocator) {\r
-      locator=aLocator;\r
-    }\r
-\r
-    private void processInputStream(InputStream anInputStream) throws XMLReaderExc, XMLReaderFailure {\r
-      try {\r
-        SAXParser parser=parserFactory.newSAXParser();\r
-\r
-        inputSource = new InputSource(anInputStream);\r
-        parser.parse(inputSource, this);\r
-      }\r
-      catch (ParserConfigurationException e) {\r
-        throw new XMLReaderExc("Internal exception: "+e.getMessage());\r
-      }\r
-      catch (Throwable e) {\r
-        throw new XMLReaderFailure(e);\r
-      }\r
-    }\r
-\r
-    public void startElement(String aUri, String aTag, String aQualifiedName, Attributes anAttributes) throws SAXException {\r
-      Map attributesMap;\r
-      int i;\r
-\r
-      try {\r
-        attributesMap = new HashMap();\r
-        for (i=0; i<anAttributes.getLength(); i++)\r
-          attributesMap.put(anAttributes.getQName(i), anAttributes.getValue(i));\r
-\r
-        SectionHandler handler = manager.currentHandler().startElement(aQualifiedName, attributesMap);\r
-\r
-        manager.pushHandler( handler );\r
-      }\r
-      catch (XMLReaderExc e) {\r
-        throw new SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new SAXException(e);\r
-      }\r
-    }\r
-\r
-    public void endElement(String aUri, String aTag, String aQualifiedName) throws SAXException {\r
-      try\r
-      {\r
-        if (!aQualifiedName.equals("include")) {\r
-          SectionHandler handler = manager.popHandler();\r
-\r
-          handler.finishSection();\r
-\r
-          if (!manager.isEmpty()) {\r
-            manager.currentHandler().endElement(handler);\r
-          }\r
-        }\r
-      }\r
-      catch (XMLReaderExc e) {\r
-        throw new SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new SAXException(e);\r
-      }\r
-    }\r
-\r
-    public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXException {\r
-      try {\r
-        String text = new String(aBuffer, aStart, anEnd);\r
-\r
-        manager.currentHandler().characters(text);\r
-      }\r
-      catch (XMLReaderExc e) {\r
-        throw new SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new SAXException(e);\r
-      }\r
-    }\r
-  }\r
-\r
-  private class SectionsManager {\r
-    Stack handlerStack;\r
-\r
-    public SectionsManager() {\r
-      handlerStack = new Stack();\r
-    }\r
-\r
-    public void pushHandler(SectionHandler aSectionHandler) {\r
-      handlerStack.push(aSectionHandler);\r
-    }\r
-\r
-    public SectionHandler popHandler() {\r
-      return (SectionHandler) handlerStack.pop();\r
-    }\r
-\r
-    public SectionHandler currentHandler() {\r
-      return (SectionHandler) handlerStack.peek();\r
-    }\r
-\r
-    public boolean isEmpty() {\r
-      return handlerStack.isEmpty();\r
-    }\r
-  }\r
-\r
-  public static interface SectionHandler {\r
-    public abstract SectionHandler startElement(String aTag, Map anAttributes) throws XMLReaderExc;\r
-\r
-    public abstract void endElement(SectionHandler aHandler) throws XMLReaderExc;\r
-\r
-    public void characters(String aCharacters) throws XMLReaderExc;\r
-\r
-    public void finishSection() throws XMLReaderExc;\r
-  }\r
-\r
-  public static abstract class AbstractSectionHandler implements SectionHandler {\r
-    public SectionHandler startElement(String aTag, Map anAttributes) throws XMLReaderExc {\r
-      return null;\r
-    };\r
-\r
-    public void endElement(SectionHandler aHandler) throws XMLReaderExc {\r
-    };\r
-\r
-    public void finishSection() throws XMLReaderExc {\r
-    }\r
-\r
-    public void characters(String aCharacters) throws XMLReaderExc {\r
-      if ( aCharacters.trim().length() > 0) {\r
-        throw new XMLReaderExc("Text not allowed");\r
-      }\r
-    }\r
-  }\r
-\r
-  public static class XMLReaderExc extends Exc {\r
-    private boolean hasLocation;\r
-    private String filename;\r
-    private int lineNr;\r
-    private int columnNr;\r
-\r
-    public XMLReaderExc(String aMessage) {\r
-      super(aMessage);\r
-      hasLocation = false;\r
-    }\r
-\r
-    protected void setLocation(String aFilename, int aLineNr, int aColumnNr) {\r
-      filename = aFilename;\r
-      lineNr = aLineNr;\r
-      columnNr = aColumnNr;\r
-      hasLocation = true;\r
-    }\r
-\r
-    public boolean getHasLocation() {\r
-      return hasLocation;\r
-    }\r
-\r
-    public int getLineNr() {\r
-      return lineNr;\r
-    }\r
-\r
-    public int getColumnNr() {\r
-      return columnNr;\r
-    }\r
-\r
-    public String getFilename() {\r
-      return filename;\r
-    }\r
-  }\r
-\r
-  public static class XMLReaderFailure extends Failure {\r
-    public XMLReaderFailure(String aMessage, Throwable aCause) {\r
-      super(aMessage, aCause);\r
-    }\r
-\r
-    public XMLReaderFailure(Throwable aCause) {\r
-      super(aCause.getMessage(), aCause);\r
-    }\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import multex.Exc;
+import multex.Failure;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class XMLReader {
+  private Locator locator;
+  private String filename;
+  private boolean namespaceAware;
+
+  public XMLReader() {
+    this(false);
+  }
+
+  public XMLReader(boolean aNameSpaceAware) {
+    namespaceAware = aNameSpaceAware;
+    filename="";
+  }
+
+  public void parseFile(String aFileName, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
+    filename= aFileName;
+    try {
+      parseInputStream(new FileInputStream(aFileName), aRootHandler);
+    }
+    catch (Throwable t) {
+      throw new XMLReaderFailure(t);
+    }
+  }
+
+  public void parseInputStream(InputStream anInputStream, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
+    try {
+      SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+
+      parserFactory.setNamespaceAware(namespaceAware);
+      parserFactory.setValidating(true);
+
+      XMLReaderHandler handler = new XMLReaderHandler(parserFactory, aRootHandler);
+
+      handler.processInputStream(anInputStream);
+    }
+    catch (Throwable e) {
+      Throwable t = ExceptionFunctions.traceCauseException(e);
+
+      if (t instanceof XMLReaderExc) {
+        if (locator!=null && filename!=null)
+          ((XMLReaderExc) t).setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());
+        throw (XMLReaderExc) t;
+      }
+
+      if (t instanceof XMLReaderFailure) {
+        throw (XMLReaderFailure) t;
+      }
+
+      throw new XMLReaderFailure(t);
+    }
+  }
+
+  private class XMLReaderHandler extends DefaultHandler {
+    private SAXParserFactory parserFactory;
+    private SectionsManager manager;
+    private InputSource inputSource;
+
+    public XMLReaderHandler(SAXParserFactory aParserFactory, SectionHandler aRootHandler) {
+      super();
+
+      parserFactory=aParserFactory;
+      manager = new SectionsManager();
+      manager.pushHandler(aRootHandler);
+   }
+
+    public void setDocumentLocator(Locator aLocator) {
+      locator=aLocator;
+    }
+
+    private void processInputStream(InputStream anInputStream) throws XMLReaderExc, XMLReaderFailure {
+      try {
+        SAXParser parser=parserFactory.newSAXParser();
+
+        inputSource = new InputSource(anInputStream);
+        parser.parse(inputSource, this);
+      }
+      catch (ParserConfigurationException e) {
+        throw new XMLReaderExc("Internal exception: "+e.getMessage());
+      }
+      catch (Throwable e) {
+        throw new XMLReaderFailure(e);
+      }
+    }
+
+    public void startElement(String aUri, String aTag, String aQualifiedName, Attributes anAttributes) throws SAXException {
+      Map attributesMap;
+      int i;
+
+      try {
+        attributesMap = new HashMap();
+        for (i=0; i<anAttributes.getLength(); i++)
+          attributesMap.put(anAttributes.getQName(i), anAttributes.getValue(i));
+
+        SectionHandler handler = manager.currentHandler().startElement(aQualifiedName, attributesMap);
+
+        manager.pushHandler( handler );
+      }
+      catch (XMLReaderExc e) {
+        throw new SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new SAXException(e);
+      }
+    }
+
+    public void endElement(String aUri, String aTag, String aQualifiedName) throws SAXException {
+      try
+      {
+        if (!aQualifiedName.equals("include")) {
+          SectionHandler handler = manager.popHandler();
+
+          handler.finishSection();
+
+          if (!manager.isEmpty()) {
+            manager.currentHandler().endElement(handler);
+          }
+        }
+      }
+      catch (XMLReaderExc e) {
+        throw new SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new SAXException(e);
+      }
+    }
+
+    public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXException {
+      try {
+        String text = new String(aBuffer, aStart, anEnd);
+
+        manager.currentHandler().characters(text);
+      }
+      catch (XMLReaderExc e) {
+        throw new SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new SAXException(e);
+      }
+    }
+  }
+
+  private class SectionsManager {
+    Stack handlerStack;
+
+    public SectionsManager() {
+      handlerStack = new Stack();
+    }
+
+    public void pushHandler(SectionHandler aSectionHandler) {
+      handlerStack.push(aSectionHandler);
+    }
+
+    public SectionHandler popHandler() {
+      return (SectionHandler) handlerStack.pop();
+    }
+
+    public SectionHandler currentHandler() {
+      return (SectionHandler) handlerStack.peek();
+    }
+
+    public boolean isEmpty() {
+      return handlerStack.isEmpty();
+    }
+  }
+
+  public static interface SectionHandler {
+    public abstract SectionHandler startElement(String aTag, Map anAttributes) throws XMLReaderExc;
+
+    public abstract void endElement(SectionHandler aHandler) throws XMLReaderExc;
+
+    public void characters(String aCharacters) throws XMLReaderExc;
+
+    public void finishSection() throws XMLReaderExc;
+  }
+
+  public static abstract class AbstractSectionHandler implements SectionHandler {
+    public SectionHandler startElement(String aTag, Map anAttributes) throws XMLReaderExc {
+      return null;
+    };
+
+    public void endElement(SectionHandler aHandler) throws XMLReaderExc {
+    };
+
+    public void finishSection() throws XMLReaderExc {
+    }
+
+    public void characters(String aCharacters) throws XMLReaderExc {
+      if ( aCharacters.trim().length() > 0) {
+        throw new XMLReaderExc("Text not allowed");
+      }
+    }
+  }
+
+  public static class XMLReaderExc extends Exc {
+    private boolean hasLocation;
+    private String filename;
+    private int lineNr;
+    private int columnNr;
+
+    public XMLReaderExc(String aMessage) {
+      super(aMessage);
+      hasLocation = false;
+    }
+
+    protected void setLocation(String aFilename, int aLineNr, int aColumnNr) {
+      filename = aFilename;
+      lineNr = aLineNr;
+      columnNr = aColumnNr;
+      hasLocation = true;
+    }
+
+    public boolean getHasLocation() {
+      return hasLocation;
+    }
+
+    public int getLineNr() {
+      return lineNr;
+    }
+
+    public int getColumnNr() {
+      return columnNr;
+    }
+
+    public String getFilename() {
+      return filename;
+    }
+  }
+
+  public static class XMLReaderFailure extends Failure {
+    public XMLReaderFailure(String aMessage, Throwable aCause) {
+      super(aMessage, aCause);
+    }
+
+    public XMLReaderFailure(Throwable aCause) {
+      super(aCause.getMessage(), aCause);
+    }
+  }
+
 }
\ No newline at end of file
index 768e8eb..3a46eed 100755 (executable)
@@ -1,67 +1,67 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.entity;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Map;\r
-\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-\r
-/**\r
- * This class handles storage of audio data and meta data\r
- *\r
- * @author mh\r
- * @version $Id: EntityAudio.java,v 1.9 2003/03/16 19:54:45 zapata Exp $\r
- */\r
-\r
-\r
-public class EntityAudio extends EntityUploadedMedia\r
-{\r
-  public EntityAudio() {\r
-    super();\r
-  }\r
-\r
-  public EntityAudio(StorageObject theStorage) {\r
-    this();\r
-    setStorage(theStorage);\r
-  }\r
-\r
-  public void setValues(Map theStringValues) {\r
-    if (theStringValues != null) {\r
-      if (!theStringValues.containsKey("is_published"))\r
-        theStringValues.put("is_published", "0");\r
-    }\r
-    super.setValues(theStringValues);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.entity;
+
+import java.sql.SQLException;
+import java.util.Map;
+
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+
+/**
+ * This class handles storage of audio data and meta data
+ *
+ * @author mh
+ * @version $Id: EntityAudio.java,v 1.10 2003/04/09 02:06:08 zapata Exp $
+ */
+
+
+public class EntityAudio extends EntityUploadedMedia
+{
+  public EntityAudio() {
+    super();
+  }
+
+  public EntityAudio(StorageObject theStorage) {
+    this();
+    setStorage(theStorage);
+  }
+
+  public void setValues(Map theStringValues) {
+    if (theStringValues != null) {
+      if (!theStringValues.containsKey("is_published"))
+        theStringValues.put("is_published", "0");
+    }
+    super.setValues(theStringValues);
+  }
+
+}
index a470850..4a72359 100755 (executable)
@@ -1,67 +1,67 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.entity;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Map;\r
-\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-\r
-/**\r
- * This class handles storage of other data and meta data\r
- *\r
- * @author mh\r
- * @version 11.11.2000\r
- */\r
-\r
-\r
-public class EntityOther extends EntityUploadedMedia\r
-{\r
-  public EntityOther() {\r
-    super();\r
-  }\r
-\r
-  public EntityOther(StorageObject theStorage) {\r
-    this();\r
-    setStorage(theStorage);\r
-  }\r
-\r
-  public void setValues(Map theStringValues) {\r
-    if (theStringValues != null) {\r
-      if (!theStringValues.containsKey("is_published"))\r
-        theStringValues.put("is_published", "0");\r
-    }\r
-    super.setValues(theStringValues);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.entity;
+
+import java.sql.SQLException;
+import java.util.Map;
+
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+
+/**
+ * This class handles storage of other data and meta data
+ *
+ * @author mh
+ * @version 11.11.2000
+ */
+
+
+public class EntityOther extends EntityUploadedMedia
+{
+  public EntityOther() {
+    super();
+  }
+
+  public EntityOther(StorageObject theStorage) {
+    this();
+    setStorage(theStorage);
+  }
+
+  public void setValues(Map theStringValues) {
+    if (theStringValues != null) {
+      if (!theStringValues.containsKey("is_published"))
+        theStringValues.put("is_published", "0");
+    }
+    super.setValues(theStringValues);
+  }
+
+}
index b16d3d6..8497fc9 100755 (executable)
@@ -1,70 +1,70 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.entity;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Map;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-\r
-/**\r
- * Diese Klasse enth?lt die Daten eines MetaObjekts\r
- *\r
- * @author RK\r
- * @version 11.11.2000\r
- */\r
-\r
-\r
-public class EntityVideo extends EntityUploadedMedia\r
-{\r
-  public EntityVideo() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Entity.UploadedMedia.Video");\r
-  }\r
-\r
-  public EntityVideo(StorageObject theStorage) {\r
-    this();\r
-    setStorage(theStorage);\r
-  }\r
-\r
-  public void setValues(Map theStringValues) {\r
-    if (theStringValues != null) {\r
-      if (!theStringValues.containsKey("is_published"))\r
-        theStringValues.put("is_published", "0");\r
-    }\r
-    super.setValues(theStringValues);\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.entity;
+
+import java.sql.SQLException;
+import java.util.Map;
+
+import mir.log.LoggerWrapper;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+
+/**
+ * Diese Klasse enth?lt die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 11.11.2000
+ */
+
+
+public class EntityVideo extends EntityUploadedMedia
+{
+  public EntityVideo() {
+    super();
+
+    logger = new LoggerWrapper("Entity.UploadedMedia.Video");
+  }
+
+  public EntityVideo(StorageObject theStorage) {
+    this();
+    setStorage(theStorage);
+  }
+
+  public void setValues(Map theStringValues) {
+    if (theStringValues != null) {
+      if (!theStringValues.containsKey("is_published"))
+        theStringValues.put("is_published", "0");
+    }
+    super.setValues(theStringValues);
+  }
+
 }
\ No newline at end of file
index 7ef49c3..0d2e630 100755 (executable)
-package mircoders.global;\r
-\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.util.Arrays;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Random;\r
-import java.util.Vector;\r
-import javax.servlet.http.Cookie;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.apache.commons.collections.ExtendedProperties;\r
-\r
-import gnu.regexp.RE;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.util.DateToMapAdapter;\r
-import mir.util.InternetFunctions;\r
-import mir.util.StringRoutines;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-\r
-\r
-public class Abuse {\r
-  private List filters;\r
-  private int maxIdentifier;\r
-  private LoggerWrapper logger;\r
-  private int logSize;\r
-  private boolean logEnabled;\r
-  private boolean openPostingDisabled;\r
-  private boolean openPostingPassword;\r
-  private boolean cookieOnBlock;\r
-  private String articleBlockAction;\r
-  private String commentBlockAction;\r
-  private List log;\r
-  private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config");\r
-\r
-\r
-  private static final String IP_FILTER_TYPE="ip";\r
-  private static final String REGEXP_FILTER_TYPE="regexp";\r
-  private static String cookieName=MirGlobal.config().getString("Abuse.CookieName");\r
-  private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge");\r
-\r
-  public Abuse() {\r
-    logger = new LoggerWrapper("Global.Abuse");\r
-    filters = new Vector();\r
-    maxIdentifier = 0;\r
-    log = new Vector();\r
-\r
-    logSize = 100;\r
-    logEnabled = false;\r
-    articleBlockAction = "";\r
-    commentBlockAction = "";\r
-    openPostingPassword = false;\r
-    openPostingDisabled = false;\r
-    cookieOnBlock = false;\r
-\r
-    load();\r
-  }\r
-\r
-  public boolean checkIpFilter(String anIpAddress) {\r
-    synchronized (filters) {\r
-      Iterator i = filters.iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-\r
-        try {\r
-          if ( (filter.getType().equals(IP_FILTER_TYPE)) &&\r
-              InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) {\r
-            logger.debug("ip match on " + filter.getExpression());\r
-            return true;\r
-          }\r
-        }\r
-        catch (Throwable t) {\r
-          logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage());\r
-        }\r
-      }\r
-\r
-      return false;\r
-    }\r
-  }\r
-\r
-  private boolean checkRegExpFilter(Entity anEntity) {\r
-    synchronized (filters) {\r
-      Iterator i = filters.iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-\r
-        if (filter.getType().equals(REGEXP_FILTER_TYPE)) {\r
-          try {\r
-            RE regularExpression = new RE(filter.getExpression());\r
-\r
-            Iterator j = anEntity.getFields().iterator();\r
-            while (j.hasNext()) {\r
-              String field = anEntity.getValue( (String) j.next());\r
-\r
-              if (field != null && regularExpression.isMatch(field.toLowerCase())) {\r
-                logger.debug("regexp match on " + filter.getExpression());\r
-                return true;\r
-              }\r
-            }\r
-          }\r
-          catch (Throwable t) {\r
-            logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage());\r
-          }\r
-        }\r
-      }\r
-\r
-      return false;\r
-    }\r
-  }\r
-\r
-  private void setCookie(HttpServletResponse aResponse) {\r
-    Random random = new Random();\r
-\r
-    Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000)));\r
-    cookie.setMaxAge(cookieMaxAge);\r
-    cookie.setPath("/");\r
-    aResponse.addCookie(cookie);\r
-  }\r
-\r
-  private boolean checkCookie(List aCookies) {\r
-    if (getCookieOnBlock()) {\r
-      Iterator i = aCookies.iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Cookie cookie = (Cookie) i.next();\r
-\r
-        if (cookie.getName().equals(cookieName)) {\r
-          logger.debug("cookie match");\r
-          return true;\r
-        }\r
-      }\r
-    }\r
-\r
-    return false;\r
-  }\r
-\r
-  public void checkComment(EntityComment aComment, HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    try {\r
-      long time = System.currentTimeMillis();\r
-\r
-      MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);\r
-\r
-      if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(aComment)) {\r
-        operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));\r
-        setCookie(aResponse);\r
-      }\r
-\r
-      logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms");\r
-\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("Abuse.checkComment: " + t.toString());\r
-    }\r
-  }\r
-\r
-  public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    try {\r
-      long time = System.currentTimeMillis();\r
-\r
-      MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);\r
-\r
-      if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) {\r
-        operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));\r
-        setCookie(aResponse);\r
-      }\r
-\r
-      logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms");\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("Abuse.checkArticle: " + t.toString());\r
-    }\r
-  }\r
-\r
-  public boolean getLogEnabled() {\r
-    return logEnabled;\r
-  }\r
-\r
-  public void setLogEnabled(boolean anEnabled) {\r
-    logEnabled = anEnabled;\r
-    truncateLog();\r
-  }\r
-\r
-  public int getLogSize() {\r
-    return logSize;\r
-  }\r
-\r
-  public void setLogSize(int aSize) {\r
-    logSize = aSize;\r
-    truncateLog();\r
-  }\r
-\r
-  public boolean getOpenPostingDisabled() {\r
-    return openPostingDisabled;\r
-  }\r
-\r
-  public void setOpenPostingDisabled(boolean anOpenPostingDisabled) {\r
-    openPostingDisabled = anOpenPostingDisabled;\r
-  }\r
-\r
-  public boolean getOpenPostingPassword() {\r
-    return openPostingPassword;\r
-  }\r
-\r
-  public void setOpenPostingPassword(boolean anOpenPostingPassword) {\r
-    openPostingPassword = anOpenPostingPassword;\r
-  }\r
-\r
-  public boolean getCookieOnBlock() {\r
-    return cookieOnBlock;\r
-  }\r
-\r
-  public void setCookieOnBlock(boolean aCookieOnBlock) {\r
-    cookieOnBlock = aCookieOnBlock;\r
-  }\r
-\r
-  public String getArticleBlockAction() {\r
-    return articleBlockAction;\r
-  }\r
-\r
-  public void setArticleBlockAction(String anAction) {\r
-    articleBlockAction = anAction;\r
-  }\r
-\r
-  public String getCommentBlockAction() {\r
-    return commentBlockAction;\r
-  }\r
-\r
-  public void setCommentBlockAction(String anAction) {\r
-    commentBlockAction = anAction;\r
-  }\r
-\r
-\r
-  public List getLog() {\r
-    synchronized(log) {\r
-      List result = new Vector();\r
-\r
-      Iterator i = log.iterator();\r
-      while (i.hasNext()) {\r
-        LogEntry logEntry = (LogEntry) i.next();\r
-        Map entry = new HashMap();\r
-\r
-        entry.put("ip", logEntry.getIpNumber());\r
-        entry.put("id", logEntry.getId());\r
-        entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp()));\r
-        if (logEntry.getIsArticle())\r
-          entry.put("type", "content");\r
-        else\r
-          entry.put("type", "comment");\r
-        entry.put("browser", logEntry.getBrowserString());\r
-\r
-        result.add(entry);\r
-      }\r
-\r
-      return result;\r
-    }\r
-  }\r
-\r
-  public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) {\r
-    appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false));\r
-  }\r
-\r
-  public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) {\r
-    appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true));\r
-  }\r
-\r
-  public void load() {\r
-    try {\r
-      ExtendedProperties configuration = new ExtendedProperties();\r
-\r
-      try {\r
-        configuration = new ExtendedProperties(configFile);\r
-      }\r
-      catch (FileNotFoundException e) {\r
-      }\r
-\r
-      getFilterConfig(filters, "abuse.filter", configuration);\r
-\r
-      setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));\r
-      setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));\r
-      setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));\r
-      setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));\r
-      setLogSize(configuration.getInt("abuse.logSize", 10));\r
-      setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));\r
-      setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-  public void save() {\r
-    try {\r
-      ExtendedProperties configuration = new ExtendedProperties();\r
-\r
-      setFilterConfig(filters, "abuse.filter", configuration);\r
-\r
-      configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0");\r
-      configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0");\r
-      configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0");\r
-      configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0");\r
-      configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));\r
-      configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());\r
-      configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());\r
-\r
-      configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-\r
-  public List getFilterTypes() {\r
-    List result = new Vector();\r
-\r
-    Map entry = new HashMap();\r
-    entry.put("resource", "abuse.filtertype.ip");\r
-    entry.put("id", IP_FILTER_TYPE);\r
-    result.add(entry);\r
-\r
-    entry = new HashMap();\r
-    entry.put("resource", "abuse.filtertype.regexp");\r
-    entry.put("id", REGEXP_FILTER_TYPE);\r
-    result.add(entry);\r
-\r
-    return result;\r
-  }\r
-\r
-  public List getArticleActions() {\r
-    try {\r
-      List result = new Vector();\r
-\r
-      Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator();\r
-      while (i.hasNext()) {\r
-        MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
-        Map action = new HashMap();\r
-        action.put("resource", "content.operation."+operation.getName());\r
-        action.put("identifier", operation.getName());\r
-\r
-        result.add(action);\r
-      }\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException("can't get article actions");\r
-    }\r
-  }\r
-\r
-  public List getCommentActions() {\r
-    try {\r
-      List result = new Vector();\r
-\r
-      Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator();\r
-      while (i.hasNext()) {\r
-        MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
-        Map action = new HashMap();\r
-        action.put("resource", "comment.operation."+operation.getName());\r
-        action.put("identifier", operation.getName());\r
-\r
-        result.add(action);\r
-      }\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException("can't get comment actions");\r
-    }\r
-  }\r
-\r
-  public List getFilters() {\r
-    return getFiltersAsMaps(filters);\r
-  }\r
-\r
-  public void addFilter(String aType, String anExpression) {\r
-    addFilter(filters, aType, anExpression);\r
-  }\r
-\r
-  public void setFilter(String anIdentifier, String aType, String anExpression) {\r
-    setFilter(filters, anIdentifier, aType, anExpression);\r
-  }\r
-\r
-  public void deleteFilter(String anIdentifier) {\r
-    deleteFilter(filters, anIdentifier);\r
-  }\r
-\r
-  public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception {\r
-  }\r
-\r
-  private List getFiltersAsMaps(List aFilters) {\r
-    synchronized(aFilters) {\r
-      List result = new Vector();\r
-\r
-      Iterator i = aFilters.iterator();\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-        Map map = new HashMap();\r
-\r
-        map.put("id", filter.getId());\r
-        map.put("expression", filter.getExpression());\r
-        map.put("type", filter.getType());\r
-\r
-        result.add(map);\r
-      }\r
-      return result;\r
-    }\r
-  }\r
-\r
-  private void addFilter(List aFilters, String aType, String anExpression) {\r
-    Filter filter = new Filter();\r
-\r
-    filter.setId(generateId());\r
-    filter.setExpression(anExpression);\r
-    filter.setType(aType);\r
-\r
-    synchronized (aFilters) {\r
-      aFilters.add(filter);\r
-    }\r
-  }\r
-\r
-  private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) {\r
-    synchronized (aFilters) {\r
-      Filter filter = findFilter(aFilters, anIdentifier);\r
-\r
-      if (filter!=null) {\r
-        filter.setExpression(anExpression);\r
-        filter.setType(aType);\r
-      }\r
-    }\r
-  }\r
-\r
-  private Filter findFilter(List aFilters, String anIdentifier) {\r
-    synchronized (aFilters) {\r
-      Iterator i = aFilters.iterator();\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-\r
-        if (filter.getId().equals(anIdentifier)) {\r
-          return filter;\r
-        }\r
-      }\r
-    }\r
-\r
-    return null;\r
-  }\r
-\r
-  private void deleteFilter(List aFilters, String anIdentifier) {\r
-    synchronized (aFilters) {\r
-      Filter filter = findFilter(aFilters, anIdentifier);\r
-\r
-      if (filter!=null) {\r
-        aFilters.remove(filter);\r
-      }\r
-    }\r
-  }\r
-\r
-  private String generateId() {\r
-    synchronized(this) {\r
-      maxIdentifier = maxIdentifier+1;\r
-\r
-      return Integer.toString(maxIdentifier);\r
-    }\r
-  }\r
-\r
-  private static class Filter {\r
-    private String identifier;\r
-    private String expression;\r
-    private String type;\r
-\r
-    public Filter() {\r
-      expression="";\r
-      type="";\r
-      identifier="";\r
-    }\r
-\r
-    public String getId() {\r
-      return identifier;\r
-    }\r
-\r
-    public void setId(String anId) {\r
-      identifier = anId;\r
-    }\r
-\r
-    public String getExpression() {\r
-      return expression;\r
-    }\r
-\r
-    public void setExpression(String anExpression) {\r
-      expression = anExpression;\r
-    }\r
-\r
-    public String getType() {\r
-      return type;\r
-    }\r
-\r
-    public void setType(String aType) {\r
-      type = aType;\r
-    }\r
-  }\r
-\r
-  private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {\r
-    synchronized(aFilters) {\r
-      Iterator i = aFilters.iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-\r
-        aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression());\r
-      }\r
-    }\r
-  }\r
-\r
-  private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {\r
-    synchronized(aFilters) {\r
-      aFilters.clear();\r
-\r
-      Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator();\r
-\r
-      while (i.hasNext()) {\r
-        String filter = (String) i.next();\r
-        List parts = StringRoutines.separateString(filter, ":");\r
-\r
-        if (parts.size()==2) {\r
-          addFilter( (String) parts.get(0), (String) parts.get(1));\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-  private static class LogEntry {\r
-    private String ipNumber;\r
-    private String browserString;\r
-    private String id;\r
-    private Date timeStamp;\r
-    private boolean isArticle;\r
-\r
-    public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) {\r
-      ipNumber = anIpNumber;\r
-      browserString = aBrowserString;\r
-      id = anId;\r
-      isArticle = anIsArticle;\r
-      timeStamp=aTimeStamp;\r
-    }\r
-\r
-    public String getIpNumber() {\r
-      return ipNumber;\r
-    }\r
-\r
-    public String getBrowserString() {\r
-      return browserString;\r
-    }\r
-\r
-    public String getId() {\r
-      return id;\r
-    }\r
-\r
-    public Date getTimeStamp() {\r
-      return timeStamp;\r
-    }\r
-\r
-    public boolean getIsArticle() {\r
-      return isArticle;\r
-    }\r
-  }\r
-\r
-  private void truncateLog() {\r
-    synchronized(log) {\r
-      if (!logEnabled)\r
-        log.clear();\r
-      else {\r
-        while (log.size()>0 && log.size()>logSize) {\r
-          log.remove(0);\r
-        }\r
-      }\r
-    }\r
-  };\r
-\r
-  private void appendLog(LogEntry anEntry) {\r
-    synchronized (log) {\r
-      if (logEnabled) {\r
-        log.add(anEntry);\r
-        truncateLog();\r
-      }\r
-    }\r
-  }\r
-\r
+package mircoders.global;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Vector;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.collections.ExtendedProperties;
+
+import gnu.regexp.RE;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.util.DateToMapAdapter;
+import mir.util.InternetFunctions;
+import mir.util.StringRoutines;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+
+
+public class Abuse {
+  private List filters;
+  private int maxIdentifier;
+  private LoggerWrapper logger;
+  private int logSize;
+  private boolean logEnabled;
+  private boolean openPostingDisabled;
+  private boolean openPostingPassword;
+  private boolean cookieOnBlock;
+  private String articleBlockAction;
+  private String commentBlockAction;
+  private List log;
+  private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config");
+
+
+  private static final String IP_FILTER_TYPE="ip";
+  private static final String REGEXP_FILTER_TYPE="regexp";
+  private static String cookieName=MirGlobal.config().getString("Abuse.CookieName");
+  private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge");
+
+  public Abuse() {
+    logger = new LoggerWrapper("Global.Abuse");
+    filters = new Vector();
+    maxIdentifier = 0;
+    log = new Vector();
+
+    logSize = 100;
+    logEnabled = false;
+    articleBlockAction = "";
+    commentBlockAction = "";
+    openPostingPassword = false;
+    openPostingDisabled = false;
+    cookieOnBlock = false;
+
+    load();
+  }
+
+  public boolean checkIpFilter(String anIpAddress) {
+    synchronized (filters) {
+      Iterator i = filters.iterator();
+
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+
+        try {
+          if ( (filter.getType().equals(IP_FILTER_TYPE)) &&
+              InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) {
+            logger.debug("ip match on " + filter.getExpression());
+            return true;
+          }
+        }
+        catch (Throwable t) {
+          logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage());
+        }
+      }
+
+      return false;
+    }
+  }
+
+  private boolean checkRegExpFilter(Entity anEntity) {
+    synchronized (filters) {
+      Iterator i = filters.iterator();
+
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+
+        if (filter.getType().equals(REGEXP_FILTER_TYPE)) {
+          try {
+            RE regularExpression = new RE(filter.getExpression());
+
+            Iterator j = anEntity.getFields().iterator();
+            while (j.hasNext()) {
+              String field = anEntity.getValue( (String) j.next());
+
+              if (field != null && regularExpression.isMatch(field.toLowerCase())) {
+                logger.debug("regexp match on " + filter.getExpression());
+                return true;
+              }
+            }
+          }
+          catch (Throwable t) {
+            logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage());
+          }
+        }
+      }
+
+      return false;
+    }
+  }
+
+  private void setCookie(HttpServletResponse aResponse) {
+    Random random = new Random();
+
+    Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000)));
+    cookie.setMaxAge(cookieMaxAge);
+    cookie.setPath("/");
+    aResponse.addCookie(cookie);
+  }
+
+  private boolean checkCookie(List aCookies) {
+    if (getCookieOnBlock()) {
+      Iterator i = aCookies.iterator();
+
+      while (i.hasNext()) {
+        Cookie cookie = (Cookie) i.next();
+
+        if (cookie.getName().equals(cookieName)) {
+          logger.debug("cookie match");
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+
+  public void checkComment(EntityComment aComment, HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    try {
+      long time = System.currentTimeMillis();
+
+      MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);
+
+      if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(aComment)) {
+        operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));
+        setCookie(aResponse);
+      }
+
+      logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms");
+
+    }
+    catch (Throwable t) {
+      logger.error("Abuse.checkComment: " + t.toString());
+    }
+  }
+
+  public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    try {
+      long time = System.currentTimeMillis();
+
+      MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);
+
+      if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) {
+        operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));
+        setCookie(aResponse);
+      }
+
+      logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms");
+    }
+    catch (Throwable t) {
+      logger.error("Abuse.checkArticle: " + t.toString());
+    }
+  }
+
+  public boolean getLogEnabled() {
+    return logEnabled;
+  }
+
+  public void setLogEnabled(boolean anEnabled) {
+    logEnabled = anEnabled;
+    truncateLog();
+  }
+
+  public int getLogSize() {
+    return logSize;
+  }
+
+  public void setLogSize(int aSize) {
+    logSize = aSize;
+    truncateLog();
+  }
+
+  public boolean getOpenPostingDisabled() {
+    return openPostingDisabled;
+  }
+
+  public void setOpenPostingDisabled(boolean anOpenPostingDisabled) {
+    openPostingDisabled = anOpenPostingDisabled;
+  }
+
+  public boolean getOpenPostingPassword() {
+    return openPostingPassword;
+  }
+
+  public void setOpenPostingPassword(boolean anOpenPostingPassword) {
+    openPostingPassword = anOpenPostingPassword;
+  }
+
+  public boolean getCookieOnBlock() {
+    return cookieOnBlock;
+  }
+
+  public void setCookieOnBlock(boolean aCookieOnBlock) {
+    cookieOnBlock = aCookieOnBlock;
+  }
+
+  public String getArticleBlockAction() {
+    return articleBlockAction;
+  }
+
+  public void setArticleBlockAction(String anAction) {
+    articleBlockAction = anAction;
+  }
+
+  public String getCommentBlockAction() {
+    return commentBlockAction;
+  }
+
+  public void setCommentBlockAction(String anAction) {
+    commentBlockAction = anAction;
+  }
+
+
+  public List getLog() {
+    synchronized(log) {
+      List result = new Vector();
+
+      Iterator i = log.iterator();
+      while (i.hasNext()) {
+        LogEntry logEntry = (LogEntry) i.next();
+        Map entry = new HashMap();
+
+        entry.put("ip", logEntry.getIpNumber());
+        entry.put("id", logEntry.getId());
+        entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp()));
+        if (logEntry.getIsArticle())
+          entry.put("type", "content");
+        else
+          entry.put("type", "comment");
+        entry.put("browser", logEntry.getBrowserString());
+
+        result.add(entry);
+      }
+
+      return result;
+    }
+  }
+
+  public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) {
+    appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false));
+  }
+
+  public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) {
+    appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true));
+  }
+
+  public void load() {
+    try {
+      ExtendedProperties configuration = new ExtendedProperties();
+
+      try {
+        configuration = new ExtendedProperties(configFile);
+      }
+      catch (FileNotFoundException e) {
+      }
+
+      getFilterConfig(filters, "abuse.filter", configuration);
+
+      setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));
+      setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));
+      setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));
+      setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));
+      setLogSize(configuration.getInt("abuse.logSize", 10));
+      setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));
+      setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.toString());
+    }
+  }
+  public void save() {
+    try {
+      ExtendedProperties configuration = new ExtendedProperties();
+
+      setFilterConfig(filters, "abuse.filter", configuration);
+
+      configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0");
+      configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0");
+      configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0");
+      configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0");
+      configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));
+      configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());
+      configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());
+
+      configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.toString());
+    }
+  }
+
+  public List getFilterTypes() {
+    List result = new Vector();
+
+    Map entry = new HashMap();
+    entry.put("resource", "abuse.filtertype.ip");
+    entry.put("id", IP_FILTER_TYPE);
+    result.add(entry);
+
+    entry = new HashMap();
+    entry.put("resource", "abuse.filtertype.regexp");
+    entry.put("id", REGEXP_FILTER_TYPE);
+    result.add(entry);
+
+    return result;
+  }
+
+  public List getArticleActions() {
+    try {
+      List result = new Vector();
+
+      Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator();
+      while (i.hasNext()) {
+        MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+        Map action = new HashMap();
+        action.put("resource", "content.operation."+operation.getName());
+        action.put("identifier", operation.getName());
+
+        result.add(action);
+      }
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new RuntimeException("can't get article actions");
+    }
+  }
+
+  public List getCommentActions() {
+    try {
+      List result = new Vector();
+
+      Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator();
+      while (i.hasNext()) {
+        MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+        Map action = new HashMap();
+        action.put("resource", "comment.operation."+operation.getName());
+        action.put("identifier", operation.getName());
+
+        result.add(action);
+      }
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new RuntimeException("can't get comment actions");
+    }
+  }
+
+  public List getFilters() {
+    return getFiltersAsMaps(filters);
+  }
+
+  public void addFilter(String aType, String anExpression) {
+    addFilter(filters, aType, anExpression);
+  }
+
+  public void setFilter(String anIdentifier, String aType, String anExpression) {
+    setFilter(filters, anIdentifier, aType, anExpression);
+  }
+
+  public void deleteFilter(String anIdentifier) {
+    deleteFilter(filters, anIdentifier);
+  }
+
+  public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception {
+  }
+
+  private List getFiltersAsMaps(List aFilters) {
+    synchronized(aFilters) {
+      List result = new Vector();
+
+      Iterator i = aFilters.iterator();
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+        Map map = new HashMap();
+
+        map.put("id", filter.getId());
+        map.put("expression", filter.getExpression());
+        map.put("type", filter.getType());
+
+        result.add(map);
+      }
+      return result;
+    }
+  }
+
+  private void addFilter(List aFilters, String aType, String anExpression) {
+    Filter filter = new Filter();
+
+    filter.setId(generateId());
+    filter.setExpression(anExpression);
+    filter.setType(aType);
+
+    synchronized (aFilters) {
+      aFilters.add(filter);
+    }
+  }
+
+  private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) {
+    synchronized (aFilters) {
+      Filter filter = findFilter(aFilters, anIdentifier);
+
+      if (filter!=null) {
+        filter.setExpression(anExpression);
+        filter.setType(aType);
+      }
+    }
+  }
+
+  private Filter findFilter(List aFilters, String anIdentifier) {
+    synchronized (aFilters) {
+      Iterator i = aFilters.iterator();
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+
+        if (filter.getId().equals(anIdentifier)) {
+          return filter;
+        }
+      }
+    }
+
+    return null;
+  }
+
+  private void deleteFilter(List aFilters, String anIdentifier) {
+    synchronized (aFilters) {
+      Filter filter = findFilter(aFilters, anIdentifier);
+
+      if (filter!=null) {
+        aFilters.remove(filter);
+      }
+    }
+  }
+
+  private String generateId() {
+    synchronized(this) {
+      maxIdentifier = maxIdentifier+1;
+
+      return Integer.toString(maxIdentifier);
+    }
+  }
+
+  private static class Filter {
+    private String identifier;
+    private String expression;
+    private String type;
+
+    public Filter() {
+      expression="";
+      type="";
+      identifier="";
+    }
+
+    public String getId() {
+      return identifier;
+    }
+
+    public void setId(String anId) {
+      identifier = anId;
+    }
+
+    public String getExpression() {
+      return expression;
+    }
+
+    public void setExpression(String anExpression) {
+      expression = anExpression;
+    }
+
+    public String getType() {
+      return type;
+    }
+
+    public void setType(String aType) {
+      type = aType;
+    }
+  }
+
+  private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {
+    synchronized(aFilters) {
+      Iterator i = aFilters.iterator();
+
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+
+        aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression());
+      }
+    }
+  }
+
+  private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {
+    synchronized(aFilters) {
+      aFilters.clear();
+
+      Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator();
+
+      while (i.hasNext()) {
+        String filter = (String) i.next();
+        List parts = StringRoutines.separateString(filter, ":");
+
+        if (parts.size()==2) {
+          addFilter( (String) parts.get(0), (String) parts.get(1));
+        }
+      }
+    }
+  }
+
+  private static class LogEntry {
+    private String ipNumber;
+    private String browserString;
+    private String id;
+    private Date timeStamp;
+    private boolean isArticle;
+
+    public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) {
+      ipNumber = anIpNumber;
+      browserString = aBrowserString;
+      id = anId;
+      isArticle = anIsArticle;
+      timeStamp=aTimeStamp;
+    }
+
+    public String getIpNumber() {
+      return ipNumber;
+    }
+
+    public String getBrowserString() {
+      return browserString;
+    }
+
+    public String getId() {
+      return id;
+    }
+
+    public Date getTimeStamp() {
+      return timeStamp;
+    }
+
+    public boolean getIsArticle() {
+      return isArticle;
+    }
+  }
+
+  private void truncateLog() {
+    synchronized(log) {
+      if (!logEnabled)
+        log.clear();
+      else {
+        while (log.size()>0 && log.size()>logSize) {
+          log.remove(0);
+        }
+      }
+    }
+  };
+
+  private void appendLog(LogEntry anEntry) {
+    synchronized (log) {
+      if (logEnabled) {
+        log.add(anEntry);
+        truncateLog();
+      }
+    }
+  }
+
 }
\ No newline at end of file
index 3b5994c..54c63c6 100755 (executable)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer;\r
-\r
-import mir.entity.adapter.EntityAdapterModel;\r
-\r
-public interface MirDataModelLocalizer {\r
-  public EntityAdapterModel adapterModel() throws MirLocalizerExc, MirLocalizerFailure;\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.localizer;
+
+import mir.entity.adapter.EntityAdapterModel;
+
+public interface MirDataModelLocalizer {
+  public EntityAdapterModel adapterModel() throws MirLocalizerExc, MirLocalizerFailure;
 }
\ No newline at end of file
index 9d7831d..74e1b3e 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
-import java.text.SimpleDateFormat;\r
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.misc.StringUtil;\r
-import mir.storage.StorageObjectFailure;\r
-import mir.util.StringRoutines;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.localizer.MirLocalizerExc;\r
-import mircoders.localizer.MirLocalizerFailure;\r
-import mircoders.storage.DatabaseContent;\r
-\r
-\r
-public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocalizer {\r
-  private Vector simpleCommentOperations;\r
-  private Vector simpleArticleOperations;\r
-  private Map simpleCommentOperationsMap;\r
-  private Map simpleArticleOperationsMap;\r
-  private static SimpleDateFormat dateFormatter = new SimpleDateFormat("dd.MM.yyyy HH:mm");\r
-\r
-  public MirBasicAdminInterfaceLocalizer() throws MirLocalizerFailure, MirLocalizerExc {\r
-    simpleCommentOperations = new Vector();\r
-    simpleArticleOperations = new Vector();\r
-    simpleCommentOperationsMap = new HashMap();\r
-    simpleArticleOperationsMap = new HashMap();\r
-\r
-    addSimpleArticleOperation(new ChangeArticleFieldOperation("newswire", "to_article_type", "0", "1", false));\r
-    addSimpleArticleOperation(new ModifyArticleFieldOperation("unhide", "is_published", "1", false));\r
-    addSimpleArticleOperation(new ModifyArticleFieldOperation("hide", "is_published", "0", false));\r
-\r
-    addSimpleCommentOperation(new ModifyCommentFieldOperation("unhide", "is_published", "1"));\r
-    addSimpleCommentOperation(new ModifyCommentFieldOperation("hide", "is_published", "0"));\r
-  }\r
-\r
-  public String makePasswordDigest(String aPassword) {\r
-    return aPassword;\r
-  }\r
-\r
-  public void initializeArticle(Map anArticle) {\r
-    anArticle.put("is_published", "0");\r
-    anArticle.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));\r
-  };\r
-\r
-  public List simpleCommentOperations() {\r
-    return simpleCommentOperations;\r
-  };\r
-\r
-  public List simpleArticleOperations() {\r
-    return simpleArticleOperations;\r
-  };\r
-\r
-  public MirSimpleEntityOperation simpleArticleOperationForName(String aName) {\r
-    return (MirSimpleEntityOperation) simpleArticleOperationsMap.get(aName);\r
-  };\r
-\r
-  public MirSimpleEntityOperation simpleCommentOperationForName(String aName) {\r
-    return (MirSimpleEntityOperation) simpleCommentOperationsMap.get(aName);\r
-  };\r
-\r
-  public void removeSimpleArticleOperation(String aName) {\r
-    simpleArticleOperations.remove(simpleArticleOperationsMap.get(aName));\r
-    simpleArticleOperationsMap.remove(aName);\r
-  }\r
-\r
-  public void addSimpleArticleOperation(MirSimpleEntityOperation anOperation) {\r
-    removeSimpleArticleOperation(anOperation.getName());\r
-    simpleArticleOperationsMap.put(anOperation.getName(), anOperation);\r
-    simpleArticleOperations.add(anOperation);\r
-  }\r
-\r
-  public void removeSimpleCommentOperation(String aName) {\r
-    simpleCommentOperations.remove(simpleCommentOperationsMap.get(aName));\r
-    simpleCommentOperationsMap.remove(aName);\r
-  }\r
-\r
-  public void addSimpleCommentOperation(MirSimpleEntityOperation anOperation) {\r
-    removeSimpleCommentOperation(anOperation.getName());\r
-    simpleCommentOperationsMap.put(anOperation.getName(), anOperation);\r
-    simpleCommentOperations.add(anOperation);\r
-  }\r
-\r
-  protected abstract static class EntityModifyingOperation implements MirSimpleEntityOperation {\r
-    private String name;\r
-\r
-    protected EntityModifyingOperation(String aName) {\r
-      name = aName;\r
-    }\r
-\r
-    public String getName() {\r
-      return name;\r
-    };\r
-\r
-    public boolean isAvailable(EntityAdapter anEntity) {\r
-      try {\r
-        Entity entity = anEntity.getEntity();\r
-        return isAvailable(entity);\r
-      }\r
-      catch (Throwable t) {\r
-        return false;\r
-      }\r
-    };\r
-\r
-    public void perform(EntityAdapter aUser, EntityAdapter anEntity) {\r
-      Entity entity = anEntity.getEntity();\r
-      try {\r
-        performModification(aUser, entity);\r
-        entity.update();\r
-      }\r
-      catch (Throwable t) {\r
-      }\r
-    };\r
-\r
-    protected abstract boolean isAvailable(Entity anEntity) throws StorageObjectFailure ;\r
-    protected abstract void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure ;\r
-  }\r
-\r
-  public static abstract class CommentModifyingOperation extends EntityModifyingOperation {\r
-    public CommentModifyingOperation(String aName) {\r
-      super(aName);\r
-    }\r
-\r
-    protected boolean isAvailable(Entity anEntity) throws StorageObjectFailure {\r
-      return anEntity instanceof EntityComment && isAvailable((EntityComment) anEntity);\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {\r
-      performModification(aUser, (EntityComment) anEntity);\r
-      DatabaseContent.getInstance().setUnproduced("id="+anEntity.getValue("to_media"));\r
-    };\r
-\r
-    protected abstract boolean isAvailable(EntityComment aComment) throws StorageObjectFailure ;\r
-    protected abstract void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure ;\r
-  }\r
-\r
-  public static abstract class ArticleModifyingOperation extends EntityModifyingOperation {\r
-    private boolean logOperation;\r
-\r
-    public ArticleModifyingOperation(String aName, boolean aLogOperation) {\r
-      super(aName);\r
-\r
-      logOperation = aLogOperation;\r
-    }\r
-\r
-    protected boolean isAvailable(Entity anEntity) throws StorageObjectFailure {\r
-      return anEntity instanceof EntityContent && isAvailable((EntityContent) anEntity);\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {\r
-      performModification(aUser, (EntityContent) anEntity);\r
-      anEntity.setValueForProperty("is_produced", "0");\r
-\r
-      if (logOperation) {\r
-        StringBuffer comment = new StringBuffer();\r
-        try {\r
-          comment.append(StringRoutines.interpretAsString(anEntity.getValue("comment")));\r
-        }\r
-        catch (Throwable t) {\r
-        }\r
-        if (comment.length()>0 && comment.charAt(comment.length()-1)!='\n') {\r
-          comment.append('\n');\r
-        }\r
-        comment.append(dateFormatter.format((new GregorianCalendar()).getTime()));\r
-        comment.append(" ");\r
-        try {\r
-          comment.append(StringRoutines.interpretAsString(aUser.get("login")));\r
-        }\r
-        catch (Throwable t) {\r
-        }\r
-        comment.append(" ");\r
-        comment.append(getName());\r
-        anEntity.setValueForProperty("comment", comment.toString());\r
-      }\r
-    };\r
-\r
-    protected abstract boolean isAvailable(EntityContent anArticle) throws StorageObjectFailure ;\r
-    protected abstract void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure ;\r
-  }\r
-\r
-  protected static class SetCommentFieldOperation extends CommentModifyingOperation {\r
-    private String field;\r
-    private String value;\r
-\r
-    public SetCommentFieldOperation(String aName, String aField, String aValue) {\r
-      super(aName);\r
-\r
-      field = aField;\r
-      value = aValue;\r
-    }\r
-\r
-    protected boolean isAvailable(EntityComment aComment) {\r
-      return true;\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {\r
-      aComment.setValueForProperty(field, value);\r
-    }\r
-  }\r
-\r
-  protected static class ModifyCommentFieldOperation extends CommentModifyingOperation {\r
-    private String field;\r
-    private String value;\r
-\r
-    public ModifyCommentFieldOperation(String aName, String aField, String aValue) {\r
-      super(aName);\r
-\r
-      field = aField;\r
-      value = aValue;\r
-    }\r
-\r
-    protected boolean isAvailable(EntityComment aComment) {\r
-      return aComment.getValue(field) == null || !aComment.getValue(field).equals(value);\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {\r
-      aComment.setValueForProperty(field, value);\r
-    }\r
-  }\r
-\r
-  protected static class SetArticleFieldOperation extends ArticleModifyingOperation {\r
-    private String field;\r
-    private String value;\r
-\r
-    public SetArticleFieldOperation(String aName, String aField, String aValue, boolean aLogOperation) {\r
-      super(aName, aLogOperation);\r
-\r
-      field = aField;\r
-      value = aValue;\r
-    }\r
-\r
-    protected boolean isAvailable(EntityContent anArticle) {\r
-      return true;\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {\r
-      anArticle.setValueForProperty(field, value);\r
-    }\r
-  }\r
-\r
-  protected static class ModifyArticleFieldOperation extends ArticleModifyingOperation {\r
-    private String field;\r
-    private String value;\r
-\r
-    public ModifyArticleFieldOperation(String aName, String aField, String aValue, boolean aLogOperation) {\r
-      super(aName, aLogOperation);\r
-\r
-      field = aField;\r
-      value = aValue;\r
-    }\r
-\r
-    protected boolean isAvailable(EntityContent anArticle) {\r
-      return anArticle.getValue(field) == null || !anArticle.getValue(field).equals(value);\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {\r
-      anArticle.setValueForProperty(field, value);\r
-    }\r
-  }\r
-\r
-  protected static class ChangeArticleFieldOperation extends ArticleModifyingOperation {\r
-    private String field;\r
-    private String oldValue;\r
-    private String newValue;\r
-\r
-    public ChangeArticleFieldOperation(String aName, String aField, String anOldValue, String aNewValue, boolean aLogOperation) {\r
-      super(aName, aLogOperation);\r
-\r
-      field = aField;\r
-      newValue = aNewValue;\r
-      oldValue = anOldValue;\r
-    }\r
-\r
-    protected boolean isAvailable(EntityContent anArticle) {\r
-      return anArticle.getValue(field) != null && anArticle.getValue(field).equals(oldValue);\r
-    }\r
-\r
-    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {\r
-      anArticle.setValueForProperty(field, newValue);\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.localizer.basic;
+
+import java.text.SimpleDateFormat;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.entity.Entity;
+import mir.entity.adapter.EntityAdapter;
+import mir.misc.StringUtil;
+import mir.storage.StorageObjectFailure;
+import mir.util.StringRoutines;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.localizer.MirLocalizerExc;
+import mircoders.localizer.MirLocalizerFailure;
+import mircoders.storage.DatabaseContent;
+
+
+public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocalizer {
+  private Vector simpleCommentOperations;
+  private Vector simpleArticleOperations;
+  private Map simpleCommentOperationsMap;
+  private Map simpleArticleOperationsMap;
+  private static SimpleDateFormat dateFormatter = new SimpleDateFormat("dd.MM.yyyy HH:mm");
+
+  public MirBasicAdminInterfaceLocalizer() throws MirLocalizerFailure, MirLocalizerExc {
+    simpleCommentOperations = new Vector();
+    simpleArticleOperations = new Vector();
+    simpleCommentOperationsMap = new HashMap();
+    simpleArticleOperationsMap = new HashMap();
+
+    addSimpleArticleOperation(new ChangeArticleFieldOperation("newswire", "to_article_type", "0", "1", false));
+    addSimpleArticleOperation(new ModifyArticleFieldOperation("unhide", "is_published", "1", false));
+    addSimpleArticleOperation(new ModifyArticleFieldOperation("hide", "is_published", "0", false));
+
+    addSimpleCommentOperation(new ModifyCommentFieldOperation("unhide", "is_published", "1"));
+    addSimpleCommentOperation(new ModifyCommentFieldOperation("hide", "is_published", "0"));
+  }
+
+  public String makePasswordDigest(String aPassword) {
+    return aPassword;
+  }
+
+  public void initializeArticle(Map anArticle) {
+    anArticle.put("is_published", "0");
+    anArticle.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+  };
+
+  public List simpleCommentOperations() {
+    return simpleCommentOperations;
+  };
+
+  public List simpleArticleOperations() {
+    return simpleArticleOperations;
+  };
+
+  public MirSimpleEntityOperation simpleArticleOperationForName(String aName) {
+    return (MirSimpleEntityOperation) simpleArticleOperationsMap.get(aName);
+  };
+
+  public MirSimpleEntityOperation simpleCommentOperationForName(String aName) {
+    return (MirSimpleEntityOperation) simpleCommentOperationsMap.get(aName);
+  };
+
+  public void removeSimpleArticleOperation(String aName) {
+    simpleArticleOperations.remove(simpleArticleOperationsMap.get(aName));
+    simpleArticleOperationsMap.remove(aName);
+  }
+
+  public void addSimpleArticleOperation(MirSimpleEntityOperation anOperation) {
+    removeSimpleArticleOperation(anOperation.getName());
+    simpleArticleOperationsMap.put(anOperation.getName(), anOperation);
+    simpleArticleOperations.add(anOperation);
+  }
+
+  public void removeSimpleCommentOperation(String aName) {
+    simpleCommentOperations.remove(simpleCommentOperationsMap.get(aName));
+    simpleCommentOperationsMap.remove(aName);
+  }
+
+  public void addSimpleCommentOperation(MirSimpleEntityOperation anOperation) {
+    removeSimpleCommentOperation(anOperation.getName());
+    simpleCommentOperationsMap.put(anOperation.getName(), anOperation);
+    simpleCommentOperations.add(anOperation);
+  }
+
+  protected abstract static class EntityModifyingOperation implements MirSimpleEntityOperation {
+    private String name;
+
+    protected EntityModifyingOperation(String aName) {
+      name = aName;
+    }
+
+    public String getName() {
+      return name;
+    };
+
+    public boolean isAvailable(EntityAdapter anEntity) {
+      try {
+        Entity entity = anEntity.getEntity();
+        return isAvailable(entity);
+      }
+      catch (Throwable t) {
+        return false;
+      }
+    };
+
+    public void perform(EntityAdapter aUser, EntityAdapter anEntity) {
+      Entity entity = anEntity.getEntity();
+      try {
+        performModification(aUser, entity);
+        entity.update();
+      }
+      catch (Throwable t) {
+      }
+    };
+
+    protected abstract boolean isAvailable(Entity anEntity) throws StorageObjectFailure ;
+    protected abstract void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure ;
+  }
+
+  public static abstract class CommentModifyingOperation extends EntityModifyingOperation {
+    public CommentModifyingOperation(String aName) {
+      super(aName);
+    }
+
+    protected boolean isAvailable(Entity anEntity) throws StorageObjectFailure {
+      return anEntity instanceof EntityComment && isAvailable((EntityComment) anEntity);
+    }
+
+    protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
+      performModification(aUser, (EntityComment) anEntity);
+      DatabaseContent.getInstance().setUnproduced("id="+anEntity.getValue("to_media"));
+    };
+
+    protected abstract boolean isAvailable(EntityComment aComment) throws StorageObjectFailure ;
+    protected abstract void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure ;
+  }
+
+  public static abstract class ArticleModifyingOperation extends EntityModifyingOperation {
+    private boolean logOperation;
+
+    public ArticleModifyingOperation(String aName, boolean aLogOperation) {
+      super(aName);
+
+      logOperation = aLogOperation;
+    }
+
+    protected boolean isAvailable(Entity anEntity) throws StorageObjectFailure {
+      return anEntity instanceof EntityContent && isAvailable((EntityContent) anEntity);
+    }
+
+    protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
+      performModification(aUser, (EntityContent) anEntity);
+      anEntity.setValueForProperty("is_produced", "0");
+
+      if (logOperation) {
+        StringBuffer comment = new StringBuffer();
+        try {
+          comment.append(StringRoutines.interpretAsString(anEntity.getValue("comment")));
+        }
+        catch (Throwable t) {
+        }
+        if (comment.length()>0 && comment.charAt(comment.length()-1)!='\n') {
+          comment.append('\n');
+        }
+        comment.append(dateFormatter.format((new GregorianCalendar()).getTime()));
+        comment.append(" ");
+        try {
+          comment.append(StringRoutines.interpretAsString(aUser.get("login")));
+        }
+        catch (Throwable t) {
+        }
+        comment.append(" ");
+        comment.append(getName());
+        anEntity.setValueForProperty("comment", comment.toString());
+      }
+    };
+
+    protected abstract boolean isAvailable(EntityContent anArticle) throws StorageObjectFailure ;
+    protected abstract void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure ;
+  }
+
+  protected static class SetCommentFieldOperation extends CommentModifyingOperation {
+    private String field;
+    private String value;
+
+    public SetCommentFieldOperation(String aName, String aField, String aValue) {
+      super(aName);
+
+      field = aField;
+      value = aValue;
+    }
+
+    protected boolean isAvailable(EntityComment aComment) {
+      return true;
+    }
+
+    protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {
+      aComment.setValueForProperty(field, value);
+    }
+  }
+
+  protected static class ModifyCommentFieldOperation extends CommentModifyingOperation {
+    private String field;
+    private String value;
+
+    public ModifyCommentFieldOperation(String aName, String aField, String aValue) {
+      super(aName);
+
+      field = aField;
+      value = aValue;
+    }
+
+    protected boolean isAvailable(EntityComment aComment) {
+      return aComment.getValue(field) == null || !aComment.getValue(field).equals(value);
+    }
+
+    protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {
+      aComment.setValueForProperty(field, value);
+    }
+  }
+
+  protected static class SetArticleFieldOperation extends ArticleModifyingOperation {
+    private String field;
+    private String value;
+
+    public SetArticleFieldOperation(String aName, String aField, String aValue, boolean aLogOperation) {
+      super(aName, aLogOperation);
+
+      field = aField;
+      value = aValue;
+    }
+
+    protected boolean isAvailable(EntityContent anArticle) {
+      return true;
+    }
+
+    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
+      anArticle.setValueForProperty(field, value);
+    }
+  }
+
+  protected static class ModifyArticleFieldOperation extends ArticleModifyingOperation {
+    private String field;
+    private String value;
+
+    public ModifyArticleFieldOperation(String aName, String aField, String aValue, boolean aLogOperation) {
+      super(aName, aLogOperation);
+
+      field = aField;
+      value = aValue;
+    }
+
+    protected boolean isAvailable(EntityContent anArticle) {
+      return anArticle.getValue(field) == null || !anArticle.getValue(field).equals(value);
+    }
+
+    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
+      anArticle.setValueForProperty(field, value);
+    }
+  }
+
+  protected static class ChangeArticleFieldOperation extends ArticleModifyingOperation {
+    private String field;
+    private String oldValue;
+    private String newValue;
+
+    public ChangeArticleFieldOperation(String aName, String aField, String anOldValue, String aNewValue, boolean aLogOperation) {
+      super(aName, aLogOperation);
+
+      field = aField;
+      newValue = aNewValue;
+      oldValue = anOldValue;
+    }
+
+    protected boolean isAvailable(EntityContent anArticle) {
+      return anArticle.getValue(field) != null && anArticle.getValue(field).equals(oldValue);
+    }
+
+    protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
+      anArticle.setValueForProperty(field, newValue);
+    }
+  }
+}
index fd9bf47..859da23 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.entity.adapter.EntityAdapterDefinition;\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaHelper;\r
-import mir.media.MirMedia;\r
-import mir.util.RewindableIterator;\r
-import mircoders.entity.EntityUploadedMedia;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.localizer.MirDataModelLocalizer;\r
-import mircoders.localizer.MirLocalizerFailure;\r
-import mircoders.storage.DatabaseArticleType;\r
-import mircoders.storage.DatabaseAudio;\r
-import mircoders.storage.DatabaseBreaking;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseCommentStatus;\r
-import mircoders.storage.DatabaseContent;\r
-import mircoders.storage.DatabaseImageType;\r
-import mircoders.storage.DatabaseImages;\r
-import mircoders.storage.DatabaseLanguage;\r
-import mircoders.storage.DatabaseMedia;\r
-import mircoders.storage.DatabaseMediaType;\r
-import mircoders.storage.DatabaseMediafolder;\r
-import mircoders.storage.DatabaseMessages;\r
-import mircoders.storage.DatabaseOther;\r
-import mircoders.storage.DatabaseTopics;\r
-import mircoders.storage.DatabaseUploadedMedia;\r
-import mircoders.storage.DatabaseUsers;\r
-import mircoders.storage.DatabaseVideo;\r
-\r
-public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {\r
-  private EntityAdapterModel model;\r
-  protected LoggerWrapper logger;\r
-\r
-  public MirBasicDataModelLocalizer() {\r
-    model=null;\r
-    logger = new LoggerWrapper("Localizer.DataModel");\r
-  }\r
-\r
-  public EntityAdapterModel adapterModel() throws MirLocalizerFailure {\r
-    if (model==null)\r
-      model = buildModel();\r
-\r
-    return model;\r
-  };\r
-\r
-  protected void constructContentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {\r
-    try {\r
-      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create");\r
-      anEntityAdapterDefinition.addDBDateField("changedate", "webdb_lastchange");\r
-      anEntityAdapterDefinition.addMirDateField("date", "date");\r
-      anEntityAdapterDefinition.addCalculatedField("to_topics", new ContentToTopicsField());\r
-      anEntityAdapterDefinition.addCalculatedField("to_comments", new ContentToCommentsField());\r
-      anEntityAdapterDefinition.addCalculatedField("language", new ContentToLanguageField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("commentcount", new ContentCommentCountField(" and is_published='1'"));\r
-      anEntityAdapterDefinition.addCalculatedField("fullcommentcount", new ContentCommentCountField(""));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new ContentToMediaField( "image" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new ContentToMediaField( "uploadedMedia" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new ContentToMediaField( "audio" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_video", new ContentToMediaField( "video" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_other", new ContentToMediaField( "otherMedia" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_icon", new ContentToIconField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("article_type", new ContentToArticleTypeField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));\r
-      anEntityAdapterDefinition.addCalculatedField("content_data_parsed", new FilteredField("content_data"));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("children", new ContentToChildrenField());\r
-      anEntityAdapterDefinition.addCalculatedField("parent", new ContentToParentField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("operations",\r
-          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleArticleOperations()));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-  protected void constructCommentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {\r
-    try {\r
-      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create");\r
-      anEntityAdapterDefinition.addCalculatedField("to_content", new CommentToContentField());\r
-      anEntityAdapterDefinition.addCalculatedField("status", new CommentToStatusField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));\r
-      anEntityAdapterDefinition.addCalculatedField("operations",\r
-          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleCommentOperations()));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-  protected EntityAdapterModel buildModel() throws MirLocalizerFailure {\r
-    EntityAdapterModel result = new EntityAdapterModel();\r
-\r
-    try {\r
-      EntityAdapterDefinition definition;\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      constructContentAdapterDefinition( definition );\r
-      result.addMapping( "content", DatabaseContent.getInstance(), definition);\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      constructCommentAdapterDefinition( definition );\r
-      result.addMapping( "comment", DatabaseComment.getInstance(), definition);\r
-\r
-      result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addDBDateField("creationdate", "webdb_create");\r
-      result.addMapping( "breakingNews", DatabaseBreaking.getInstance(), definition);\r
-\r
-      result.addMapping( "imageType", DatabaseImageType.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "language", DatabaseLanguage.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "mediaFolder", DatabaseMediafolder.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "internalMessage", DatabaseMessages.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "topic", DatabaseTopics.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "user", DatabaseUsers.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "media", DatabaseMedia.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "uploadedMedia", DatabaseUploadedMedia.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "image", DatabaseImages.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "audio", DatabaseAudio.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "video", DatabaseVideo.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "otherMedia", DatabaseOther.getInstance(), new EntityAdapterDefinition());\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  protected class CommentToContentField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_media"),\r
-                    "id",\r
-                    "content" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class CommentToStatusField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_comment_status"),\r
-                    "id",\r
-                    "commentStatus" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class EntityToSimpleOperationsField implements EntityAdapterDefinition.CalculatedField {\r
-    private List operations;\r
-\r
-    public EntityToSimpleOperationsField(List anOperations) {\r
-      operations = anOperations;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        Iterator i = operations.iterator();\r
-        List availableOperations = new Vector();\r
-\r
-        while (i.hasNext()) {\r
-          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
-          if (operation.isAvailable(anEntityAdapter)) {\r
-            availableOperations.add(operation.getName());\r
-          }\r
-        };\r
-\r
-        return availableOperations;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class FilteredField implements EntityAdapterDefinition.CalculatedField {\r
-    String fieldName;\r
-\r
-    public FilteredField(String aFieldName) {\r
-      fieldName = aFieldName;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        if (anEntityAdapter.get("is_html")!=null && anEntityAdapter.get("is_html").equals("1")) {\r
-          return anEntityAdapter.get(fieldName);\r
-        }\r
-        else {\r
-          return MirGlobal.localizer().producerAssistant().filterText((String) anEntityAdapter.get(fieldName));\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToParentField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        logger.debug("ContentToParentField.getValue");\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_content"),\r
-                    "id",\r
-                    "content" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToChildrenField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "to_content="+anEntityAdapter.get("id"),\r
-                    "id",\r
-                    "content" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToLanguageField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_language"),\r
-                    "id",\r
-                    "language" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToArticleTypeField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_article_type"),\r
-                    "id",\r
-                    "articleType" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToCommentsField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "to_media="+anEntityAdapter.get("id")+" and is_published='1'",\r
-                    "webdb_create",\r
-                    "comment" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToTopicsField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "exists (select * from content_x_topic where content_id="+anEntityAdapter.get("id")+" and topic_id=id)",\r
-                    "title",\r
-                    "topic" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToMediaField implements EntityAdapterDefinition.CalculatedField {\r
-    String definition;\r
-\r
-    public ContentToMediaField(String aDefinition) {\r
-      definition = aDefinition;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-          "is_published='t' and exists (select * from content_x_media where content_id="+anEntityAdapter.get("id")+" and media_id=id)",\r
-          "id",\r
-          definition);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToIconField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      EntityAdapter media;\r
-      Entity mediaType;\r
-      RewindableIterator iterator;\r
-      Map result;\r
-      MirMedia mediaHandler;\r
-      String tinyIcon;\r
-      String iconAlt;\r
-\r
-      try {\r
-        iterator = (RewindableIterator) (anEntityAdapter.get("to_uploaded_media"));\r
-        iterator.rewind();\r
-\r
-        tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyText");\r
-        iconAlt = "Text";\r
-\r
-        if (iterator.hasNext()) {\r
-          media = (EntityAdapter) iterator.next();\r
-\r
-          mediaType = ((EntityUploadedMedia) (media.getEntity())).getMediaType();\r
-          mediaHandler = MediaHelper.getHandler( mediaType );\r
-\r
-          if (mediaHandler.isVideo()) {\r
-            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyVideo");\r
-            iconAlt = "Video";\r
-          }\r
-          else if (mediaHandler.isAudio()) {\r
-            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyAudio");\r
-            iconAlt = "Audio";\r
-          }\r
-          else if (mediaHandler.isImage()) {\r
-            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyImage");\r
-            iconAlt = "Image";\r
-          }\r
-          else {\r
-            tinyIcon = mediaHandler.getTinyIconName();\r
-            iconAlt = mediaHandler.getIconAltName();\r
-          }\r
-\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        logger.error("ContentToIconField: " +t.getMessage());\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-\r
-      result = new HashMap();\r
-      result.put("tiny_icon", MirGlobal.config().getString("Producer.ImageRoot") + "/" + tinyIcon);\r
-      result.put("icon_alt", iconAlt);\r
-\r
-      return result;\r
-    }\r
-  }\r
-\r
-  protected class ContentCommentCountField implements EntityAdapterDefinition.CalculatedField {\r
-    private String extraCondition;\r
-\r
-    public ContentCommentCountField(String anExtraCondition) {\r
-      super();\r
-\r
-      extraCondition = anExtraCondition;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return Integer.toString(\r
-            DatabaseComment.getInstance().getSize(\r
-                  "to_media="+anEntityAdapter.get("id")+" " + extraCondition));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.localizer.basic;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.entity.Entity;
+import mir.entity.adapter.EntityAdapter;
+import mir.entity.adapter.EntityAdapterDefinition;
+import mir.entity.adapter.EntityAdapterModel;
+import mir.log.LoggerWrapper;
+import mir.media.MediaHelper;
+import mir.media.MirMedia;
+import mir.util.RewindableIterator;
+import mircoders.entity.EntityUploadedMedia;
+import mircoders.global.MirGlobal;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.localizer.MirDataModelLocalizer;
+import mircoders.localizer.MirLocalizerFailure;
+import mircoders.storage.DatabaseArticleType;
+import mircoders.storage.DatabaseAudio;
+import mircoders.storage.DatabaseBreaking;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseCommentStatus;
+import mircoders.storage.DatabaseContent;
+import mircoders.storage.DatabaseImageType;
+import mircoders.storage.DatabaseImages;
+import mircoders.storage.DatabaseLanguage;
+import mircoders.storage.DatabaseMedia;
+import mircoders.storage.DatabaseMediaType;
+import mircoders.storage.DatabaseMediafolder;
+import mircoders.storage.DatabaseMessages;
+import mircoders.storage.DatabaseOther;
+import mircoders.storage.DatabaseTopics;
+import mircoders.storage.DatabaseUploadedMedia;
+import mircoders.storage.DatabaseUsers;
+import mircoders.storage.DatabaseVideo;
+
+public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
+  private EntityAdapterModel model;
+  protected LoggerWrapper logger;
+
+  public MirBasicDataModelLocalizer() {
+    model=null;
+    logger = new LoggerWrapper("Localizer.DataModel");
+  }
+
+  public EntityAdapterModel adapterModel() throws MirLocalizerFailure {
+    if (model==null)
+      model = buildModel();
+
+    return model;
+  };
+
+  protected void constructContentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {
+    try {
+      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create");
+      anEntityAdapterDefinition.addDBDateField("changedate", "webdb_lastchange");
+      anEntityAdapterDefinition.addMirDateField("date", "date");
+      anEntityAdapterDefinition.addCalculatedField("to_topics", new ContentToTopicsField());
+      anEntityAdapterDefinition.addCalculatedField("to_comments", new ContentToCommentsField());
+      anEntityAdapterDefinition.addCalculatedField("language", new ContentToLanguageField());
+
+      anEntityAdapterDefinition.addCalculatedField("commentcount", new ContentCommentCountField(" and is_published='1'"));
+      anEntityAdapterDefinition.addCalculatedField("fullcommentcount", new ContentCommentCountField(""));
+
+      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new ContentToMediaField( "image" ));
+      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new ContentToMediaField( "uploadedMedia" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new ContentToMediaField( "audio" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_video", new ContentToMediaField( "video" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_other", new ContentToMediaField( "otherMedia" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_icon", new ContentToIconField());
+
+      anEntityAdapterDefinition.addCalculatedField("article_type", new ContentToArticleTypeField());
+
+      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));
+      anEntityAdapterDefinition.addCalculatedField("content_data_parsed", new FilteredField("content_data"));
+
+      anEntityAdapterDefinition.addCalculatedField("children", new ContentToChildrenField());
+      anEntityAdapterDefinition.addCalculatedField("parent", new ContentToParentField());
+
+      anEntityAdapterDefinition.addCalculatedField("operations",
+          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleArticleOperations()));
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+  }
+
+  protected void constructCommentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {
+    try {
+      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create");
+      anEntityAdapterDefinition.addCalculatedField("to_content", new CommentToContentField());
+      anEntityAdapterDefinition.addCalculatedField("status", new CommentToStatusField());
+
+      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));
+      anEntityAdapterDefinition.addCalculatedField("operations",
+          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleCommentOperations()));
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+  }
+
+  protected EntityAdapterModel buildModel() throws MirLocalizerFailure {
+    EntityAdapterModel result = new EntityAdapterModel();
+
+    try {
+      EntityAdapterDefinition definition;
+
+      definition = new EntityAdapterDefinition();
+      constructContentAdapterDefinition( definition );
+      result.addMapping( "content", DatabaseContent.getInstance(), definition);
+
+      definition = new EntityAdapterDefinition();
+      constructCommentAdapterDefinition( definition );
+      result.addMapping( "comment", DatabaseComment.getInstance(), definition);
+
+      result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());
+
+      definition = new EntityAdapterDefinition();
+      definition.addDBDateField("creationdate", "webdb_create");
+      result.addMapping( "breakingNews", DatabaseBreaking.getInstance(), definition);
+
+      result.addMapping( "imageType", DatabaseImageType.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "language", DatabaseLanguage.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "mediaFolder", DatabaseMediafolder.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "internalMessage", DatabaseMessages.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "topic", DatabaseTopics.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "user", DatabaseUsers.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "media", DatabaseMedia.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "uploadedMedia", DatabaseUploadedMedia.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "image", DatabaseImages.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "audio", DatabaseAudio.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "video", DatabaseVideo.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "otherMedia", DatabaseOther.getInstance(), new EntityAdapterDefinition());
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+
+    return result;
+  }
+
+  protected class CommentToContentField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_media"),
+                    "id",
+                    "content" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class CommentToStatusField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_comment_status"),
+                    "id",
+                    "commentStatus" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class EntityToSimpleOperationsField implements EntityAdapterDefinition.CalculatedField {
+    private List operations;
+
+    public EntityToSimpleOperationsField(List anOperations) {
+      operations = anOperations;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        Iterator i = operations.iterator();
+        List availableOperations = new Vector();
+
+        while (i.hasNext()) {
+          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+          if (operation.isAvailable(anEntityAdapter)) {
+            availableOperations.add(operation.getName());
+          }
+        };
+
+        return availableOperations;
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class FilteredField implements EntityAdapterDefinition.CalculatedField {
+    String fieldName;
+
+    public FilteredField(String aFieldName) {
+      fieldName = aFieldName;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        if (anEntityAdapter.get("is_html")!=null && anEntityAdapter.get("is_html").equals("1")) {
+          return anEntityAdapter.get(fieldName);
+        }
+        else {
+          return MirGlobal.localizer().producerAssistant().filterText((String) anEntityAdapter.get(fieldName));
+        }
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToParentField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        logger.debug("ContentToParentField.getValue");
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_content"),
+                    "id",
+                    "content" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToChildrenField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "to_content="+anEntityAdapter.get("id"),
+                    "id",
+                    "content" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToLanguageField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_language"),
+                    "id",
+                    "language" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToArticleTypeField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_article_type"),
+                    "id",
+                    "articleType" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToCommentsField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "to_media="+anEntityAdapter.get("id")+" and is_published='1'",
+                    "webdb_create",
+                    "comment" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToTopicsField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "exists (select * from content_x_topic where content_id="+anEntityAdapter.get("id")+" and topic_id=id)",
+                    "title",
+                    "topic" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToMediaField implements EntityAdapterDefinition.CalculatedField {
+    String definition;
+
+    public ContentToMediaField(String aDefinition) {
+      definition = aDefinition;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+          "is_published='t' and exists (select * from content_x_media where content_id="+anEntityAdapter.get("id")+" and media_id=id)",
+          "id",
+          definition);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToIconField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      EntityAdapter media;
+      Entity mediaType;
+      RewindableIterator iterator;
+      Map result;
+      MirMedia mediaHandler;
+      String tinyIcon;
+      String iconAlt;
+
+      try {
+        iterator = (RewindableIterator) (anEntityAdapter.get("to_uploaded_media"));
+        iterator.rewind();
+
+        tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyText");
+        iconAlt = "Text";
+
+        if (iterator.hasNext()) {
+          media = (EntityAdapter) iterator.next();
+
+          mediaType = ((EntityUploadedMedia) (media.getEntity())).getMediaType();
+          mediaHandler = MediaHelper.getHandler( mediaType );
+
+          if (mediaHandler.isVideo()) {
+            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyVideo");
+            iconAlt = "Video";
+          }
+          else if (mediaHandler.isAudio()) {
+            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyAudio");
+            iconAlt = "Audio";
+          }
+          else if (mediaHandler.isImage()) {
+            tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyImage");
+            iconAlt = "Image";
+          }
+          else {
+            tinyIcon = mediaHandler.getTinyIconName();
+            iconAlt = mediaHandler.getIconAltName();
+          }
+
+        }
+      }
+      catch (Throwable t) {
+        logger.error("ContentToIconField: " +t.getMessage());
+        throw new RuntimeException(t.getMessage());
+      }
+
+      result = new HashMap();
+      result.put("tiny_icon", MirGlobal.config().getString("Producer.ImageRoot") + "/" + tinyIcon);
+      result.put("icon_alt", iconAlt);
+
+      return result;
+    }
+  }
+
+  protected class ContentCommentCountField implements EntityAdapterDefinition.CalculatedField {
+    private String extraCondition;
+
+    public ContentCommentCountField(String anExtraCondition) {
+      super();
+
+      extraCondition = anExtraCondition;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return Integer.toString(
+            DatabaseComment.getInstance().getSize(
+                  "to_media="+anEntityAdapter.get("id")+" " + extraCondition));
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+}
index 6c9720f..625eae2 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.entity.adapter.EntityIteratorAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.util.DateToMapAdapter;\r
-import mir.util.GeneratorHTMLFunctions;\r
-import mir.util.GeneratorIntegerFunctions;\r
-import mir.util.GeneratorListFunctions;\r
-import mir.util.GeneratorStringFunctions;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.localizer.MirProducerAssistantLocalizer;\r
-\r
-public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {\r
-  protected LoggerWrapper logger;\r
-\r
-  public void initializeGenerationValueSet(Map aValueSet) {\r
-    try {\r
-      Iterator i;\r
-\r
-      Map configMap = new HashMap();\r
-      Map utilityMap = new HashMap();\r
-\r
-      logger = new LoggerWrapper("Localizer.ProducerAssistant");\r
-\r
-// obsolete:\r
-      configMap.put("producerDocRoot", MirGlobal.config().getString("Producer.DocRoot"));\r
-      configMap.put("storageRoot", MirGlobal.config().getString("Producer.StorageRoot"));\r
-      configMap.put("productionHost", MirGlobal.config().getString("Producer.ProductionHost"));\r
-      configMap.put("openAction", MirGlobal.config().getString("Producer.OpenAction"));\r
-      configMap.put("docRoot", MirGlobal.config().getString("RootUri"));\r
-      configMap.put("actionRoot", MirGlobal.config().getString("RootUri") + "/servlet/Mir");\r
-      configMap.put("now", new DateToMapAdapter( (new GregorianCalendar()).getTime()));\r
-      configMap.put("videoHost", MirGlobal.config().getString("Producer.Video.Host"));\r
-      configMap.put("audioHost", MirGlobal.config().getString("Producer.Audio.Host"));\r
-      configMap.put("imageHost", MirGlobal.config().getString("Producer.Image.Host"));\r
-      configMap.put("imagePath", MirGlobal.config().getString("Producer.Image.Path"));\r
-      configMap.put("mirVersion", MirGlobal.config().getString("Mir.Version"));\r
-      configMap.put("defEncoding", MirGlobal.config().getString("Mir.DefaultEncoding"));\r
-\r
-// "new":\r
-      configMap.putAll(MirPropertiesConfiguration.instance().allSettings());\r
-\r
-      utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace());\r
-      utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction());\r
-      utilityMap.put("encodeXML", new GeneratorHTMLFunctions.encodeXMLGeneratorFunction());\r
-      utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction());\r
-      utilityMap.put("subString", new GeneratorStringFunctions.subStringFunction());\r
-      utilityMap.put("subList", new GeneratorListFunctions.subListFunction());\r
-      utilityMap.put("isOdd", new GeneratorIntegerFunctions.isOddFunction());\r
-      utilityMap.put("increment", new GeneratorIntegerFunctions.incrementFunction());\r
-\r
-      aValueSet.put("config", configMap);\r
-      aValueSet.put("utility", utilityMap);\r
-\r
-      aValueSet.put("languages",\r
-        new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "language"));\r
-\r
-      aValueSet.put("topics",\r
-        new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
-\r
-      Map articleTypeMap = new HashMap();\r
-      articleTypeMap.put("openposting", "0");\r
-      articleTypeMap.put("newswire", "1");\r
-      articleTypeMap.put("feature", "2");\r
-      articleTypeMap.put("topicspecial", "3");\r
-      articleTypeMap.put("startspecial", "4");\r
-\r
-      i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "articleType");\r
-      while (i.hasNext()) {\r
-        EntityAdapter articleType = (EntityAdapter) i.next();\r
-\r
-        articleTypeMap.put(articleType.get("name"), articleType.get("id"));\r
-      }\r
-      aValueSet.put("articletype", articleTypeMap);\r
-\r
-      Map commentStatusMap = new HashMap();\r
-      i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus");\r
-      while (i.hasNext()) {\r
-        EntityAdapter commentStatus = (EntityAdapter) i.next();\r
-\r
-        commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id"));\r
-      }\r
-      aValueSet.put("commentstatus", commentStatusMap);\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("initializeGenerationValueSet: Exception while collecting comment statuses" + t.getMessage());\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-\r
-  };\r
-\r
-  public String filterText(String aText) {\r
-    return StringUtil.createHTML(\r
-        StringUtil.deleteForbiddenTags(aText),\r
-        MirGlobal.config().getString("Producer.ImageRoot"),\r
-        MirGlobal.config().getString("Producer.MailLinkName"),\r
-        MirGlobal.config().getString("Producer.ExtLinkName"),\r
-        MirGlobal.config().getString("Producer.IntLinkName")\r
-    );\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.localizer.basic;
+
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.adapter.EntityAdapter;
+import mir.entity.adapter.EntityIteratorAdapter;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.util.DateToMapAdapter;
+import mir.util.GeneratorHTMLFunctions;
+import mir.util.GeneratorIntegerFunctions;
+import mir.util.GeneratorListFunctions;
+import mir.util.GeneratorStringFunctions;
+import mircoders.global.MirGlobal;
+import mircoders.localizer.MirProducerAssistantLocalizer;
+
+public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {
+  protected LoggerWrapper logger;
+
+  public void initializeGenerationValueSet(Map aValueSet) {
+    try {
+      Iterator i;
+
+      Map configMap = new HashMap();
+      Map utilityMap = new HashMap();
+
+      logger = new LoggerWrapper("Localizer.ProducerAssistant");
+
+// obsolete:
+      configMap.put("producerDocRoot", MirGlobal.config().getString("Producer.DocRoot"));
+      configMap.put("storageRoot", MirGlobal.config().getString("Producer.StorageRoot"));
+      configMap.put("productionHost", MirGlobal.config().getString("Producer.ProductionHost"));
+      configMap.put("openAction", MirGlobal.config().getString("Producer.OpenAction"));
+      configMap.put("docRoot", MirGlobal.config().getString("RootUri"));
+      configMap.put("actionRoot", MirGlobal.config().getString("RootUri") + "/servlet/Mir");
+      configMap.put("now", new DateToMapAdapter( (new GregorianCalendar()).getTime()));
+      configMap.put("videoHost", MirGlobal.config().getString("Producer.Video.Host"));
+      configMap.put("audioHost", MirGlobal.config().getString("Producer.Audio.Host"));
+      configMap.put("imageHost", MirGlobal.config().getString("Producer.Image.Host"));
+      configMap.put("imagePath", MirGlobal.config().getString("Producer.Image.Path"));
+      configMap.put("mirVersion", MirGlobal.config().getString("Mir.Version"));
+      configMap.put("defEncoding", MirGlobal.config().getString("Mir.DefaultEncoding"));
+
+// "new":
+      configMap.putAll(MirPropertiesConfiguration.instance().allSettings());
+
+      utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace());
+      utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction());
+      utilityMap.put("encodeXML", new GeneratorHTMLFunctions.encodeXMLGeneratorFunction());
+      utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction());
+      utilityMap.put("subString", new GeneratorStringFunctions.subStringFunction());
+      utilityMap.put("subList", new GeneratorListFunctions.subListFunction());
+      utilityMap.put("isOdd", new GeneratorIntegerFunctions.isOddFunction());
+      utilityMap.put("increment", new GeneratorIntegerFunctions.incrementFunction());
+
+      aValueSet.put("config", configMap);
+      aValueSet.put("utility", utilityMap);
+
+      aValueSet.put("languages",
+        new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "language"));
+
+      aValueSet.put("topics",
+        new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));
+
+      Map articleTypeMap = new HashMap();
+      articleTypeMap.put("openposting", "0");
+      articleTypeMap.put("newswire", "1");
+      articleTypeMap.put("feature", "2");
+      articleTypeMap.put("topicspecial", "3");
+      articleTypeMap.put("startspecial", "4");
+
+      i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "articleType");
+      while (i.hasNext()) {
+        EntityAdapter articleType = (EntityAdapter) i.next();
+
+        articleTypeMap.put(articleType.get("name"), articleType.get("id"));
+      }
+      aValueSet.put("articletype", articleTypeMap);
+
+      Map commentStatusMap = new HashMap();
+      i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus");
+      while (i.hasNext()) {
+        EntityAdapter commentStatus = (EntityAdapter) i.next();
+
+        commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id"));
+      }
+      aValueSet.put("commentstatus", commentStatusMap);
+    }
+    catch (Throwable t) {
+      logger.error("initializeGenerationValueSet: Exception while collecting comment statuses" + t.getMessage());
+      throw new RuntimeException(t.getMessage());
+    }
+
+  };
+
+  public String filterText(String aText) {
+    return StringUtil.createHTML(
+        StringUtil.deleteForbiddenTags(aText),
+        MirGlobal.config().getString("Producer.ImageRoot"),
+        MirGlobal.config().getString("Producer.MailLinkName"),
+        MirGlobal.config().getString("Producer.ExtLinkName"),
+        MirGlobal.config().getString("Producer.IntLinkName")
+    );
+  }
+}
index a885d2f..1f01ee5 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.media;\r
-\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.InputStream;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaExc;\r
-import mir.media.MediaFailure;\r
-import mir.misc.StringUtil;\r
-import mircoders.storage.DatabaseUploadedMedia;\r
-\r
-\r
-/**\r
- * Image handler that stores images outside of the database. Will be replaced by the new\r
- *   media handling system.\r
- * @author Zapata\r
- * @version 1.0\r
- */\r
-\r
-public class MediaHandlerImagesExtern extends MediaHandlerGeneric\r
-{\r
-  public MediaHandlerImagesExtern() {\r
-    logger = new LoggerWrapper("Media.Images.Extern");\r
-  }\r
-\r
-  public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure {\r
-    try {\r
-      String date = anImageEntity.getValue("date");\r
-      String datePath = StringUtil.webdbDate2path(date);\r
-      String ext = "." + mediaTypeEnt.getValue("name");\r
-      String filePath = datePath + anImageEntity.getId() + ext;\r
-      String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath;\r
-      String imageFilePath = getStoragePath() + File.separator + filePath;\r
-      int maxIconSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxIconSize");\r
-\r
-      File imageFile = new File(imageFilePath);\r
-      File iconFile = new File(iconFilePath);\r
-\r
-      if (!imageFile.exists()) {\r
-        throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!");\r
-      }\r
-      else {\r
-        ImageProcessor processor = new ImageProcessor(imageFile, "JPEG");\r
-\r
-        processor.descaleImage(maxIconSize, 0.2F);\r
-        File dir = new File(iconFile.getParent());\r
-          if (dir!=null && !dir.exists()){\r
-            dir.mkdirs();\r
-        }\r
-        processor.writeScaledData(iconFile);\r
-\r
-        logger.info(processor.getWidth()+"x"+processor.getHeight());\r
-\r
-        anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString());\r
-        anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString());\r
-\r
-        anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());\r
-        anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());\r
-\r
-        anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath);\r
-        anImageEntity.setValueForProperty("publish_path", filePath);\r
-\r
-        anImageEntity.update();\r
-      }\r
-    }\r
-    catch(Throwable t) {\r
-      logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage());\r
-      t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
-      throw new MediaFailure(t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-\r
-  public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure {\r
-    try {\r
-      Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType(\r
-          anImageEntity);\r
-\r
-      String date = anImageEntity.getValue("date");\r
-      String datePath = StringUtil.webdbDate2path(date);\r
-      String ext = "." + mediaType.getValue("name");\r
-      String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") +\r
-          getIconStoragePath() + datePath + anImageEntity.getId() + ext;\r
-\r
-      return new FileInputStream(new File(filePath));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MediaFailure(t);\r
-    }\r
-  }\r
-\r
-  public String getStoragePath()\r
-  {\r
-    return configuration.getString("Producer.Image.Path");\r
-  }\r
-\r
-  public String getIconStoragePath()\r
-  {\r
-    return configuration.getString("Producer.Image.IconPath");\r
-  }\r
-\r
-  public String getPublishHost()\r
-  {\r
-    return StringUtil.removeSlash(configuration.getString("Producer.Image.Host"));\r
-  }\r
-\r
-  public String getTinyIconName()\r
-  {\r
-    return configuration.getString("Producer.Icon.TinyImage");\r
-  }\r
-\r
-  public String getBigIconName()\r
-  {\r
-    return configuration.getString("Producer.Icon.BigImage");\r
-  }\r
-\r
-  public String getIconAltName()\r
-  {\r
-    return "Image";\r
-  }\r
-\r
-  public boolean isVideo()\r
-  {\r
-    return false;\r
-  }\r
-\r
-  public boolean isAudio()\r
-  {\r
-    return false;\r
-  }\r
-\r
-  public boolean isImage ()\r
-  {\r
-    return true;\r
-  }\r
-\r
-  public String getDescr(Entity mediaType)\r
-  {\r
-     return "image/jpeg";\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.media;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.misc.StringUtil;
+import mircoders.storage.DatabaseUploadedMedia;
+
+
+/**
+ * Image handler that stores images outside of the database. Will be replaced by the new
+ *   media handling system.
+ * @author Zapata
+ * @version 1.0
+ */
+
+public class MediaHandlerImagesExtern extends MediaHandlerGeneric
+{
+  public MediaHandlerImagesExtern() {
+    logger = new LoggerWrapper("Media.Images.Extern");
+  }
+
+  public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
+    try {
+      String date = anImageEntity.getValue("date");
+      String datePath = StringUtil.webdbDate2path(date);
+      String ext = "." + mediaTypeEnt.getValue("name");
+      String filePath = datePath + anImageEntity.getId() + ext;
+      String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath;
+      String imageFilePath = getStoragePath() + File.separator + filePath;
+      int maxIconSize = MirPropertiesConfiguration.instance().getInt("Producer.Image.MaxIconSize");
+
+      File imageFile = new File(imageFilePath);
+      File iconFile = new File(iconFilePath);
+
+      if (!imageFile.exists()) {
+        throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!");
+      }
+      else {
+        ImageProcessor processor = new ImageProcessor(imageFile, "JPEG");
+
+        processor.descaleImage(maxIconSize, 0.2F);
+        File dir = new File(iconFile.getParent());
+          if (dir!=null && !dir.exists()){
+            dir.mkdirs();
+        }
+        processor.writeScaledData(iconFile);
+
+        logger.info(processor.getWidth()+"x"+processor.getHeight());
+
+        anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString());
+        anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString());
+
+        anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());
+        anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());
+
+        anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath);
+        anImageEntity.setValueForProperty("publish_path", filePath);
+
+        anImageEntity.update();
+      }
+    }
+    catch(Throwable t) {
+      logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage());
+      t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+      throw new MediaFailure(t.getMessage(), t);
+    }
+  }
+
+
+  public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure {
+    try {
+      Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType(
+          anImageEntity);
+
+      String date = anImageEntity.getValue("date");
+      String datePath = StringUtil.webdbDate2path(date);
+      String ext = "." + mediaType.getValue("name");
+      String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") +
+          getIconStoragePath() + datePath + anImageEntity.getId() + ext;
+
+      return new FileInputStream(new File(filePath));
+    }
+    catch (Throwable t) {
+      throw new MediaFailure(t);
+    }
+  }
+
+  public String getStoragePath()
+  {
+    return configuration.getString("Producer.Image.Path");
+  }
+
+  public String getIconStoragePath()
+  {
+    return configuration.getString("Producer.Image.IconPath");
+  }
+
+  public String getPublishHost()
+  {
+    return StringUtil.removeSlash(configuration.getString("Producer.Image.Host"));
+  }
+
+  public String getTinyIconName()
+  {
+    return configuration.getString("Producer.Icon.TinyImage");
+  }
+
+  public String getBigIconName()
+  {
+    return configuration.getString("Producer.Icon.BigImage");
+  }
+
+  public String getIconAltName()
+  {
+    return "Image";
+  }
+
+  public boolean isVideo()
+  {
+    return false;
+  }
+
+  public boolean isAudio()
+  {
+    return false;
+  }
+
+  public boolean isImage ()
+  {
+    return true;
+  }
+
+  public String getDescr(Entity mediaType)
+  {
+     return "image/jpeg";
+  }
+}
index 5e020f2..195205e 100755 (executable)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mircoders.media;\r
-\r
-import mir.media.MirMedia;\r
-\r
-\r
-/**\r
- * Handles video media, like mpeg, av, and qt\r
- * It is like MediaHandlerAudio with different icons.\r
- * It is MediaHandlerGeneric with different icons.\r
- *\r
- * @see mir.media.MediaHandlerGeneric\r
- * @see mir.media.MirMedia\r
- * @author john <john@manifestor.org>\r
- * @version $Id: MediaHandlerVideo.java,v 1.7 2003/02/23 05:00:14 zapata Exp $\r
- */\r
-\r
-public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia\r
-{\r
-  private static String tinyIcon;\r
-  private static String bigIcon;\r
-\r
-  static {\r
-    tinyIcon = configuration.getString("Producer.Icon.TinyVideo");\r
-    bigIcon = configuration.getString("Producer.Icon.BigVideo");\r
-  }\r
-\r
-  public String getTinyIcon() {\r
-    return tinyIcon;\r
-  }\r
-\r
-  public String getBigIconName() {\r
-    return bigIcon;\r
-  }\r
-\r
-  public String getIconAlt() {\r
-    return "Video";\r
-  }\r
-\r
-  public boolean isVideo() {\r
-    return true;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mircoders.media;
+
+import mir.media.MirMedia;
+
+
+/**
+ * Handles video media, like mpeg, av, and qt
+ * It is like MediaHandlerAudio with different icons.
+ * It is MediaHandlerGeneric with different icons.
+ *
+ * @see mir.media.MediaHandlerGeneric
+ * @see mir.media.MirMedia
+ * @author john <john@manifestor.org>
+ * @version $Id: MediaHandlerVideo.java,v 1.8 2003/04/09 02:06:09 zapata Exp $
+ */
+
+public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia
+{
+  private static String tinyIcon;
+  private static String bigIcon;
+
+  static {
+    tinyIcon = configuration.getString("Producer.Icon.TinyVideo");
+    bigIcon = configuration.getString("Producer.Icon.BigVideo");
+  }
+
+  public String getTinyIcon() {
+    return tinyIcon;
+  }
+
+  public String getBigIconName() {
+    return bigIcon;
+  }
+
+  public String getIconAlt() {
+    return "Video";
+  }
+
+  public boolean isVideo() {
+    return true;
+  }
+}
index 8c97894..0e40105 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.module;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.module.AbstractModule;\r
-import mir.module.ModuleExc;\r
-import mir.module.ModuleFailure;\r
-import mir.storage.StorageObject;\r
-import mir.util.JDBCStringRoutines;\r
-import mircoders.entity.EntityUsers;\r
-import mircoders.global.MirGlobal;\r
-\r
-\r
-/*\r
- *  Users Module -\r
- *\r
- *\r
- * @author RK\r
- */\r
-\r
-public class ModuleUsers extends AbstractModule\r
-{\r
-  static LoggerWrapper logger = new LoggerWrapper("Module.Users");\r
-\r
-  public ModuleUsers(StorageObject theStorage)\r
-  {\r
-    if (theStorage == null)\r
-      logger.warn("ModuleUsers(): StorageObject was null!");\r
-\r
-    this.theStorage = theStorage;\r
-  }\r
-\r
-  /**\r
-   * Authenticate and lookup a user\r
-   *\r
-   * @param user              The user to lookup\r
-   * @param password          The password\r
-   * @return                  The authenticated user, or <code>null</code> if the user\r
-   *                          doesn't exist, or the supplied password is invalid.\r
-   * @throws ModuleException\r
-   */\r
-\r
-  public EntityUsers getUserForLogin(String user, String password) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      String whereString =\r
-          "login='" + JDBCStringRoutines.escapeStringLiteral(user) + "' " +\r
-          "and password='" + JDBCStringRoutines.escapeStringLiteral(\r
-          MirGlobal.localizer().adminInterface().makePasswordDigest(password)) +\r
-          "' " +\r
-          "and is_admin='1'";\r
-\r
-      EntityList userList = getByWhereClause(whereString, -1);\r
-\r
-      if (userList != null && userList.getCount() == 1)\r
-        return (EntityUsers) userList.elementAt(0);\r
-      else\r
-        return null;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  private Map digestPassword(Map aValues) throws ModuleExc, ModuleFailure {\r
-    Map result = aValues;\r
-\r
-    try {\r
-      if (aValues.containsKey("password")) {\r
-        result = new HashMap();\r
-        result.putAll(aValues);\r
-        result.put("password",\r
-            MirGlobal.localizer().adminInterface().\r
-            makePasswordDigest( (String) aValues.get("password")));\r
-      }\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ModuleFailure("ModuleUsers.add: " + t.getMessage(), t);\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  public String add (Map theValues) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      return super.add(digestPassword(theValues));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren\r
-   * @param theValues Hash mit Spalte/Wert-Paaren\r
-   * @return Id des eingef?gten Objekts\r
-   * @exception ModuleException\r
-   */\r
-  public String set (Map theValues) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      return super.set(digestPassword(theValues));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ModuleFailure(t);\r
-    }\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.module;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.module.AbstractModule;
+import mir.module.ModuleExc;
+import mir.module.ModuleFailure;
+import mir.storage.StorageObject;
+import mir.util.JDBCStringRoutines;
+import mircoders.entity.EntityUsers;
+import mircoders.global.MirGlobal;
+
+
+/*
+ *  Users Module -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleUsers extends AbstractModule
+{
+  static LoggerWrapper logger = new LoggerWrapper("Module.Users");
+
+  public ModuleUsers(StorageObject theStorage)
+  {
+    if (theStorage == null)
+      logger.warn("ModuleUsers(): StorageObject was null!");
+
+    this.theStorage = theStorage;
+  }
+
+  /**
+   * Authenticate and lookup a user
+   *
+   * @param user              The user to lookup
+   * @param password          The password
+   * @return                  The authenticated user, or <code>null</code> if the user
+   *                          doesn't exist, or the supplied password is invalid.
+   * @throws ModuleException
+   */
+
+  public EntityUsers getUserForLogin(String user, String password) throws ModuleExc, ModuleFailure {
+    try {
+      String whereString =
+          "login='" + JDBCStringRoutines.escapeStringLiteral(user) + "' " +
+          "and password='" + JDBCStringRoutines.escapeStringLiteral(
+          MirGlobal.localizer().adminInterface().makePasswordDigest(password)) +
+          "' " +
+          "and is_admin='1'";
+
+      EntityList userList = getByWhereClause(whereString, -1);
+
+      if (userList != null && userList.getCount() == 1)
+        return (EntityUsers) userList.elementAt(0);
+      else
+        return null;
+    }
+    catch (Throwable t) {
+      throw new ModuleFailure(t);
+    }
+  }
+
+  private Map digestPassword(Map aValues) throws ModuleExc, ModuleFailure {
+    Map result = aValues;
+
+    try {
+      if (aValues.containsKey("password")) {
+        result = new HashMap();
+        result.putAll(aValues);
+        result.put("password",
+            MirGlobal.localizer().adminInterface().
+            makePasswordDigest( (String) aValues.get("password")));
+      }
+    }
+    catch (Throwable t) {
+      throw new ModuleFailure("ModuleUsers.add: " + t.getMessage(), t);
+    }
+
+    return result;
+  }
+
+  public String add (Map theValues) throws ModuleExc, ModuleFailure {
+    try {
+      return super.add(digestPassword(theValues));
+    }
+    catch (Throwable t) {
+      throw new ModuleFailure(t);
+    }
+  }
+
+  /**
+   * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren
+   * @param theValues Hash mit Spalte/Wert-Paaren
+   * @return Id des eingef?gten Objekts
+   * @exception ModuleException
+   */
+  public String set (Map theValues) throws ModuleExc, ModuleFailure {
+    try {
+      return super.set(digestPassword(theValues));
+    }
+    catch (Throwable t) {
+      throw new ModuleFailure(t);
+    }
+  }
 }
\ No newline at end of file
index c3e4b85..efe8dbc 100755 (executable)
@@ -6,7 +6,6 @@ import java.util.Locale;
 import java.util.Map;\r
 \r
 import org.apache.struts.util.MessageResources;\r
-\r
 import mir.entity.adapter.EntityIteratorAdapter;\r
 import mir.generator.Generator;\r
 import mir.servlet.ServletModuleExc;\r
@@ -14,21 +13,20 @@ import mir.servlet.ServletModuleFailure;
 import mir.util.CachingRewindableIterator;\r
 import mir.util.NullWriter;\r
 import mir.util.ResourceBundleGeneratorFunction;\r
-\r
 import mircoders.global.MirGlobal;\r
 \r
 \r
 \r
 public class ServletHelper {\r
-  static Map makeGenerationData(Locale aLocale) throws ServletModuleExc {\r
-    return makeGenerationData(aLocale, "bundles.adminlocal", "bundles.admin");\r
+  public static Map makeGenerationData(Locale[] aLocales) throws ServletModuleExc {\r
+    return makeGenerationData(aLocales, "bundles.adminlocal", "bundles.admin");\r
   }\r
 \r
-  static Map makeGenerationData(Locale aLocale, String aBundle) throws ServletModuleExc {\r
-    return makeGenerationData(aLocale, aBundle, aBundle);\r
+  public static Map makeGenerationData(Locale[] aLocales, String aBundle) throws ServletModuleExc {\r
+    return makeGenerationData(aLocales, aBundle, aBundle);\r
   }\r
 \r
-  static Map makeGenerationData(Locale aLocale, String aBundle, String aDefaultBundle) throws ServletModuleExc {\r
+  public static Map makeGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {\r
 \r
     try {\r
       Map result = new HashMap();\r
@@ -62,9 +60,9 @@ public class ServletHelper {
       result.put("topics", topics);\r
 \r
       result.put( "lang",\r
-          new ResourceBundleGeneratorFunction( aLocale,\r
-                  MessageResources.getMessageResources(aBundle),\r
-                  MessageResources.getMessageResources(aDefaultBundle)));\r
+          new ResourceBundleGeneratorFunction( aLocales,\r
+             new MessageResources[] { MessageResources.getMessageResources(aBundle),\r
+                                   MessageResources.getMessageResources(aDefaultBundle)}));\r
 \r
       return result;\r
     }\r
@@ -73,7 +71,7 @@ public class ServletHelper {
     }\r
   }\r
 \r
-  static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
+  public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
     Generator generator;\r
 \r
     try {\r
@@ -86,7 +84,7 @@ public class ServletHelper {
     }\r
   }\r
 \r
-  static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
+  public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
     Generator generator;\r
 \r
     try {\r
index 1cf0125..e2d955b 100755 (executable)
-package mircoders.servlet;\r
-\r
+package mircoders.servlet;
+
+import java.util.Locale;\r
 import java.util.Map;\r
-\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import mir.log.LoggerWrapper;\r
 import mir.servlet.ServletModule;\r
 import mir.servlet.ServletModuleFailure;\r
-import mir.util.URLBuilder;\r
 import mir.util.HTTPRequestParser;\r
-import mircoders.global.*;\r
-\r
-public class ServletModuleAbuse extends ServletModule {\r
-  private static ServletModuleAbuse instance = new ServletModuleAbuse();\r
-  public static ServletModule getInstance() { return instance; }\r
-\r
-  private ServletModuleAbuse() {\r
-    logger = new LoggerWrapper("ServletModule.Abuse");\r
-    defaultAction = "showsettings";\r
-  }\r
-\r
-  public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
-    String type=requestParser.getParameterWithDefault("type", "");\r
-    String id=requestParser.getParameterWithDefault("id", "");\r
-    String expression=requestParser.getParameterWithDefault("expression", "");\r
-\r
-    if (id.equals("")) {\r
-      MirGlobal.abuse().addFilter(type, expression);\r
-    }\r
-    else {\r
-      MirGlobal.abuse().setFilter(id, type, expression);\r
-    }\r
-\r
-    MirGlobal.abuse().save();\r
-\r
-    showfilters(aRequest, aResponse);\r
-  }\r
-\r
-  public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
-    String id=requestParser.getParameterWithDefault("id", "");\r
-    MirGlobal.abuse().deleteFilter(id);\r
-\r
-    MirGlobal.abuse().save();\r
-\r
-    showfilters(aRequest, aResponse);\r
-  }\r
-\r
-  public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    URLBuilder urlBuilder = new URLBuilder();\r
-\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-\r
-      urlBuilder.setValue("module", "Abuse");\r
-      urlBuilder.setValue("do", "showfilters");\r
-      responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
-      responseData.put("filters", MirGlobal.abuse().getFilters());\r
-      responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes());\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template");\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-\r
-  public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    URLBuilder urlBuilder = new URLBuilder();\r
-\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-\r
-      urlBuilder.setValue("module", "Abuse");\r
-      urlBuilder.setValue("do", "showsettings");\r
-\r
-      responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
-      responseData.put("articleactions", MirGlobal.abuse().getArticleActions());\r
-      responseData.put("commentactions", MirGlobal.abuse().getCommentActions());\r
-\r
-      responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled()));\r
-      responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword()));\r
-      responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled()));\r
-      responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize()));\r
-      responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock()));\r
-      responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction());\r
-      responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction());\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template");\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    try {\r
-      HTTPRequestParser parser = new HTTPRequestParser(aRequest);\r
-\r
-      MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1"));\r
-      MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1"));\r
-      MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1"));\r
-\r
-      try {\r
-        MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize()));\r
-      }\r
-      catch (Throwable t) {\r
-      }\r
-\r
-      MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1"));\r
-\r
-      MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction"));\r
-      MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction"));\r
-\r
-      MirGlobal.abuse().save();\r
-\r
-      showsettings(aRequest, aResponse);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
-    URLBuilder urlBuilder = new URLBuilder();\r
-    int count;\r
-\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-      urlBuilder.setValue("module", "Abuse");\r
-      urlBuilder.setValue("do", "showlog");\r
-      responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
-      responseData.put("log", MirGlobal.abuse().getLog());\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template");\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
+import mir.util.URLBuilder;\r
+import mircoders.global.MirGlobal;
+
+public class ServletModuleAbuse extends ServletModule {
+  private static ServletModuleAbuse instance = new ServletModuleAbuse();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleAbuse() {
+    logger = new LoggerWrapper("ServletModule.Abuse");
+    defaultAction = "showsettings";
+  }
+
+  public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+    String type=requestParser.getParameterWithDefault("type", "");
+    String id=requestParser.getParameterWithDefault("id", "");
+    String expression=requestParser.getParameterWithDefault("expression", "");
+
+    if (id.equals("")) {
+      MirGlobal.abuse().addFilter(type, expression);
+    }
+    else {
+      MirGlobal.abuse().setFilter(id, type, expression);
+    }
+
+    MirGlobal.abuse().save();
+
+    showfilters(aRequest, aResponse);
+  }
+
+  public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+    String id=requestParser.getParameterWithDefault("id", "");
+    MirGlobal.abuse().deleteFilter(id);
+
+    MirGlobal.abuse().save();
+
+    showfilters(aRequest, aResponse);
+  }
+
+  public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    URLBuilder urlBuilder = new URLBuilder();
+
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+
+      urlBuilder.setValue("module", "Abuse");
+      urlBuilder.setValue("do", "showfilters");
+      responseData.put("thisurl", urlBuilder.getQuery());
+
+      responseData.put("filters", MirGlobal.abuse().getFilters());
+      responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes());
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template");
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+
+  public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    URLBuilder urlBuilder = new URLBuilder();
+
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+
+      urlBuilder.setValue("module", "Abuse");
+      urlBuilder.setValue("do", "showsettings");
+
+      responseData.put("thisurl", urlBuilder.getQuery());
+
+      responseData.put("articleactions", MirGlobal.abuse().getArticleActions());
+      responseData.put("commentactions", MirGlobal.abuse().getCommentActions());
+
+      responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled()));
+      responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword()));
+      responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled()));
+      responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize()));
+      responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock()));
+      responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction());
+      responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction());
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template");
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    try {
+      HTTPRequestParser parser = new HTTPRequestParser(aRequest);
+
+      MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1"));
+      MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1"));
+      MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1"));
+
+      try {
+        MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize()));
+      }
+      catch (Throwable t) {
+      }
+
+      MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1"));
+
+      MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction"));
+      MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction"));
+
+      MirGlobal.abuse().save();
+
+      showsettings(aRequest, aResponse);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    URLBuilder urlBuilder = new URLBuilder();
+    int count;
+
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+      urlBuilder.setValue("module", "Abuse");
+      urlBuilder.setValue("do", "showlog");
+      responseData.put("thisurl", urlBuilder.getQuery());
+
+      responseData.put("log", MirGlobal.abuse().getLog());
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template");
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
 }
\ No newline at end of file
index eb4ae4d..533ff79 100755 (executable)
@@ -1,71 +1,71 @@
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.servlet;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.log.LoggerWrapper;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleFailure;
-import mir.util.URLBuilder;
-
-public class ServletModuleAdmin extends ServletModule
-{
-  private static ServletModuleAdmin instance = new ServletModuleAdmin();
-  public static ServletModule getInstance() { return instance; }
-
-  private ServletModuleAdmin() {
-    logger = new LoggerWrapper("ServletModule.Admin");
-    defaultAction = "showSuperUserMenu";
-  }
-
-  public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) {
-    URLBuilder urlBuilder = new URLBuilder();
-    int count;
-
-    try {
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));
-      urlBuilder.setValue("module", "Admin");
-      urlBuilder.setValue("do", "superusermenu");
-
-      responseData.put("thisurl" , urlBuilder.getQuery());
-
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template");
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-}
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.servlet;\r
+\r
+import java.util.Locale;\r
+import java.util.Map;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+import mir.log.LoggerWrapper;\r
+import mir.servlet.ServletModule;\r
+import mir.servlet.ServletModuleFailure;\r
+import mir.util.URLBuilder;\r
+\r
+public class ServletModuleAdmin extends ServletModule\r
+{\r
+  private static ServletModuleAdmin instance = new ServletModuleAdmin();\r
+  public static ServletModule getInstance() { return instance; }\r
+\r
+  private ServletModuleAdmin() {\r
+    logger = new LoggerWrapper("ServletModule.Admin");\r
+    defaultAction = "showSuperUserMenu";\r
+  }\r
+\r
+  public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
+    URLBuilder urlBuilder = new URLBuilder();\r
+    int count;\r
+\r
+    try {\r
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
+      urlBuilder.setValue("module", "Admin");\r
+      urlBuilder.setValue("do", "superusermenu");\r
+\r
+      responseData.put("thisurl" , urlBuilder.getQuery());\r
+\r
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template");\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+}\r
index b752549..6a7afa6 100755 (executable)
 
 package mircoders.servlet;
 
-import java.net.URLEncoder;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.config.MirPropertiesConfiguration;
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.misc.HTMLTemplateProcessor;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleFailure;
-import mircoders.module.ModuleBreaking;
+import java.net.URLEncoder;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+import freemarker.template.SimpleHash;\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
+import mir.misc.HTMLTemplateProcessor;\r
+import mir.servlet.ServletModule;\r
+import mir.servlet.ServletModuleFailure;\r
+import mircoders.module.ModuleBreaking;\r
 import mircoders.storage.DatabaseBreaking;
-import freemarker.template.SimpleHash;
 
 /*
  *  ServletModuleBreaking -
@@ -102,7 +101,7 @@ public class ServletModuleBreaking extends ServletModule
         mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
 
 // raus damit
-      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req));
     }
     catch (Exception e) {
       throw new ServletModuleFailure(e);
index 510b984..5017347 100755 (executable)
@@ -32,6 +32,7 @@
 package mircoders.servlet;
 
 import java.util.Map;
+import java.util.Locale;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -201,7 +202,7 @@ public class ServletModuleComment extends ServletModule
     int count;
 
     try {
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
       model = MirGlobal.localizer().dataModel().adapterModel();
 
       Object commentList =
index ffe9169..d2adaac 100755 (executable)
 
 package mircoders.servlet;
 
-import mir.config.MirPropertiesConfiguration;\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mircoders.module.ModuleCommentStatus;\r
+import mir.config.MirPropertiesConfiguration;
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mircoders.module.ModuleCommentStatus;
 import mircoders.storage.DatabaseCommentStatus;
 
 public class ServletModuleCommentStatus extends ServletModule
index 048959b..3c16851 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-\r
-import org.apache.lucene.index.IndexReader;\r
-import freemarker.template.SimpleHash;\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.entity.adapter.EntityIteratorAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.CachingRewindableIterator;\r
-import mir.util.HTTPRequestParser;\r
-import mir.util.JDBCStringRoutines;\r
-import mir.util.SQLQueryBuilder;\r
-import mir.util.URLBuilder;\r
-\r
-import mircoders.entity.EntityContent;\r
-import mircoders.entity.EntityUsers;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.module.ModuleContent;\r
-import mircoders.search.IndexUtil;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseContent;\r
-import mircoders.storage.DatabaseContentToTopics;\r
-import mircoders.storage.DatabaseContentToMedia;\r
-\r
-/*\r
- *  ServletModuleContent -\r
- *  deliver html for the article admin form.\r
- *\r
- * @version $Id: ServletModuleContent.java,v 1.46 2003/03/27 20:11:35 zapata Exp $\r
- * @author rk, mir-coders\r
- *\r
- */\r
-\r
-public class ServletModuleContent extends ServletModule\r
-{\r
-  private String editTemplate = configuration.getString("ServletModule.Content.ObjektTemplate");;\r
-  private String listTemplate = configuration.getString("ServletModule.Content.ListTemplate");\r
-\r
-  private static ServletModuleContent instance = new ServletModuleContent();\r
-  public static ServletModule getInstance() { return instance; }\r
-\r
-  private ServletModuleContent() {\r
-    super();\r
-    logger = new LoggerWrapper("ServletModule.Content");\r
-    try {\r
-\r
-      templateListString = configuration.getString("ServletModule.Content.ListTemplate");\r
-      templateObjektString = configuration.getString("ServletModule.Content.ObjektTemplate");\r
-      templateConfirmString = configuration.getString("ServletModule.Content.ConfirmTemplate");\r
-\r
-      mainModule = new ModuleContent(DatabaseContent.getInstance());\r
-    }\r
-    catch (Throwable e) {\r
-      logger.fatal("ServletModuleContent could not be initialized: " + e.toString());\r
-    }\r
-  }\r
-\r
-  public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
-    String where = requestParser.getParameter("where");\r
-    String order = requestParser.getParameterWithDefault("order", "webdb_create desc");\r
-    int offset = requestParser.getIntegerWithDefault("offset", 0);\r
-    String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
-\r
-    returnArticleList(aRequest, aResponse, where, order, offset, selectArticleUrl);\r
-  }\r
-\r
-  public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc, ServletModuleFailure {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      SQLQueryBuilder queryBuilder = new SQLQueryBuilder();\r
-      String searchField = requestParser.getParameterWithDefault("searchfield", "");\r
-      String searchValue = requestParser.getParameterWithDefault("searchvalue", "").trim();\r
-      String searchOrder = requestParser.getParameterWithDefault("searchorder", "");\r
-      String searchispublished = requestParser.getParameterWithDefault("searchispublished", "");\r
-      String searchArticleType = requestParser.getParameterWithDefault("searcharticletype", "");\r
-      String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
-\r
-      if (searchValue.length()>0) {\r
-        if (searchField.equals("id"))\r
-          queryBuilder.appendAndCondition(\r
-            "id='"+JDBCStringRoutines.escapeStringLiteral(searchValue)+"'");\r
-        else if (searchField.equals("contents"))\r
-          queryBuilder.appendAndCondition(\r
-            "(lower(content_data) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')"+\r
-            " or (lower(description) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')");\r
-        else\r
-          queryBuilder.appendAndCondition(\r
-            "lower("+ searchField + ") like " +\r
-            "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%'");\r
-      }\r
-\r
-      if (searchispublished.length()>0) {\r
-        if (searchispublished.equals("0"))\r
-          queryBuilder.appendAndCondition("is_published='f'");\r
-        else\r
-          queryBuilder.appendAndCondition("is_published='t'");\r
-      }\r
-\r
-      if (searchArticleType.length()>0) {\r
-        queryBuilder.appendAndCondition("to_article_type="+Integer.parseInt(searchArticleType));\r
-      }\r
-\r
-      if (searchOrder.length()>0) {\r
-        if (searchOrder.equals("datedesc"))\r
-          queryBuilder.appendAscendingOrder("webdb_create");\r
-        else if (searchOrder.equals("dateasc"))\r
-          queryBuilder.appendDescendingOrder("webdb_create");\r
-        else if (searchOrder.equals("title"))\r
-          queryBuilder.appendDescendingOrder("title");\r
-        else if (searchOrder.equals("creator"))\r
-          queryBuilder.appendDescendingOrder("creator");\r
-      }\r
-\r
-      returnArticleList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0, selectArticleUrl);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc {\r
-    _showObject(null, req, res);\r
-  }\r
-\r
-\r
-  public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
-  {\r
-//theLog.printDebugInfo(":: content :: trying to insert");\r
-    try {\r
-      EntityUsers   user = _getUser(req);\r
-      Map withValues = getIntersectingValues(req, DatabaseContent.getInstance());\r
-\r
-      String now = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      withValues.put("date", now);\r
-      withValues.put("publish_path", StringUtil.webdbDate2path(now));\r
-      withValues.put("to_publisher", user.getId());\r
-      withValues.put("is_produced", "0");\r
-      if (!withValues.containsKey("is_published"))\r
-        withValues.put("is_published","0");\r
-      if (!withValues.containsKey("is_html"))\r
-        withValues.put("is_html","0");\r
-\r
-      String id = mainModule.add(withValues);\r
-      DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));\r
-\r
-      _showObject(id, req, res);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
-  {\r
-    EntityUsers   user = _getUser(req);\r
-\r
-    String idParam = req.getParameter("id");\r
-    if (idParam == null) throw new ServletModuleExc("Invalid call: id missing");\r
-\r
-    String confirmParam = req.getParameter("confirm");\r
-    String cancelParam = req.getParameter("cancel");\r
-\r
-    logger.info("where = " + req.getParameter("where"));\r
-\r
-    if (confirmParam == null && cancelParam == null) {\r
-\r
-      SimpleHash mergeData = new SimpleHash();\r
-      mergeData.put("module", "Content");\r
-      mergeData.put("infoString", "Content: " + idParam);\r
-      mergeData.put("id", idParam);\r
-      mergeData.put("where", req.getParameter("where"));\r
-      mergeData.put("order", req.getParameter("order"));\r
-      mergeData.put("offset", req.getParameter("offset"));\r
-      deliver(req, res, mergeData, templateConfirmString);\r
-    }\r
-    else {\r
-      if (confirmParam!= null && !confirmParam.equals("")) {\r
-        try {\r
-          mainModule.deleteById(idParam);\r
-\r
-          /** @todo the following two should be implied in\r
-           *  DatabaseContent */\r
-          DatabaseContentToTopics.getInstance().deleteByContentId(idParam);\r
-          DatabaseComment.getInstance().deleteByContentId(idParam);\r
-          DatabaseContentToMedia.getInstance().deleteByContentId(idParam);\r
-\r
-\r
-          //delete from lucene index, if any\r
-          String index = configuration.getString("IndexPath");\r
-          if (IndexReader.indexExists(index)){\r
-            IndexUtil.unindexID(idParam,index);\r
-          }\r
-\r
-        }\r
-        catch (Throwable e) {\r
-          throw new ServletModuleFailure(e);\r
-        }\r
-        list(req,res);\r
-      }\r
-      else {\r
-        // Datensatz anzeigen\r
-        _showObject(idParam, req, res);\r
-      }\r
-    }\r
-  }\r
-\r
-  public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
-  {\r
-    String idParam = req.getParameter("id");\r
-    if (idParam == null)\r
-      throw new ServletModuleExc("Invalid call: id not supplied ");\r
-    _showObject(idParam, req, res);\r
-  }\r
-\r
-// methods for attaching media file\r
-  public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
-  {\r
-    String  mediaIdParam = req.getParameter("mid");\r
-    String  idParam = req.getParameter("cid");\r
-    if (idParam == null||mediaIdParam==null) throw new ServletModuleExc("smod content :: attach :: cid/mid missing");\r
-\r
-    try {\r
-      EntityContent entContent = (EntityContent)mainModule.getById(idParam);\r
-      entContent.attach(mediaIdParam);\r
-    }\r
-    catch(Throwable e) {\r
-      logger.error("smod content :: attach :: could not get entityContent");\r
-    }\r
-\r
-    _showObject(idParam, req, res);\r
-  }\r
-\r
-  public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
-  {\r
-    String  cidParam = req.getParameter("cid");\r
-    String  midParam = req.getParameter("mid");\r
-    if (cidParam == null)\r
-      throw new ServletModuleExc("smod content :: dettach :: cid missing");\r
-    if (midParam == null)\r
-      throw new ServletModuleExc("smod content :: dettach :: mid missing");\r
-\r
-    try {\r
-      EntityContent entContent = (EntityContent)mainModule.getById(cidParam);\r
-      entContent.dettach(cidParam,midParam);\r
-    }\r
-    catch(Throwable e) {\r
-      logger.error("smod content :: dettach :: could not get entityContent");\r
-    }\r
-\r
-    _showObject(cidParam, req, res);\r
-  }\r
-\r
-  public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
-      String returnUrl = requestParser.getParameter("returnurl");\r
-\r
-      String idParam = aRequest.getParameter("id");\r
-      if (idParam == null)\r
-        throw new ServletModuleExc("Wrong call: (id) is missing");\r
-\r
-      Map withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());\r
-      String[] topic_id = aRequest.getParameterValues("to_topic");\r
-      String content_id = aRequest.getParameter("id");\r
-\r
-      withValues.put("is_produced", "0");\r
-      if (!withValues.containsKey("is_published"))\r
-        withValues.put("is_published","0");\r
-      if (!withValues.containsKey("is_html"))\r
-        withValues.put("is_html","0");\r
-\r
-      String id = mainModule.set(withValues);\r
-      DatabaseContentToTopics.getInstance().setTopics(aRequest.getParameter("id"),topic_id);\r
-\r
-      String whereParam = aRequest.getParameter("where");\r
-      String orderParam = aRequest.getParameter("order");\r
-\r
-      if (returnUrl!=null){\r
-        redirect(aResponse, returnUrl);\r
-      }\r
-      else\r
-        _showObject(idParam, aRequest, aResponse);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-/*\r
-  * HelperMethod shows the basic article editing form.\r
-  *\r
-  * if the "id" parameter is null, it means show an empty form to add a new\r
-  * article.\r
-*/\r
-  public void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)\r
-      throws ServletModuleExc {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-      EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();\r
-      Map article;\r
-      URLBuilder urlBuilder = new URLBuilder();\r
-\r
-      urlBuilder.setValue("module", "Content");\r
-      urlBuilder.setValue("do", "edit");\r
-      urlBuilder.setValue("id", id);\r
-      urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
-\r
-      if (id!=null) {\r
-        responseData.put("new", Boolean.FALSE);\r
-        article = model.makeEntityAdapter("content", mainModule.getById(id));\r
-      }\r
-      else {\r
-        List fields = DatabaseContent.getInstance().getFields();\r
-        responseData.put("new", Boolean.TRUE);\r
-        article = new HashMap();\r
-        Iterator i = fields.iterator();\r
-        while (i.hasNext()) {\r
-          article.put(i.next(), null);\r
-        }\r
-\r
-        article.put("to_topics", null);\r
-\r
-        MirGlobal.localizer().adminInterface().initializeArticle(article);\r
-      }\r
-      responseData.put("article", article);\r
-\r
-      responseData.put("topics",\r
-          new EntityIteratorAdapter("", configuration.getString("Mir.Localizer.Admin.TopicListOrder"),\r
-          20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
-\r
-\r
-\r
-      responseData.put("returnurl", requestParser.getParameter("returnurl"));\r
-      responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, editTemplate);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void returnArticleList(\r
-       HttpServletRequest aRequest,\r
-       HttpServletResponse aResponse,\r
-       String aWhereClause,\r
-       String anOrderByClause,\r
-       int anOffset,\r
-       String aSelectArticleUrl) throws ServletModuleExc {\r
-\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-    URLBuilder urlBuilder = new URLBuilder();\r
-    EntityAdapterModel model;\r
-    int nrArticlesPerPage = 20;\r
-    int count;\r
-\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-      model = MirGlobal.localizer().dataModel().adapterModel();\r
-\r
-      Object articleList =\r
-          new CachingRewindableIterator(\r
-            new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrArticlesPerPage,\r
-               MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)\r
-      );\r
-\r
-      responseData.put("nexturl", null);\r
-      responseData.put("prevurl", null);\r
-\r
-      count=mainModule.getSize(aWhereClause);\r
-\r
-      urlBuilder.setValue("module", "Content");\r
-      urlBuilder.setValue("do", "list");\r
-      urlBuilder.setValue("where", aWhereClause);\r
-      urlBuilder.setValue("order", anOrderByClause);\r
-\r
-\r
-      urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));\r
-      urlBuilder.setValue("searchvalue", requestParser.getParameter("searchvalue"));\r
-      urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));\r
-      urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));\r
-      urlBuilder.setValue("searcharticletype", requestParser.getParameter("searcharticletype"));\r
-      urlBuilder.setValue("selectarticleurl", aSelectArticleUrl);\r
-\r
-      responseData.put("searchfield", requestParser.getParameter("searchfield"));\r
-      responseData.put("searchvalue", requestParser.getParameter("searchvalue"));\r
-      responseData.put("searchispublished", requestParser.getParameter("searchispublished"));\r
-      responseData.put("searchorder", requestParser.getParameter("searchorder"));\r
-      responseData.put("searcharticletype", requestParser.getParameter("searcharticletype"));\r
-      responseData.put("selectarticleurl", aSelectArticleUrl);\r
-\r
-      urlBuilder.setValue("offset", anOffset);\r
-      responseData.put("offset" , new Integer(anOffset).toString());\r
-      responseData.put("thisurl" , urlBuilder.getQuery());\r
-\r
-      if (count>=anOffset+nrArticlesPerPage) {\r
-        urlBuilder.setValue("offset", (anOffset + nrArticlesPerPage));\r
-        responseData.put("nexturl" , urlBuilder.getQuery());\r
-      }\r
-\r
-      if (anOffset>0) {\r
-        urlBuilder.setValue("offset", Math.max(anOffset - nrArticlesPerPage, 0));\r
-        responseData.put("prevurl" , urlBuilder.getQuery());\r
-      }\r
-\r
-      responseData.put("articles", articleList);\r
-\r
-      responseData.put("from" , Integer.toString(anOffset+1));\r
-      responseData.put("count", Integer.toString(count));\r
-      responseData.put("to", Integer.toString(Math.min(anOffset+nrArticlesPerPage, count)));\r
-      responseData.put("offset" , Integer.toString(anOffset));\r
-      responseData.put("order", anOrderByClause);\r
-      responseData.put("where" , aWhereClause);\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, listTemplate);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void selectparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      URLBuilder urlBuilder = new URLBuilder();\r
-\r
-      urlBuilder.setValue("module", "Content");\r
-      urlBuilder.setValue("do", "setparent");\r
-      urlBuilder.setValue("childid", requestParser.getParameter("id"));\r
-      urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
-\r
-      returnArticleList(aRequest, aResponse, "", "", 0, urlBuilder.getQuery());\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void listchildren(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      String articleId = requestParser.getParameter("article_id");\r
-\r
-      if (articleId == null)\r
-        throw new ServletModuleExc("ServletModuleContent.listchildren: article_id not set!");\r
-\r
-      returnArticleList(aRequest, aResponse, "to_content = " + articleId, "", 0, null);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void setparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-    String articleId = aRequest.getParameter("childid");\r
-    String parentId  = aRequest.getParameter("id");\r
-    String returnUrl = aRequest.getParameter("returnurl");\r
-\r
-    try {\r
-      EntityContent article = (EntityContent) mainModule.getById(articleId);\r
-      article.setValueForProperty("to_content", parentId);\r
-      article.setProduced(false);\r
-      article.update();\r
-    }\r
-    catch(Throwable e) {\r
-      logger.error("ServletModuleContent.setparent: " + e.getMessage());\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-\r
-    redirect(aResponse, returnUrl);\r
-  }\r
-\r
-  public void clearparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-    String articleId = requestParser.getParameter("id");\r
-    String returnUrl = requestParser.getParameter("returnurl");\r
-\r
-    try {\r
-      EntityContent article = (EntityContent) mainModule.getById(articleId);\r
-      article.setValueForProperty("to_content", "");\r
-      article.setProduced(false);\r
-      article.update();\r
-    }\r
-    catch(Throwable e) {\r
-      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
-      logger.error("ServletModuleContent.clearparent: " + e.getMessage());\r
-\r
-      throw new ServletModuleFailure("ServletModuleContent.clearparent: " + e.getMessage(), e);\r
-    }\r
-\r
-    redirect(aResponse, returnUrl);\r
-  }\r
-\r
-  private EntityUsers _getUser(HttpServletRequest req)\r
-  {\r
-    HttpSession session=req.getSession(false);\r
-\r
-    return (EntityUsers)session.getAttribute("login.uid");\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Locale;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.lucene.index.IndexReader;
+import freemarker.template.SimpleHash;
+import mir.entity.adapter.EntityAdapterModel;
+import mir.entity.adapter.EntityIteratorAdapter;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.util.CachingRewindableIterator;
+import mir.util.HTTPRequestParser;
+import mir.util.JDBCStringRoutines;
+import mir.util.SQLQueryBuilder;
+import mir.util.URLBuilder;
+
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityUsers;
+import mircoders.global.MirGlobal;
+import mircoders.module.ModuleContent;
+import mircoders.search.IndexUtil;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseContent;
+import mircoders.storage.DatabaseContentToTopics;
+import mircoders.storage.DatabaseContentToMedia;
+
+/*
+ *  ServletModuleContent -
+ *  deliver html for the article admin form.
+ *
+ * @version $Id: ServletModuleContent.java,v 1.47 2003/04/09 02:06:09 zapata Exp $
+ * @author rk, mir-coders
+ *
+ */
+
+public class ServletModuleContent extends ServletModule
+{
+  private String editTemplate = configuration.getString("ServletModule.Content.ObjektTemplate");;
+  private String listTemplate = configuration.getString("ServletModule.Content.ListTemplate");
+
+  private static ServletModuleContent instance = new ServletModuleContent();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleContent() {
+    super();
+    logger = new LoggerWrapper("ServletModule.Content");
+    try {
+
+      templateListString = configuration.getString("ServletModule.Content.ListTemplate");
+      templateObjektString = configuration.getString("ServletModule.Content.ObjektTemplate");
+      templateConfirmString = configuration.getString("ServletModule.Content.ConfirmTemplate");
+
+      mainModule = new ModuleContent(DatabaseContent.getInstance());
+    }
+    catch (Throwable e) {
+      logger.fatal("ServletModuleContent could not be initialized: " + e.toString());
+    }
+  }
+
+  public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+    String where = requestParser.getParameter("where");
+    String order = requestParser.getParameterWithDefault("order", "webdb_create desc");
+    int offset = requestParser.getIntegerWithDefault("offset", 0);
+    String selectArticleUrl = requestParser.getParameter("selectarticleurl");
+
+    returnArticleList(aRequest, aResponse, where, order, offset, selectArticleUrl);
+  }
+
+  public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc, ServletModuleFailure {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      SQLQueryBuilder queryBuilder = new SQLQueryBuilder();
+      String searchField = requestParser.getParameterWithDefault("searchfield", "");
+      String searchValue = requestParser.getParameterWithDefault("searchvalue", "").trim();
+      String searchOrder = requestParser.getParameterWithDefault("searchorder", "");
+      String searchispublished = requestParser.getParameterWithDefault("searchispublished", "");
+      String searchArticleType = requestParser.getParameterWithDefault("searcharticletype", "");
+      String selectArticleUrl = requestParser.getParameter("selectarticleurl");
+
+      if (searchValue.length()>0) {
+        if (searchField.equals("id"))
+          queryBuilder.appendAndCondition(
+            "id='"+JDBCStringRoutines.escapeStringLiteral(searchValue)+"'");
+        else if (searchField.equals("contents"))
+          queryBuilder.appendAndCondition(
+            "(lower(content_data) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')"+
+            " or (lower(description) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')");
+        else
+          queryBuilder.appendAndCondition(
+            "lower("+ searchField + ") like " +
+            "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%'");
+      }
+
+      if (searchispublished.length()>0) {
+        if (searchispublished.equals("0"))
+          queryBuilder.appendAndCondition("is_published='f'");
+        else
+          queryBuilder.appendAndCondition("is_published='t'");
+      }
+
+      if (searchArticleType.length()>0) {
+        queryBuilder.appendAndCondition("to_article_type="+Integer.parseInt(searchArticleType));
+      }
+
+      if (searchOrder.length()>0) {
+        if (searchOrder.equals("datedesc"))
+          queryBuilder.appendAscendingOrder("webdb_create");
+        else if (searchOrder.equals("dateasc"))
+          queryBuilder.appendDescendingOrder("webdb_create");
+        else if (searchOrder.equals("title"))
+          queryBuilder.appendDescendingOrder("title");
+        else if (searchOrder.equals("creator"))
+          queryBuilder.appendDescendingOrder("creator");
+      }
+
+      returnArticleList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0, selectArticleUrl);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc {
+    _showObject(null, req, res);
+  }
+
+
+  public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+  {
+//theLog.printDebugInfo(":: content :: trying to insert");
+    try {
+      EntityUsers   user = _getUser(req);
+      Map withValues = getIntersectingValues(req, DatabaseContent.getInstance());
+
+      String now = StringUtil.date2webdbDate(new GregorianCalendar());
+      withValues.put("date", now);
+      withValues.put("publish_path", StringUtil.webdbDate2path(now));
+      withValues.put("to_publisher", user.getId());
+      withValues.put("is_produced", "0");
+      if (!withValues.containsKey("is_published"))
+        withValues.put("is_published","0");
+      if (!withValues.containsKey("is_html"))
+        withValues.put("is_html","0");
+
+      String id = mainModule.add(withValues);
+      DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
+
+      _showObject(id, req, res);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+  {
+    EntityUsers   user = _getUser(req);
+
+    String idParam = req.getParameter("id");
+    if (idParam == null) throw new ServletModuleExc("Invalid call: id missing");
+
+    String confirmParam = req.getParameter("confirm");
+    String cancelParam = req.getParameter("cancel");
+
+    logger.info("where = " + req.getParameter("where"));
+
+    if (confirmParam == null && cancelParam == null) {
+
+      SimpleHash mergeData = new SimpleHash();
+      mergeData.put("module", "Content");
+      mergeData.put("infoString", "Content: " + idParam);
+      mergeData.put("id", idParam);
+      mergeData.put("where", req.getParameter("where"));
+      mergeData.put("order", req.getParameter("order"));
+      mergeData.put("offset", req.getParameter("offset"));
+      deliver(req, res, mergeData, templateConfirmString);
+    }
+    else {
+      if (confirmParam!= null && !confirmParam.equals("")) {
+        try {
+          mainModule.deleteById(idParam);
+
+          /** @todo the following two should be implied in
+           *  DatabaseContent */
+          DatabaseContentToTopics.getInstance().deleteByContentId(idParam);
+          DatabaseComment.getInstance().deleteByContentId(idParam);
+          DatabaseContentToMedia.getInstance().deleteByContentId(idParam);
+
+
+          //delete from lucene index, if any
+          String index = configuration.getString("IndexPath");
+          if (IndexReader.indexExists(index)){
+            IndexUtil.unindexID(idParam,index);
+          }
+
+        }
+        catch (Throwable e) {
+          throw new ServletModuleFailure(e);
+        }
+        list(req,res);
+      }
+      else {
+        // Datensatz anzeigen
+        _showObject(idParam, req, res);
+      }
+    }
+  }
+
+  public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+  {
+    String idParam = req.getParameter("id");
+    if (idParam == null)
+      throw new ServletModuleExc("Invalid call: id not supplied ");
+    _showObject(idParam, req, res);
+  }
+
+// methods for attaching media file
+  public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+  {
+    String  mediaIdParam = req.getParameter("mid");
+    String  idParam = req.getParameter("cid");
+    if (idParam == null||mediaIdParam==null) throw new ServletModuleExc("smod content :: attach :: cid/mid missing");
+
+    try {
+      EntityContent entContent = (EntityContent)mainModule.getById(idParam);
+      entContent.attach(mediaIdParam);
+    }
+    catch(Throwable e) {
+      logger.error("smod content :: attach :: could not get entityContent");
+    }
+
+    _showObject(idParam, req, res);
+  }
+
+  public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+  {
+    String  cidParam = req.getParameter("cid");
+    String  midParam = req.getParameter("mid");
+    if (cidParam == null)
+      throw new ServletModuleExc("smod content :: dettach :: cid missing");
+    if (midParam == null)
+      throw new ServletModuleExc("smod content :: dettach :: mid missing");
+
+    try {
+      EntityContent entContent = (EntityContent)mainModule.getById(cidParam);
+      entContent.dettach(cidParam,midParam);
+    }
+    catch(Throwable e) {
+      logger.error("smod content :: dettach :: could not get entityContent");
+    }
+
+    _showObject(cidParam, req, res);
+  }
+
+  public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+      String returnUrl = requestParser.getParameter("returnurl");
+
+      String idParam = aRequest.getParameter("id");
+      if (idParam == null)
+        throw new ServletModuleExc("Wrong call: (id) is missing");
+
+      Map withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());
+      String[] topic_id = aRequest.getParameterValues("to_topic");
+      String content_id = aRequest.getParameter("id");
+
+      withValues.put("is_produced", "0");
+      if (!withValues.containsKey("is_published"))
+        withValues.put("is_published","0");
+      if (!withValues.containsKey("is_html"))
+        withValues.put("is_html","0");
+
+      String id = mainModule.set(withValues);
+      DatabaseContentToTopics.getInstance().setTopics(aRequest.getParameter("id"),topic_id);
+
+      String whereParam = aRequest.getParameter("where");
+      String orderParam = aRequest.getParameter("order");
+
+      if (returnUrl!=null){
+        redirect(aResponse, returnUrl);
+      }
+      else
+        _showObject(idParam, aRequest, aResponse);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+/*
+  * HelperMethod shows the basic article editing form.
+  *
+  * if the "id" parameter is null, it means show an empty form to add a new
+  * article.
+*/
+  public void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)
+      throws ServletModuleExc {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+      EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();
+      Map article;
+      URLBuilder urlBuilder = new URLBuilder();
+
+      urlBuilder.setValue("module", "Content");
+      urlBuilder.setValue("do", "edit");
+      urlBuilder.setValue("id", id);
+      urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));
+
+      if (id!=null) {
+        responseData.put("new", Boolean.FALSE);
+        article = model.makeEntityAdapter("content", mainModule.getById(id));
+      }
+      else {
+        List fields = DatabaseContent.getInstance().getFields();
+        responseData.put("new", Boolean.TRUE);
+        article = new HashMap();
+        Iterator i = fields.iterator();
+        while (i.hasNext()) {
+          article.put(i.next(), null);
+        }
+
+        article.put("to_topics", null);
+
+        MirGlobal.localizer().adminInterface().initializeArticle(article);
+      }
+      responseData.put("article", article);
+
+      responseData.put("topics",
+          new EntityIteratorAdapter("", configuration.getString("Mir.Localizer.Admin.TopicListOrder"),
+          20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));
+
+
+
+      responseData.put("returnurl", requestParser.getParameter("returnurl"));
+      responseData.put("thisurl", urlBuilder.getQuery());
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, editTemplate);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void returnArticleList(
+       HttpServletRequest aRequest,
+       HttpServletResponse aResponse,
+       String aWhereClause,
+       String anOrderByClause,
+       int anOffset,
+       String aSelectArticleUrl) throws ServletModuleExc {
+
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+    URLBuilder urlBuilder = new URLBuilder();
+    EntityAdapterModel model;
+    int nrArticlesPerPage = 20;
+    int count;
+
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+      model = MirGlobal.localizer().dataModel().adapterModel();
+
+      Object articleList =
+          new CachingRewindableIterator(
+            new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrArticlesPerPage,
+               MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)
+      );
+
+      responseData.put("nexturl", null);
+      responseData.put("prevurl", null);
+
+      count=mainModule.getSize(aWhereClause);
+
+      urlBuilder.setValue("module", "Content");
+      urlBuilder.setValue("do", "list");
+      urlBuilder.setValue("where", aWhereClause);
+      urlBuilder.setValue("order", anOrderByClause);
+
+
+      urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));
+      urlBuilder.setValue("searchvalue", requestParser.getParameter("searchvalue"));
+      urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));
+      urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));
+      urlBuilder.setValue("searcharticletype", requestParser.getParameter("searcharticletype"));
+      urlBuilder.setValue("selectarticleurl", aSelectArticleUrl);
+
+      responseData.put("searchfield", requestParser.getParameter("searchfield"));
+      responseData.put("searchvalue", requestParser.getParameter("searchvalue"));
+      responseData.put("searchispublished", requestParser.getParameter("searchispublished"));
+      responseData.put("searchorder", requestParser.getParameter("searchorder"));
+      responseData.put("searcharticletype", requestParser.getParameter("searcharticletype"));
+      responseData.put("selectarticleurl", aSelectArticleUrl);
+
+      urlBuilder.setValue("offset", anOffset);
+      responseData.put("offset" , new Integer(anOffset).toString());
+      responseData.put("thisurl" , urlBuilder.getQuery());
+
+      if (count>=anOffset+nrArticlesPerPage) {
+        urlBuilder.setValue("offset", (anOffset + nrArticlesPerPage));
+        responseData.put("nexturl" , urlBuilder.getQuery());
+      }
+
+      if (anOffset>0) {
+        urlBuilder.setValue("offset", Math.max(anOffset - nrArticlesPerPage, 0));
+        responseData.put("prevurl" , urlBuilder.getQuery());
+      }
+
+      responseData.put("articles", articleList);
+
+      responseData.put("from" , Integer.toString(anOffset+1));
+      responseData.put("count", Integer.toString(count));
+      responseData.put("to", Integer.toString(Math.min(anOffset+nrArticlesPerPage, count)));
+      responseData.put("offset" , Integer.toString(anOffset));
+      responseData.put("order", anOrderByClause);
+      responseData.put("where" , aWhereClause);
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, listTemplate);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void selectparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      URLBuilder urlBuilder = new URLBuilder();
+
+      urlBuilder.setValue("module", "Content");
+      urlBuilder.setValue("do", "setparent");
+      urlBuilder.setValue("childid", requestParser.getParameter("id"));
+      urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));
+
+      returnArticleList(aRequest, aResponse, "", "", 0, urlBuilder.getQuery());
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void listchildren(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      String articleId = requestParser.getParameter("article_id");
+
+      if (articleId == null)
+        throw new ServletModuleExc("ServletModuleContent.listchildren: article_id not set!");
+
+      returnArticleList(aRequest, aResponse, "to_content = " + articleId, "", 0, null);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void setparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+    String articleId = aRequest.getParameter("childid");
+    String parentId  = aRequest.getParameter("id");
+    String returnUrl = aRequest.getParameter("returnurl");
+
+    try {
+      EntityContent article = (EntityContent) mainModule.getById(articleId);
+      article.setValueForProperty("to_content", parentId);
+      article.setProduced(false);
+      article.update();
+    }
+    catch(Throwable e) {
+      logger.error("ServletModuleContent.setparent: " + e.getMessage());
+      throw new ServletModuleFailure(e);
+    }
+
+    redirect(aResponse, returnUrl);
+  }
+
+  public void clearparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+    String articleId = requestParser.getParameter("id");
+    String returnUrl = requestParser.getParameter("returnurl");
+
+    try {
+      EntityContent article = (EntityContent) mainModule.getById(articleId);
+      article.setValueForProperty("to_content", "");
+      article.setProduced(false);
+      article.update();
+    }
+    catch(Throwable e) {
+      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+      logger.error("ServletModuleContent.clearparent: " + e.getMessage());
+
+      throw new ServletModuleFailure("ServletModuleContent.clearparent: " + e.getMessage(), e);
+    }
+
+    redirect(aResponse, returnUrl);
+  }
+
+  private EntityUsers _getUser(HttpServletRequest req)
+  {
+    HttpSession session=req.getSession(false);
+
+    return (EntityUsers)session.getAttribute("login.uid");
+  }
+}
index 862fe6e..1698666 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.io.File;\r
-import java.io.FileReader;\r
-import java.io.FileWriter;\r
-import java.io.FilenameFilter;\r
-import java.io.StringReader;\r
-import java.io.StringWriter;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.FileFunctions;\r
-import mir.util.HTTPRequestParser;\r
-import mir.util.URLBuilder;\r
-\r
-/*\r
- *  ServletModuleFileEdit -\r
- *  Allows one to do a basic edit of a file in a directory specified\r
- *  in the config file.\r
- *\r
- * @author $Author: zapata $\r
- * @version $Revision: 1.8 $ $Date: 2003/03/17 20:47:04 $\r
- *\r
- */\r
-\r
-public class ServletModuleFileEdit extends ServletModule\r
-{\r
-  private static ServletModuleFileEdit instance = new ServletModuleFileEdit();\r
-  public static ServletModule getInstance() { return instance; }\r
-\r
-  private File rootDirectory;\r
-  private FilenameFilter filter;\r
-  private FilenameFilter dirFilter;\r
-  private boolean recurse;\r
-\r
-  private ServletModuleFileEdit() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("ServletModule.FileEdit");\r
-\r
-    rootDirectory = new File(configuration.getString("ServletModule.FileEdit.FileDirectory"));\r
-    recurse = configuration.getString("ServletModule.FileEdit.Recursive", "").equals("1");\r
-\r
-    filter = new FileFunctions.RegExpFileFilter(configuration.getString("ServletModule.FileEdit.ExtFilter"));\r
-    dirFilter = new FileFunctions.DirectoryFilter();\r
-\r
-    templateListString =configuration.getString("ServletModule.FileEdit.ListTemplate");\r
-    templateObjektString =configuration.getString("ServletModule.FileEdit.ObjektTemplate");\r
-    templateConfirmString =configuration.getString("ServletModule.FileEdit.ConfirmTemplate");\r
-  }\r
-\r
-  public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    listSubDirectory("/", aRequest, aResponse);\r
-  }\r
-\r
-  public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      String filename = requestParser.getParameter("filename");\r
-      String subDirectory = requestParser.getParameterWithDefault("subdirectory", "");\r
-\r
-      if (filename == null)\r
-        throw new ServletModuleExc("No filename  specified");\r
-\r
-      editFile(filename, subDirectory, aRequest, aResponse);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void enter(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-      String directoryName = requestParser.getParameter("directory");\r
-      String subDirectoryName = requestParser.getParameter("subdirectory");\r
-\r
-      if (directoryName==null | subDirectoryName==null)\r
-        throw new ServletModuleExc("No directory/subDirectory specified");\r
-\r
-      listSubDirectory(subDirectoryName+File.separator+directoryName, aRequest, aResponse);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-  public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    String filename = aRequest.getParameter("filename");\r
-    String subDirectory = aRequest.getParameter("subdirectory");\r
-    String text = aRequest.getParameter("text");\r
-\r
-    try {\r
-      File f = new File(new File(rootDirectory, subDirectory), filename);\r
-\r
-      if (validateDirectory(f)) {\r
-        StringReader in = new StringReader(text);\r
-        FileWriter out = new FileWriter(f);\r
-\r
-        int c;\r
-        while ( (c = in.read()) != -1)\r
-          out.write(c);\r
-        in.close();\r
-        out.close();\r
-\r
-        editFile(filename, subDirectory, aRequest, aResponse);\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void listSubDirectory(String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-      File dir = new File(rootDirectory, aSubDirectory);\r
-\r
-      if (!validateDirectory(dir) || !dir.isDirectory()) {\r
-        dir = rootDirectory;\r
-        aSubDirectory = "";\r
-      }\r
-\r
-      responseData.put("filelist", Arrays.asList(dir.list(filter)));\r
-\r
-      if (recurse) {\r
-        List dirs = new Vector();\r
-        if (!dir.getCanonicalPath().equals(rootDirectory.getCanonicalPath()))\r
-          responseData.put("updir", new File(aSubDirectory).getParent());\r
-\r
-        dirs.addAll(Arrays.asList(dir.list(dirFilter)));\r
-\r
-        responseData.put("dirlist", dirs);\r
-      }\r
-      else {\r
-        responseData.put("dirlist", null);\r
-        responseData.put("updir", null);\r
-      }\r
-\r
-      responseData.put("subdirectory", aSubDirectory);\r
-\r
-      ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateListString);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void editFile(String aFileName, String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
-  {\r
-    try {\r
-      File f = new File(new File(rootDirectory, aSubDirectory), aFileName);\r
-\r
-      if (!validateDirectory(f) || f.isDirectory() || !validateFile(f)) {\r
-        listSubDirectory("", aRequest, aResponse);\r
-      }\r
-      else {\r
-        Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
-        URLBuilder urlBuilder = new URLBuilder();\r
-\r
-        urlBuilder.setValue("module", "FileEdit");\r
-        urlBuilder.setValue("do", "enter");\r
-        urlBuilder.setValue("directory", "");\r
-        urlBuilder.setValue("subdirectory", aSubDirectory);\r
-\r
-        FileReader in = new FileReader(f);\r
-        StringWriter out = new StringWriter();\r
-\r
-        int c;\r
-        while ( (c = in.read()) != -1)\r
-          out.write(c);\r
-        in.close();\r
-        out.close();\r
-\r
-        responseData.put("text", out.toString());\r
-        responseData.put("filename", aFileName);\r
-        responseData.put("subdirectory", aSubDirectory);\r
-        responseData.put("returnurl", urlBuilder.getQuery());\r
-\r
-        ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString);\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  protected boolean validateDirectory(File aFile) {\r
-    try {\r
-      return (aFile.getCanonicalPath().startsWith(rootDirectory.getCanonicalPath()));\r
-    }\r
-    catch (Throwable t) {\r
-      return false;\r
-    }\r
-  }\r
-\r
-  protected boolean validateFile(File aFile) {\r
-    try {\r
-      return filter.accept(aFile.getParentFile(), aFile.getName());\r
-    }\r
-    catch (Throwable t) {\r
-      return false;\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.Locale;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.util.FileFunctions;
+import mir.util.HTTPRequestParser;
+import mir.util.URLBuilder;
+
+/*
+ *  ServletModuleFileEdit -
+ *  Allows one to do a basic edit of a file in a directory specified
+ *  in the config file.
+ *
+ * @author $Author: zapata $
+ * @version $Revision: 1.9 $ $Date: 2003/04/09 02:06:09 $
+ *
+ */
+
+public class ServletModuleFileEdit extends ServletModule
+{
+  private static ServletModuleFileEdit instance = new ServletModuleFileEdit();
+  public static ServletModule getInstance() { return instance; }
+
+  private File rootDirectory;
+  private FilenameFilter filter;
+  private FilenameFilter dirFilter;
+  private boolean recurse;
+
+  private ServletModuleFileEdit() {
+    super();
+
+    logger = new LoggerWrapper("ServletModule.FileEdit");
+
+    rootDirectory = new File(configuration.getString("ServletModule.FileEdit.FileDirectory"));
+    recurse = configuration.getString("ServletModule.FileEdit.Recursive", "").equals("1");
+
+    filter = new FileFunctions.RegExpFileFilter(configuration.getString("ServletModule.FileEdit.ExtFilter"));
+    dirFilter = new FileFunctions.DirectoryFilter();
+
+    templateListString =configuration.getString("ServletModule.FileEdit.ListTemplate");
+    templateObjektString =configuration.getString("ServletModule.FileEdit.ObjektTemplate");
+    templateConfirmString =configuration.getString("ServletModule.FileEdit.ConfirmTemplate");
+  }
+
+  public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    listSubDirectory("/", aRequest, aResponse);
+  }
+
+  public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      String filename = requestParser.getParameter("filename");
+      String subDirectory = requestParser.getParameterWithDefault("subdirectory", "");
+
+      if (filename == null)
+        throw new ServletModuleExc("No filename  specified");
+
+      editFile(filename, subDirectory, aRequest, aResponse);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void enter(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+      String directoryName = requestParser.getParameter("directory");
+      String subDirectoryName = requestParser.getParameter("subdirectory");
+
+      if (directoryName==null | subDirectoryName==null)
+        throw new ServletModuleExc("No directory/subDirectory specified");
+
+      listSubDirectory(subDirectoryName+File.separator+directoryName, aRequest, aResponse);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+  public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    String filename = aRequest.getParameter("filename");
+    String subDirectory = aRequest.getParameter("subdirectory");
+    String text = aRequest.getParameter("text");
+
+    try {
+      File f = new File(new File(rootDirectory, subDirectory), filename);
+
+      if (validateDirectory(f)) {
+        StringReader in = new StringReader(text);
+        FileWriter out = new FileWriter(f);
+
+        int c;
+        while ( (c = in.read()) != -1)
+          out.write(c);
+        in.close();
+        out.close();
+
+        editFile(filename, subDirectory, aRequest, aResponse);
+      }
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void listSubDirectory(String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+      File dir = new File(rootDirectory, aSubDirectory);
+
+      if (!validateDirectory(dir) || !dir.isDirectory()) {
+        dir = rootDirectory;
+        aSubDirectory = "";
+      }
+
+      responseData.put("filelist", Arrays.asList(dir.list(filter)));
+
+      if (recurse) {
+        List dirs = new Vector();
+        if (!dir.getCanonicalPath().equals(rootDirectory.getCanonicalPath()))
+          responseData.put("updir", new File(aSubDirectory).getParent());
+
+        dirs.addAll(Arrays.asList(dir.list(dirFilter)));
+
+        responseData.put("dirlist", dirs);
+      }
+      else {
+        responseData.put("dirlist", null);
+        responseData.put("updir", null);
+      }
+
+      responseData.put("subdirectory", aSubDirectory);
+
+      ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateListString);
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void editFile(String aFileName, String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  {
+    try {
+      File f = new File(new File(rootDirectory, aSubDirectory), aFileName);
+
+      if (!validateDirectory(f) || f.isDirectory() || !validateFile(f)) {
+        listSubDirectory("", aRequest, aResponse);
+      }
+      else {
+        Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+        URLBuilder urlBuilder = new URLBuilder();
+
+        urlBuilder.setValue("module", "FileEdit");
+        urlBuilder.setValue("do", "enter");
+        urlBuilder.setValue("directory", "");
+        urlBuilder.setValue("subdirectory", aSubDirectory);
+
+        FileReader in = new FileReader(f);
+        StringWriter out = new StringWriter();
+
+        int c;
+        while ( (c = in.read()) != -1)
+          out.write(c);
+        in.close();
+        out.close();
+
+        responseData.put("text", out.toString());
+        responseData.put("filename", aFileName);
+        responseData.put("subdirectory", aSubDirectory);
+        responseData.put("returnurl", urlBuilder.getQuery());
+
+        ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString);
+      }
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  protected boolean validateDirectory(File aFile) {
+    try {
+      return (aFile.getCanonicalPath().startsWith(rootDirectory.getCanonicalPath()));
+    }
+    catch (Throwable t) {
+      return false;
+    }
+  }
+
+  protected boolean validateFile(File aFile) {
+    try {
+      return filter.accept(aFile.getParentFile(), aFile.getName());
+    }
+    catch (Throwable t) {
+      return false;
+    }
+  }
+}
index b7a6358..6da2e3c 100755 (executable)
@@ -115,7 +115,7 @@ public class ServletModuleHidden extends ServletModule
         }
       }
 // raus damit
-      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req));
     }
     catch (Throwable e) {
       throw new ServletModuleFailure(e);
index e854dcd..4cca206 100755 (executable)
@@ -100,7 +100,7 @@ public class ServletModuleLinksImcs extends ServletModule {
       modelRoot.put("languagelist", theLanguageList);
 
       if (theParentList == null || theParentList.getCount() == 0 || theParentList.getCount() > 1) {
-        HTMLTemplateProcessor.process(res, templateObjektString, modelRoot, res.getWriter(), getLocale(req));
+        HTMLTemplateProcessor.process(res, templateObjektString, modelRoot, res.getWriter(), getLocale(req), getFallbackLocale(req));
       }
       else {
         deliver(req, res, modelRoot, templateObjektString);
@@ -134,7 +134,6 @@ public class ServletModuleLinksImcs extends ServletModule {
       modelRoot.put("to_parent_id", parent);
       String language = req.getParameter("to_language");
       modelRoot.put("to_language", language);
-      modelRoot.put("language", getLanguage(req));
 
       String whereClause = "";
       boolean isFirst = true;
@@ -184,7 +183,7 @@ public class ServletModuleLinksImcs extends ServletModule {
       if (theImcsList.hasPrevBatch())
         modelRoot.put("prev", (new Integer(theImcsList.getPrevBatch())).toString());
 
-      HTMLTemplateProcessor.process(res, templateListString, modelRoot, res.getWriter(), getLocale(req));
+      HTMLTemplateProcessor.process(res, templateListString, modelRoot, res.getWriter(), getLocale(req), getFallbackLocale(req));
 
     }
     catch (Throwable e) {
index 363af6c..aa973b3 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.util.List;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.StringRoutines;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.entity.EntityUsers;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.module.ModuleComment;\r
-import mircoders.module.ModuleContent;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseContent;\r
-\r
-public class ServletModuleLocalizer extends ServletModule {\r
-  private static ServletModuleLocalizer instance = new ServletModuleLocalizer();\r
-  public static ServletModule getInstance() { return instance; }\r
-\r
-  private ModuleContent contentModule;\r
-  private ModuleComment commentModule;\r
-\r
-  private ServletModuleLocalizer() {\r
-    try {\r
-      contentModule = new ModuleContent(DatabaseContent.getInstance());\r
-      commentModule = new ModuleComment(DatabaseComment.getInstance());\r
-\r
-      logger = new LoggerWrapper("ServletModule.Localizer");\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("ServletModuleLocalizer could not be initialized: " + e.getMessage());\r
-    }\r
-  }\r
-\r
-  private EntityAdapter getActiveUser(HttpServletRequest aRequest) throws ServletModuleExc {\r
-    try {\r
-      HttpSession session = aRequest.getSession(false);\r
-      return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter\r
-          ("user", (EntityUsers) session.getAttribute("login.uid"));\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure("ServletModuleLocalizer.getActiveUser: " + e.getMessage(), e);\r
-    }\r
-  }\r
-\r
-  public void performCommentOperation(EntityAdapter aUser, String anId, String anOperation) {\r
-    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation;\r
-    EntityAdapter comment;\r
-    EntityComment entity;\r
-\r
-    try {\r
-      entity = (EntityComment) commentModule.getById(anId);\r
-\r
-      if (entity != null) {\r
-        comment = MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", entity);\r
-        operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(anOperation);\r
-        operation.perform(aUser, comment);\r
-        logger.info("Operation " + anOperation + " successfully performed on comment " + anId);\r
-      }\r
-      logger.error("Error while performing " + anOperation + " on comment " + anId + ": comment is null");\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Error while performing " + anOperation + " on comment " + anId + ": " + e.getMessage());\r
-    }\r
-  }\r
-\r
-  public void commentoperation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {\r
-    String commentIdString = aRequest.getParameter("id");\r
-    String operationString = aRequest.getParameter("operation");\r
-    String returnUrlString = aRequest.getParameter("returnurl");\r
-\r
-    performCommentOperation(getActiveUser(aRequest), commentIdString, operationString);\r
-\r
-    redirect(aResponse, returnUrlString);\r
-  }\r
-\r
-  public void commentoperationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {\r
-    String returnUrlString = aRequest.getParameter("returnurl");\r
-\r
-    String[] operations = aRequest.getParameterValues("operation");\r
-\r
-    for (int i=0; i<operations.length; i++) {\r
-      if (operations[i].length()>0) {\r
-        List parts = StringRoutines.splitString(operations[i], ";");\r
-\r
-        if (parts.size() != 2) {\r
-          logger.error("commentoperationbatch: operation string invalid: " +\r
-                       operations[i]);\r
-        }\r
-        else {\r
-          String commentIdString = (String) parts.get(0);\r
-          String operationString = (String) parts.get(1);\r
-\r
-          performCommentOperation(getActiveUser(aRequest), commentIdString, operationString);\r
-        }\r
-      }\r
-    }\r
-\r
-    redirect(aResponse, returnUrlString);\r
-  }\r
-\r
-  public void performArticleOperation(EntityAdapter aUser, String anId, String anOperation) {\r
-    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation;\r
-    EntityAdapter article;\r
-    EntityContent entity;\r
-\r
-    try {\r
-      entity = (EntityContent) contentModule.getById(anId);\r
-\r
-      if (entity != null) {\r
-        article = MirGlobal.localizer().dataModel().adapterModel().\r
-            makeEntityAdapter("content", entity);\r
-        operation = MirGlobal.localizer().adminInterface().\r
-            simpleArticleOperationForName(anOperation);\r
-        operation.perform(aUser, article);\r
-        logger.info("Operation " + anOperation + " successfully performed on article " + anId);\r
-      }\r
-      logger.error("Error while performing " + anOperation + " on article " + anId + ": article is null");\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Error while performing " + anOperation + " on article " + anId + ": " + e.getMessage());\r
-    }\r
-  }\r
-\r
-  public void articleoperation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {\r
-    String articleIdString = aRequest.getParameter("articleid");\r
-    String operationString = aRequest.getParameter("operation");\r
-    String returnUrlString = aRequest.getParameter("returnurl");\r
-\r
-    performArticleOperation(getActiveUser(aRequest), articleIdString, operationString);\r
-    redirect(aResponse, returnUrlString);\r
-  }\r
-\r
-  public void articleoperationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {\r
-    String returnUrlString = aRequest.getParameter("returnurl");\r
-\r
-    String[] operations = aRequest.getParameterValues("operation");\r
-\r
-    for (int i=0; i<operations.length; i++) {\r
-      if (operations[i].length()>0) {\r
-        List parts = StringRoutines.splitString(operations[i], ";");\r
-\r
-        if (parts.size() != 2) {\r
-          logger.error("articleoperationbatch: operation string invalid: " + operations[i]);\r
-        }\r
-        else {\r
-          String articleIdString = (String) parts.get(0);\r
-          String operationString = (String) parts.get(1);\r
-\r
-          performArticleOperation(getActiveUser(aRequest), articleIdString, operationString);\r
-        }\r
-      }\r
-    }\r
-\r
-    redirect(aResponse, returnUrlString);\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import mir.entity.adapter.EntityAdapter;
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.util.StringRoutines;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityUsers;
+import mircoders.global.MirGlobal;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.module.ModuleComment;
+import mircoders.module.ModuleContent;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseContent;
+
+public class ServletModuleLocalizer extends ServletModule {
+  private static ServletModuleLocalizer instance = new ServletModuleLocalizer();
+  public static ServletModule getInstance() { return instance; }
+
+  private ModuleContent contentModule;
+  private ModuleComment commentModule;
+
+  private ServletModuleLocalizer() {
+    try {
+      contentModule = new ModuleContent(DatabaseContent.getInstance());
+      commentModule = new ModuleComment(DatabaseComment.getInstance());
+
+      logger = new LoggerWrapper("ServletModule.Localizer");
+    }
+    catch (Exception e) {
+      logger.error("ServletModuleLocalizer could not be initialized: " + e.getMessage());
+    }
+  }
+
+  private EntityAdapter getActiveUser(HttpServletRequest aRequest) throws ServletModuleExc {
+    try {
+      HttpSession session = aRequest.getSession(false);
+      return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter
+          ("user", (EntityUsers) session.getAttribute("login.uid"));
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure("ServletModuleLocalizer.getActiveUser: " + e.getMessage(), e);
+    }
+  }
+
+  public void performCommentOperation(EntityAdapter aUser, String anId, String anOperation) {
+    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation;
+    EntityAdapter comment;
+    EntityComment entity;
+
+    try {
+      entity = (EntityComment) commentModule.getById(anId);
+
+      if (entity != null) {
+        comment = MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", entity);
+        operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(anOperation);
+        operation.perform(aUser, comment);
+        logger.info("Operation " + anOperation + " successfully performed on comment " + anId);
+      }
+      logger.error("Error while performing " + anOperation + " on comment " + anId + ": comment is null");
+    }
+    catch (Throwable e) {
+      logger.error("Error while performing " + anOperation + " on comment " + anId + ": " + e.getMessage());
+    }
+  }
+
+  public void commentoperation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String commentIdString = aRequest.getParameter("id");
+    String operationString = aRequest.getParameter("operation");
+    String returnUrlString = aRequest.getParameter("returnurl");
+
+    performCommentOperation(getActiveUser(aRequest), commentIdString, operationString);
+
+    redirect(aResponse, returnUrlString);
+  }
+
+  public void commentoperationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String returnUrlString = aRequest.getParameter("returnurl");
+
+    String[] operations = aRequest.getParameterValues("operation");
+
+    for (int i=0; i<operations.length; i++) {
+      if (operations[i].length()>0) {
+        List parts = StringRoutines.splitString(operations[i], ";");
+
+        if (parts.size() != 2) {
+          logger.error("commentoperationbatch: operation string invalid: " +
+                       operations[i]);
+        }
+        else {
+          String commentIdString = (String) parts.get(0);
+          String operationString = (String) parts.get(1);
+
+          performCommentOperation(getActiveUser(aRequest), commentIdString, operationString);
+        }
+      }
+    }
+
+    redirect(aResponse, returnUrlString);
+  }
+
+  public void performArticleOperation(EntityAdapter aUser, String anId, String anOperation) {
+    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation;
+    EntityAdapter article;
+    EntityContent entity;
+
+    try {
+      entity = (EntityContent) contentModule.getById(anId);
+
+      if (entity != null) {
+        article = MirGlobal.localizer().dataModel().adapterModel().
+            makeEntityAdapter("content", entity);
+        operation = MirGlobal.localizer().adminInterface().
+            simpleArticleOperationForName(anOperation);
+        operation.perform(aUser, article);
+        logger.info("Operation " + anOperation + " successfully performed on article " + anId);
+      }
+      logger.error("Error while performing " + anOperation + " on article " + anId + ": article is null");
+    }
+    catch (Throwable e) {
+      logger.error("Error while performing " + anOperation + " on article " + anId + ": " + e.getMessage());
+    }
+  }
+
+  public void articleoperation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String articleIdString = aRequest.getParameter("articleid");
+    String operationString = aRequest.getParameter("operation");
+    String returnUrlString = aRequest.getParameter("returnurl");
+
+    performArticleOperation(getActiveUser(aRequest), articleIdString, operationString);
+    redirect(aResponse, returnUrlString);
+  }
+
+  public void articleoperationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String returnUrlString = aRequest.getParameter("returnurl");
+
+    String[] operations = aRequest.getParameterValues("operation");
+
+    for (int i=0; i<operations.length; i++) {
+      if (operations[i].length()>0) {
+        List parts = StringRoutines.splitString(operations[i], ";");
+
+        if (parts.size() != 2) {
+          logger.error("articleoperationbatch: operation string invalid: " + operations[i]);
+        }
+        else {
+          String articleIdString = (String) parts.get(0);
+          String operationString = (String) parts.get(1);
+
+          performArticleOperation(getActiveUser(aRequest), articleIdString, operationString);
+        }
+      }
+    }
+
+    redirect(aResponse, returnUrlString);
+  }
+
 }
\ No newline at end of file
index cedb77a..8d10cf4 100755 (executable)
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.servlet;
-
-import java.net.URLEncoder;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.misc.HTMLTemplateProcessor;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleExc;
-import mir.servlet.ServletModuleFailure;
-import mir.storage.StorageObjectFailure;
-import mircoders.module.ModuleMessage;
-import mircoders.storage.DatabaseMessages;
-import freemarker.template.SimpleHash;
-
-/**
- * Title:       ServletModuleMessage
- * Description:
- * Copyright:   Copyright (c) 2001-2002
- * Company:     mir-coders
- * @author
- * @version 1.0
- */
-
-
-public class ServletModuleMessage extends ServletModule
-{
-
-  // Singelton / Kontruktor
-
-  private static ServletModuleMessage instance = new ServletModuleMessage();
-  public static ServletModule getInstance() { return instance; }
-
-  private ServletModuleMessage() {
-    super();
-    logger = new LoggerWrapper("ServletModule.Messages");
-
-    templateListString = configuration.getString("ServletModule.Messages.ListTemplate");
-    templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate");
-    templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate");
-
-    try {
-      mainModule = new ModuleMessage(DatabaseMessages.getInstance());
-    }
-    catch (StorageObjectFailure e) {
-      logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage());
-
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
-  {
-// fetch and deliver
-    try {
-      SimpleHash mergeData = new SimpleHash();
-      String offset = req.getParameter("offset");
-      if (offset==null || offset.equals("")) offset="0";
-      mergeData.put("offset",offset);
-      EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
-      mergeData.put("contentlist",theList);
-      if(theList.getOrder()!=null) {
-        mergeData.put("order", theList.getOrder());
-        mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
-      }
-      mergeData.put("count", (new Integer(theList.getCount())).toString());
-      mergeData.put("from", (new Integer(theList.getFrom())).toString());
-      mergeData.put("to", (new Integer(theList.getTo())).toString());
-      if (theList.hasNextBatch())
-        mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
-      if (theList.hasPrevBatch())
-        mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
-
-      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
-
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-
-}
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.servlet;\r
+\r
+import java.net.URLEncoder;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+import freemarker.template.SimpleHash;\r
+import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
+import mir.misc.HTMLTemplateProcessor;\r
+import mir.servlet.ServletModule;\r
+import mir.servlet.ServletModuleExc;\r
+import mir.servlet.ServletModuleFailure;\r
+import mir.storage.StorageObjectFailure;\r
+import mircoders.module.ModuleMessage;\r
+import mircoders.storage.DatabaseMessages;\r
+\r
+/**\r
+ * Title:       ServletModuleMessage\r
+ * Description:\r
+ * Copyright:   Copyright (c) 2001-2002\r
+ * Company:     mir-coders\r
+ * @author\r
+ * @version 1.0\r
+ */\r
+\r
+\r
+public class ServletModuleMessage extends ServletModule\r
+{\r
+\r
+  // Singelton / Kontruktor\r
+\r
+  private static ServletModuleMessage instance = new ServletModuleMessage();\r
+  public static ServletModule getInstance() { return instance; }\r
+\r
+  private ServletModuleMessage() {\r
+    super();\r
+    logger = new LoggerWrapper("ServletModule.Messages");\r
+\r
+    templateListString = configuration.getString("ServletModule.Messages.ListTemplate");\r
+    templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate");\r
+    templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate");\r
+\r
+    try {\r
+      mainModule = new ModuleMessage(DatabaseMessages.getInstance());\r
+    }\r
+    catch (StorageObjectFailure e) {\r
+      logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage());\r
+\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+  public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
+  {\r
+// fetch and deliver\r
+    try {\r
+      SimpleHash mergeData = new SimpleHash();\r
+      String offset = req.getParameter("offset");\r
+      if (offset==null || offset.equals("")) offset="0";\r
+      mergeData.put("offset",offset);\r
+      EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());\r
+      mergeData.put("contentlist",theList);\r
+      if(theList.getOrder()!=null) {\r
+        mergeData.put("order", theList.getOrder());\r
+        mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));\r
+      }\r
+      mergeData.put("count", (new Integer(theList.getCount())).toString());\r
+      mergeData.put("from", (new Integer(theList.getFrom())).toString());\r
+      mergeData.put("to", (new Integer(theList.getTo())).toString());\r
+      if (theList.hasNextBatch())\r
+        mergeData.put("next", (new Integer(theList.getNextBatch())).toString());\r
+      if (theList.hasPrevBatch())\r
+        mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());\r
+\r
+      HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req));\r
+\r
+    }\r
+    catch (Throwable e) {\r
+      throw new ServletModuleFailure(e);\r
+    }\r
+  }\r
+\r
+\r
+}\r
index d15578a..d2e4811 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileReader;\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.io.StringWriter;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Collections;\r
-import java.util.Date;\r
-import java.util.Enumeration;\r
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.ListIterator;\r
-import java.util.Map;\r
-import java.util.Random;\r
-import java.util.Set;\r
-import java.util.Vector;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-\r
-import org.apache.commons.net.smtp.SMTPClient;\r
-import org.apache.commons.net.smtp.SMTPReply;\r
-import org.apache.fop.apps.Driver;\r
-import org.apache.fop.apps.XSLTInputHandler;\r
-import org.apache.log.Hierarchy;\r
-import org.apache.log.Priority;\r
-import org.apache.lucene.analysis.standard.StandardAnalyzer;\r
-import org.apache.lucene.document.Document;\r
-import org.apache.lucene.queryParser.QueryParser;\r
-import org.apache.lucene.search.Hits;\r
-import org.apache.lucene.search.IndexSearcher;\r
-import org.apache.lucene.search.Query;\r
-import org.apache.lucene.search.Searcher;\r
-import org.apache.struts.util.MessageResources;\r
-import mir.entity.Entity;\r
-import mir.entity.EntityList;\r
-import mir.generator.Generator;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.FileHandler;\r
-import mir.misc.StringUtil;\r
-import mir.misc.WebdbMultipartRequest;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.servlet.ServletModuleUserExc;\r
-import mir.storage.StorageObjectFailure;\r
-import mir.util.ExceptionFunctions;\r
-import mir.util.HTTPRequestParser;\r
-import mir.util.StringRoutines;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.media.MediaRequest;\r
-import mircoders.media.UnsupportedMediaFormatExc;\r
-import mircoders.module.ModuleComment;\r
-import mircoders.module.ModuleContent;\r
-import mircoders.module.ModuleImages;\r
-import mircoders.module.ModuleTopics;\r
-import mircoders.search.AudioSearchTerm;\r
-import mircoders.search.ContentSearchTerm;\r
-import mircoders.search.ImagesSearchTerm;\r
-import mircoders.search.KeywordSearchTerm;\r
-import mircoders.search.TextSearchTerm;\r
-import mircoders.search.TopicSearchTerm;\r
-import mircoders.search.UnIndexedSearchTerm;\r
-import mircoders.search.VideoSearchTerm;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseContent;\r
-import mircoders.storage.DatabaseContentToMedia;\r
-import mircoders.storage.DatabaseContentToTopics;\r
-import mircoders.storage.DatabaseImages;\r
-import mircoders.storage.DatabaseLanguage;\r
-import mircoders.storage.DatabaseTopics;\r
-\r
-/*\r
- *  ServletModuleOpenIndy -\r
- *   is the open-access-servlet, which is responsible for\r
- *    adding comments to articles &\r
- *    open-postings to the newswire\r
- *\r
- * @author mir-coders group\r
- * @version $Id: ServletModuleOpenIndy.java,v 1.70 2003/04/02 22:15:03 zapata Exp $\r
- *\r
- */\r
-\r
-public class ServletModuleOpenIndy extends ServletModule\r
-{\r
-\r
-  private String        commentFormTemplate, commentFormDoneTemplate, commentFormDupeTemplate;\r
-  private String        postingFormTemplate, postingFormDoneTemplate, postingFormDupeTemplate;\r
-  private String        searchResultsTemplate;\r
-  private String        prepareMailTemplate,sentMailTemplate;\r
-  private ModuleContent contentModule;\r
-  private ModuleComment commentModule;\r
-  private ModuleImages  imageModule;\r
-  private ModuleTopics  topicsModule;\r
-  private String        directOp ="yes";\r
-  // Singelton / Kontruktor\r
-  private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();\r
-  public static ServletModule getInstance() { return instance; }\r
-\r
-  private ServletModuleOpenIndy() {\r
-    super();\r
-    try {\r
-      logger = new LoggerWrapper("ServletModule.OpenIndy");\r
-\r
-      commentFormTemplate = configuration.getString("ServletModule.OpenIndy.CommentTemplate");\r
-      commentFormDoneTemplate = configuration.getString("ServletModule.OpenIndy.CommentDoneTemplate");\r
-      commentFormDupeTemplate = configuration.getString("ServletModule.OpenIndy.CommentDupeTemplate");\r
-      postingFormTemplate = configuration.getString("ServletModule.OpenIndy.PostingTemplate");\r
-      postingFormDoneTemplate = configuration.getString("ServletModule.OpenIndy.PostingDoneTemplate");\r
-      postingFormDupeTemplate = configuration.getString("ServletModule.OpenIndy.PostingDupeTemplate");\r
-      searchResultsTemplate = configuration.getString("ServletModule.OpenIndy.SearchResultsTemplate");\r
-      prepareMailTemplate = configuration.getString("ServletModule.OpenIndy.PrepareMailTemplate");\r
-      sentMailTemplate = configuration.getString("ServletModule.OpenIndy.SentMailTemplate");\r
-      directOp = configuration.getString("DirectOpenposting").toLowerCase();\r
-      mainModule = new ModuleComment(DatabaseComment.getInstance());\r
-      contentModule = new ModuleContent(DatabaseContent.getInstance());\r
-      topicsModule = new ModuleTopics(DatabaseTopics.getInstance());\r
-      imageModule = new ModuleImages(DatabaseImages.getInstance());\r
-      defaultAction="addposting";\r
-    }\r
-    catch (StorageObjectFailure e) {\r
-      logger.error("servletmoduleopenindy could not be initialized: " + e.getMessage());\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Method to return an "apology" when open postings are disabled\r
-   *\r
-   * @param aRequest\r
-   * @param aResponse\r
-   * @throws ServletModuleExc\r
-   * @throws ServletModuleUserExc\r
-   * @throws ServletModuleFailure\r
-   */\r
-  public void openPostingDisabled(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {\r
-    deliver(aRequest, aResponse, (Map) null, null,\r
-       configuration.getString("ServletModule.OpenIndy.PostingDisabledTemplate"));\r
-  }\r
-\r
-\r
-  /**\r
-   *  Method for making a comment\r
-   */\r
-\r
-  public void addcomment(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure\r
-  {\r
-    if (MirGlobal.abuse().getOpenPostingDisabled()) {\r
-      openPostingDisabled(req, res);\r
-\r
-      return;\r
-    }\r
-\r
-    String aid = req.getParameter("aid"); // the article id the comment will belong to\r
-/*\r
-    String language = req.getParameter("language");\r
- */\r
-\r
-    if (aid!=null && !aid.equals("")) {\r
-      try {\r
-        Map mergeData = new HashMap();\r
-\r
-        // onetimepasswd\r
-        if (MirGlobal.abuse().getOpenPostingPassword()) {\r
-          String passwd = this.createOneTimePasswd();\r
-          HttpSession session = req.getSession(false);\r
-          session.setAttribute("passwd", passwd);\r
-          mergeData.put("passwd", passwd);\r
-        }\r
-        else {\r
-          mergeData.put("passwd", (String) null);\r
-        }\r
-/*\r
-        if (language != null) {\r
-          HttpSession session = req.getSession(false);\r
-          session.setAttribute("Locale", new Locale(language, ""));\r
-          session.setAttribute("language", language);\r
-        }\r
-*/\r
-        mergeData.put("aid", aid);\r
-\r
-        Map extraInfo = new HashMap();\r
-        extraInfo.put("languagePopUpData", DatabaseLanguage.getInstance().getPopupData());\r
-\r
-        deliver(req, res, mergeData, extraInfo, commentFormTemplate);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new ServletModuleFailure("ServletModuleOpenIndy.addcomment: " + t.getMessage(), t);\r
-      }\r
-    }\r
-    else throw new ServletModuleExc("aid not set!");\r
-  }\r
-\r
-  /**\r
-   *  Method for inserting a comment into the Database and delivering\r
-   *  the commentDone Page\r
-   */\r
-\r
-  public void inscomment(HttpServletRequest req, HttpServletResponse res)\r
-    throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure\r
-  {\r
-    if (MirGlobal.abuse().getOpenPostingDisabled()) {\r
-      openPostingDisabled(req, res);\r
-\r
-      return;\r
-    }\r
-\r
-    String aid = req.getParameter("to_media"); // the article id the comment will belong to\r
-    if (aid!=null && !aid.equals(""))\r
-      {\r
-        // ok, collecting data from form\r
-        try {\r
-          Map withValues = getIntersectingValues(req, DatabaseComment.getInstance());\r
-\r
-          //no html in comments(for now)\r
-          for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){\r
-            String k=(String)i.next();\r
-            String v=(String)withValues.get(k);\r
-\r
-            withValues.put(k,StringUtil.removeHTMLTags(v));\r
-          }\r
-          withValues.put("is_published","1");\r
-          withValues.put("to_comment_status","1");\r
-\r
-          //checking the onetimepasswd\r
-          HttpSession session = req.getSession(false);\r
-          String sessionPasswd = (String) session.getAttribute("passwd");\r
-          if ( sessionPasswd != null){\r
-            String passwd = req.getParameter("passwd");\r
-            if ( passwd == null || passwd.length()==0) {\r
-              throw new ServletModuleUserExc("comment.error.missingpassword", new String[] {});\r
-            }\r
-            if (!sessionPasswd.equals(passwd)) {\r
-              throw new ServletModuleUserExc("comment.error.invalidpassword", new String[] {});\r
-            }\r
-            session.invalidate();\r
-          }\r
-\r
-          String id = mainModule.add(withValues);\r
-\r
-          if(id==null){\r
-            deliver(req, res, (Map) null, null, commentFormDupeTemplate);\r
-          }\r
-          else {\r
-            MirGlobal.abuse().logComment(req.getRemoteAddr(), id, new Date(), (String) req.getHeader("User-Agent"));\r
-\r
-            DatabaseContent.getInstance().setUnproduced("id="+aid);\r
-\r
-            try {\r
-              EntityComment comment = (EntityComment) DatabaseComment.getInstance().selectById(id);\r
-              MirGlobal.abuse().checkComment(comment, req, res);\r
-              MirGlobal.localizer().openPostings().afterCommentPosting(comment);\r
-            }\r
-            catch (Throwable t) {\r
-              throw new ServletModuleExc(t.getMessage());\r
-            }\r
-          }\r
-\r
-          // redirecting to url\r
-          // should implement back to article\r
-          Map mergeData = new HashMap();\r
-          deliver(req, res, mergeData, null, commentFormDoneTemplate);\r
-        }\r
-        catch (Throwable e) {\r
-          throw new ServletModuleFailure(e);\r
-        }\r
-      }\r
-    else throw new ServletModuleExc("aid not set!");\r
-\r
-  }\r
-\r
-  /**\r
-   *  Method for delivering the form-Page for open posting\r
-   */\r
-\r
-  public void addposting(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure\r
-  {\r
-    try {\r
-      if (MirGlobal.abuse().getOpenPostingDisabled()) {\r
-        openPostingDisabled(req, res);\r
-\r
-        return;\r
-      }\r
-\r
-      Map mergeData = new HashMap();\r
-\r
-      // onetimepasswd\r
-      if (MirGlobal.abuse().getOpenPostingPassword()) {\r
-        String passwd = this.createOneTimePasswd();\r
-        HttpSession session = req.getSession(false);\r
-        session.setAttribute("passwd", passwd);\r
-        mergeData.put("passwd", passwd);\r
-      }\r
-      else {\r
-        mergeData.put("passwd", (String)null);\r
-      }\r
-\r
-      String maxMedia = configuration.getString("ServletModule.OpenIndy.MaxMediaUploadItems");\r
-      String defaultMedia = configuration.getString("ServletModule.OpenIndy.DefaultMediaUploadItems");\r
-      String numOfMedia = req.getParameter("medianum");\r
-\r
-      if (numOfMedia == null || numOfMedia.equals("")) {\r
-        numOfMedia = defaultMedia;\r
-      }\r
-      else if (Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) {\r
-        numOfMedia = maxMedia;\r
-      }\r
-\r
-      int mediaNum = Integer.parseInt(numOfMedia);\r
-      List mediaFields = new Vector();\r
-      for (int i = 0; i < mediaNum; i++) {\r
-        Integer mNum = new Integer(i + 1);\r
-        mediaFields.add(mNum.toString());\r
-      }\r
-      mergeData.put("medianum", numOfMedia);\r
-      mergeData.put("mediafields", mediaFields);\r
-      mergeData.put("to_topic", null);\r
-\r
-      Map extraInfo = new HashMap();\r
-      extraInfo.put("languagePopUpData", DatabaseLanguage.getInstance().getPopupData());\r
-      extraInfo.put("themenPopupData", topicsModule.getTopicsAsSimpleList());\r
-\r
-      extraInfo.put("topics", topicsModule.getTopicsList());\r
-      deliver(req, res, mergeData, extraInfo, postingFormTemplate);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method for inserting an open posting into the Database and delivering\r
-   *  the postingDone Page\r
-   */\r
-\r
-  public void insposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure\r
-  {\r
-    if (MirGlobal.abuse().getOpenPostingDisabled()) {\r
-      openPostingDisabled(req, res);\r
-\r
-      return;\r
-    }\r
-\r
-    Map mergeData = new HashMap();\r
-    boolean setMedia=false;\r
-    boolean setTopic = false;\r
-\r
-    try {\r
-\r
-      WebdbMultipartRequest mp = null;\r
-      EntityList mediaList = null;\r
-      try {\r
-        // new MediaRequest, "1" is the id for the openPosting user\r
-        MediaRequest mediaReq = new MediaRequest("1", true);\r
-        mp = new WebdbMultipartRequest(req, (FileHandler)mediaReq);\r
-        mediaList = mediaReq.getEntityList();\r
-      }\r
-      catch (Throwable e) {\r
-        throw new ServletModuleFailure(e);\r
-      }\r
-\r
-      Map withValues = mp.getParameters();\r
-\r
-      //checking the onetimepasswd\r
-      HttpSession session = req.getSession(false);\r
-      String sessionPasswd = (String) session.getAttribute("passwd");\r
-      if (sessionPasswd != null){\r
-        String passwd = (String) withValues.get("passwd");\r
-\r
-        logger.debug("session password = " + sessionPasswd + ", form password = " + passwd);\r
-\r
-        if ( passwd == null || passwd.length()==0) {\r
-          throw new ServletModuleUserExc("posting.error.missingpassword", new String[] {});\r
-        }\r
-        if (!sessionPasswd.equals(passwd)) {\r
-          throw new ServletModuleUserExc("posting.error.invalidpassword", new String[] {});\r
-        }\r
-        session.invalidate();\r
-      }\r
-\r
-      if ((((String)withValues.get("title")).length() == 0) ||\r
-          (((String)withValues.get("description")).length() == 0) ||\r
-          (((String)withValues.get("content_data")).length() == 0))\r
-        throw new ServletModuleUserExc("posting.error.missingfield", new String[] {});\r
-\r
-      // call the routines that escape html\r
-\r
-      for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){\r
-        String k=(String)i.next();\r
-        String v=(String)withValues.get(k);\r
-\r
-        if (k.equals("content_data")){\r
-          //this doesn't quite work yet, so for now, all html goes\r
-          //withValues.put(k,StringUtil.approveHTMLTags(v));\r
-          withValues.put(k,StringUtil.deleteForbiddenTags(v));\r
-        }\r
-        else if (k.equals("description")) {\r
-          String tmp = StringUtil.deleteForbiddenTags(v);\r
-          withValues.put(k,StringUtil.deleteHTMLTableTags(tmp));\r
-        }\r
-        else {\r
-          withValues.put(k,StringUtil.removeHTMLTags(v));\r
-        }\r
-\r
-      }\r
-\r
-      withValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));\r
-      withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));\r
-      withValues.put("is_produced", "0");\r
-      withValues.put("is_published","1");\r
-      if (directOp.equals("yes"))\r
-        withValues.put("to_article_type","1");\r
-\r
-      withValues.put("to_publisher","1");\r
-\r
-      // inserting  content into database\r
-      String cid = contentModule.add(withValues);\r
-      logger.debug("id: "+cid);\r
-      //insert was not successfull\r
-      if(cid==null){\r
-\r
-        //How do we know that it was not succesful cause of a\r
-        //dupe, what if it failed cause of "No space left on device"?\r
-        //Or is there something I am missing? Wouldn't it be better\r
-        //to have an explicit dupe check and then insert? I have no\r
-        //idea what I am talking about. this comment is in case\r
-        //I forget to explicitely ask. -mh\r
-        deliver(req, res, mergeData, null, postingFormDupeTemplate);\r
-        return;\r
-      }\r
-\r
-      MirGlobal.abuse().logArticle(req.getRemoteAddr(), cid, new Date(), (String) req.getHeader("User-Agent"));\r
-\r
-      String[] to_topicsArr = mp.getParameterValues("to_topic");\r
-\r
-      if (to_topicsArr != null && to_topicsArr.length > 0) {\r
-        try{\r
-          DatabaseContentToTopics.getInstance().setTopics(cid,to_topicsArr);\r
-          setTopic = true;\r
-        }\r
-        catch (Throwable e) {\r
-          logger.error("setting content_x_topic failed");\r
-          contentModule.deleteById(cid);\r
-          throw new ServletModuleFailure("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString(), e);\r
-        } //end try\r
-      } //end if\r
-\r
-      //if we're here all is ok... associate the media to the article\r
-      for(int i=0;i<mediaList.size();i++) {\r
-        Entity mediaEnt = (Entity)mediaList.elementAt(i);\r
-        DatabaseContentToMedia.getInstance().addMedia(cid,mediaEnt.getId());\r
-      }\r
-\r
-      EntityContent article = (EntityContent) contentModule.getById(cid);\r
-\r
-      try {\r
-        MirGlobal.abuse().checkArticle(article, req, res);\r
-        MirGlobal.localizer().openPostings().afterContentPosting(article);\r
-      }\r
-      catch (Throwable t) {\r
-        logger.error("Error while post-processing article: " + t.getMessage());\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      Throwable cause = ExceptionFunctions.traceCauseException(e);\r
-\r
-      if (cause instanceof UnsupportedMediaFormatExc) {\r
-        throw new ServletModuleUserExc("media.unsupportedformat", new String[] {} );\r
-      }\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-\r
-    deliver(req, res, mergeData, null, postingFormDoneTemplate);\r
-  }\r
-\r
-  /**\r
-   * Method for preparing and sending a content as an email message\r
-   */\r
-\r
-  public void mail(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure\r
-  {\r
-    String aid = req.getParameter("mail_aid");\r
-    if (aid == null){\r
-      throw new ServletModuleExc("An article id must be specified in requests to email an article.  Something therefore went badly wrong....");\r
-    }\r
-\r
-    String to = req.getParameter("mail_to");\r
-    String from = req.getParameter("mail_from");\r
-    String from_name = req.getParameter("mail_from_name");\r
-    String comment = req.getParameter("mail_comment");\r
-    String mail_language = req.getParameter("mail_language");\r
-\r
-    Map mergeData = new HashMap();\r
-\r
-    if (to == null || from == null || from_name == null|| to.equals("") || from.equals("") || from_name.equals("") || mail_language == null || mail_language.equals("")){\r
-\r
-      for (Enumeration theParams = req.getParameterNames(); theParams.hasMoreElements() ;) {\r
-        String pName=(String)theParams.nextElement();\r
-        if (pName.startsWith("mail_")){\r
-          mergeData.put( pName,req.getParameter(pName) );\r
-        }\r
-      }\r
-\r
-      deliver(req, res, mergeData, null, prepareMailTemplate);\r
-    }\r
-    else {\r
-      //run checks on to and from and mail_language to make sure no monkey business occurring\r
-      if (mail_language.indexOf('.') != -1 || mail_language.indexOf('/') != -1 ) {\r
-        throw new ServletModuleExc("Invalid language");\r
-      }\r
-      if (to.indexOf('\n') != -1\r
-          || to.indexOf('\r') != -1\r
-          || to.indexOf(',') != -1) {\r
-        throw new ServletModuleUserExc("email.error.invalidtoaddress", new String[] {to});\r
-      }\r
-      if (from.indexOf('\n') != -1 || from.indexOf('\r') != -1 || from.indexOf(',') != -1 ) {\r
-        throw new ServletModuleUserExc("email.error.invalidfromaddress", new String[] {from});\r
-      }\r
-\r
-\r
-      EntityContent contentEnt;\r
-      try{\r
-        contentEnt = (EntityContent)contentModule.getById(aid);\r
-      }\r
-      catch (Throwable e){\r
-        throw new ServletModuleFailure("Couldn't get content for article "+aid + ": " + e.getMessage(), e);\r
-      }\r
-      String producerStorageRoot=configuration.getString("Producer.StorageRoot");\r
-      String producerDocRoot=configuration.getString("Producer.DocRoot");\r
-      String publishPath = contentEnt.getValue("publish_path");\r
-      String txtFilePath = producerStorageRoot + producerDocRoot + "/" + mail_language +\r
-                                                                                                         publishPath + "/" + aid + ".txt";\r
-\r
-\r
-      File inputFile = new File(txtFilePath);\r
-      String content;\r
-\r
-      try{\r
-        FileReader in = new FileReader(inputFile);\r
-        StringWriter out = new StringWriter();\r
-        int c;\r
-        while ((c = in.read()) != -1)\r
-          out.write(c);\r
-        in.close();\r
-        content= out.toString();\r
-      }\r
-      catch (FileNotFoundException e){\r
-        throw new ServletModuleFailure("No text file found in " + txtFilePath, e);\r
-      }\r
-      catch (IOException e){\r
-        throw new ServletModuleFailure("Problem reading file in " + txtFilePath, e);\r
-      }\r
-      // add some headers\r
-      content = "To: " + to + "\nReply-To: "+ from + "\n" + content;\r
-      // put in the comment where it should go\r
-      if (comment != null) {\r
-        String commentTextToInsert = "\n\nAttached comment from " + from_name + ":\n" + comment;\r
-        try {\r
-          content=StringRoutines.performRegularExpressionReplacement(content,"!COMMENT!",commentTextToInsert);\r
-        }\r
-        catch (Throwable e){\r
-          throw new ServletModuleFailure("Problem doing regular expression replacement " + e.toString(), e);\r
-        }\r
-      }\r
-      else{\r
-        try {\r
-          content=StringRoutines.performRegularExpressionReplacement(content,"!COMMENT!","");\r
-        }\r
-        catch (Throwable e){\r
-          throw new ServletModuleFailure("Problem doing regular expression replacement " + e.toString(), e);\r
-        }\r
-      }\r
-\r
-      SMTPClient client=new SMTPClient();\r
-      try {\r
-        int reply;\r
-        client.connect(configuration.getString("ServletModule.OpenIndy.SMTPServer"));\r
-\r
-        reply = client.getReplyCode();\r
-\r
-        if (!SMTPReply.isPositiveCompletion(reply)) {\r
-          client.disconnect();\r
-          throw new ServletModuleExc("SMTP server refused connection.");\r
-        }\r
-\r
-        client.sendSimpleMessage(configuration.getString("ServletModule.OpenIndy.EmailIsFrom"), to, content);\r
-\r
-        client.disconnect();\r
-        //mission accomplished\r
-        deliver(req, res, mergeData, null, sentMailTemplate);\r
-      }\r
-      catch(IOException e) {\r
-        if(client.isConnected()) {\r
-          try {\r
-            client.disconnect();\r
-          } catch(IOException f) {\r
-            // do nothing\r
-          }\r
-        }\r
-        throw new ServletModuleFailure(e);\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Method for querying a lucene index\r
-   *\r
-   * @param req\r
-   * @param res\r
-   * @throws ServletModuleExc\r
-   * @throws ServletModuleUserExc\r
-   * @throws ServletModuleFailure\r
-   */\r
-\r
-  public void search(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {\r
-    try {\r
-      final String[] search_variables = { "search_content", "search_boolean", "search_creator",\r
-          "search_topic", "search_hasImages", "search_hasAudio", "search_hasVideo", "search_sort",\r
-          "search_submit", "search_back", "search_forward" };\r
-      HTTPRequestParser requestParser = new HTTPRequestParser(req);\r
-\r
-      int increment=10;\r
-\r
-      HttpSession session = req.getSession(false);\r
-\r
-      String queryString="";\r
-\r
-      Map mergeData = new HashMap();\r
-\r
-      KeywordSearchTerm dateTerm = new KeywordSearchTerm("date_formatted","search_date","webdb_create_formatted","webdb_create_formatted","webdb_create_formatted");\r
-      UnIndexedSearchTerm whereTerm = new UnIndexedSearchTerm("","","","where","where");\r
-      TextSearchTerm creatorTerm = new TextSearchTerm("creator","search_creator","creator","creator","creator");\r
-      TextSearchTerm titleTerm = new TextSearchTerm("title","search_content","title","title","title");\r
-      TextSearchTerm descriptionTerm =  new TextSearchTerm("description","search_content","description","description","description");\r
-      ContentSearchTerm contentTerm = new ContentSearchTerm("content_data","search_content","content","","");\r
-      TopicSearchTerm topicTerm = new TopicSearchTerm();\r
-      ImagesSearchTerm imagesTerm = new ImagesSearchTerm();\r
-      AudioSearchTerm audioTerm = new AudioSearchTerm();\r
-      VideoSearchTerm videoTerm = new VideoSearchTerm();\r
-\r
-      //make the query available to subsequent iterations\r
-\r
-      Iterator j = Arrays.asList(search_variables).iterator();\r
-      while (j.hasNext()) {\r
-        String variable = (String) j.next();\r
-\r
-        mergeData.put(variable, requestParser.getParameter(variable));\r
-      }\r
-\r
-      try{\r
-        mergeData.put("topics", topicsModule.getTopicsAsSimpleList());\r
-      }\r
-      catch(Throwable e) {\r
-        logger.debug("Can't get topics: " + e.toString());\r
-      }\r
-\r
-      String searchBackValue = req.getParameter("search_back");\r
-      String searchForwardValue = req.getParameter("search_forward");\r
-\r
-      if (searchBackValue != null){\r
-        int totalHits = ((Integer) session.getAttribute("numberOfHits")).intValue();\r
-        int newPosition=((Integer)session.getAttribute("positionInResults")).intValue()-increment;\r
-        if (newPosition<0)\r
-          newPosition=0;\r
-        if (newPosition >= totalHits)\r
-          newPosition=totalHits-1;\r
-        session.setAttribute("positionInResults",new Integer(newPosition));\r
-      }\r
-      else {\r
-        if (searchForwardValue != null){\r
-          int totalHits = ((Integer) session.getAttribute("numberOfHits")).intValue();\r
-          int newPosition=((Integer)session.getAttribute("positionInResults")).intValue()+increment;\r
-          if (newPosition<0)\r
-            newPosition=0;\r
-          if (newPosition >= totalHits)\r
-            newPosition=totalHits-1;\r
-\r
-          session.setAttribute("positionInResults",new Integer(newPosition));\r
-        }\r
-        else {\r
-          String indexPath=configuration.getString("IndexPath");\r
-\r
-\r
-          String creatorFragment = creatorTerm.makeTerm(req);\r
-          if (creatorFragment != null){\r
-            queryString = queryString + " +" + creatorFragment;\r
-          }\r
-\r
-          // search title, description, and content for something\r
-          // the contentTerm uses param "search_boolean" to combine its terms\r
-          String contentFragment = contentTerm.makeTerm(req);\r
-          if (contentFragment != null){\r
-            logger.debug("contentFragment: " + contentFragment);\r
-            queryString = queryString + " +" + contentFragment;\r
-          }\r
-\r
-          String topicFragment = topicTerm.makeTerm(req);\r
-          if (topicFragment != null){\r
-            queryString = queryString + " +" + topicFragment;\r
-          }\r
-\r
-          String imagesFragment = imagesTerm.makeTerm(req);\r
-          if (imagesFragment != null){\r
-            queryString = queryString + " +" + imagesFragment;\r
-          }\r
-\r
-          String audioFragment = audioTerm.makeTerm(req);\r
-          if (audioFragment != null){\r
-            queryString = queryString + " +" + audioFragment;\r
-          }\r
-\r
-          String videoFragment = videoTerm.makeTerm(req);\r
-          if (videoFragment != null){\r
-            queryString = queryString + " +" + videoFragment;\r
-          }\r
-\r
-          if (queryString == null || queryString == ""){\r
-            queryString = "";\r
-          }\r
-          else{\r
-            try{\r
-              Searcher searcher = null;\r
-              try {\r
-                searcher = new IndexSearcher(indexPath);\r
-              }\r
-              catch(IOException e) {\r
-                logger.debug("Can't open indexPath: " + indexPath);\r
-                throw new ServletModuleExc("Problem with Search Index! : "+ e.toString());\r
-              }\r
-\r
-              Query query = null;\r
-              try {\r
-                query = QueryParser.parse(queryString, "content", new StandardAnalyzer());\r
-              }\r
-              catch(Exception e) {\r
-                searcher.close();\r
-                logger.debug("Query don't parse: " + queryString);\r
-                throw new ServletModuleExc("Problem with Query String! (was '"+queryString+"')");\r
-              }\r
-\r
-              Hits hits = null;\r
-              try {\r
-                hits = searcher.search(query);\r
-              }\r
-              catch(IOException e) {\r
-                searcher.close();\r
-                logger.debug("Can't get hits: " + e.toString());\r
-                throw new ServletModuleExc("Problem getting hits!");\r
-              }\r
-\r
-              int start = 0;\r
-              int end = hits.length();\r
-\r
-              String sortBy=req.getParameter("search_sort");\r
-              if (sortBy == null || sortBy.equals("")){\r
-                throw new ServletModuleExc("Please let me sort by something!(missing search_sort)");\r
-              }\r
-\r
-              // here is where the documents will go for storage across sessions\r
-              ArrayList theDocumentsSorted = new ArrayList();\r
-\r
-              if (sortBy.equals("score")){\r
-                for(int i = start; i < end; i++) {\r
-                  theDocumentsSorted.add(hits.doc(i));\r
-                }\r
-              }\r
-              else{\r
-                // then we'll sort by date!\r
-                Map dateToPosition = new HashMap(end,1.0F); //we know how big it will be\r
-                for(int i = start; i < end; i++) {\r
-                  String creationDate=(hits.doc(i)).get("creationDate");\r
-                  // do a little dance in case two contents created at the same second!\r
-                  if (dateToPosition.containsKey(creationDate)){\r
-                    ((ArrayList) (dateToPosition.get(creationDate))).add(new Integer(i));\r
-                  }\r
-                  else{\r
-                    ArrayList thePositions = new ArrayList();\r
-                    thePositions.add(new Integer(i));\r
-                    dateToPosition.put(creationDate,thePositions);\r
-                  }\r
-                }\r
-                Set keys = dateToPosition.keySet();\r
-                ArrayList keyList= new ArrayList(keys);\r
-                Collections.sort(keyList);\r
-                if (sortBy.equals("date_desc")){\r
-                  Collections.reverse(keyList);\r
-                }\r
-                else{\r
-                  if (!sortBy.equals("date_asc")){\r
-                    throw new ServletModuleExc("don't know how to sort by: "+ sortBy);\r
-                  }\r
-                }\r
-                ListIterator keyTraverser = keyList.listIterator();\r
-                while (keyTraverser.hasNext()){\r
-                  ArrayList positions = (ArrayList)dateToPosition.get((keyTraverser.next()));\r
-                  ListIterator positionsTraverser=positions.listIterator();\r
-                  while (positionsTraverser.hasNext()){\r
-                    theDocumentsSorted.add(hits.doc(((Integer)(positionsTraverser.next())).intValue()));\r
-                  }\r
-                }\r
-              }\r
-\r
-              try{\r
-                searcher.close();\r
-              }\r
-              catch (IOException e){\r
-                logger.debug("Can't close searcher: " + e.toString());\r
-                throw new ServletModuleFailure("Problem closing searcher(normal):" + e.getMessage(), e);\r
-              }\r
-\r
-\r
-              session.removeAttribute("numberOfHits");\r
-              session.removeAttribute("theDocumentsSorted");\r
-              session.removeAttribute("positionInResults");\r
-\r
-              session.setAttribute("numberOfHits",new Integer(end));\r
-              session.setAttribute("theDocumentsSorted",theDocumentsSorted);\r
-              session.setAttribute("positionInResults",new Integer(0));\r
-\r
-            }\r
-            catch (IOException e){\r
-              logger.debug("Can't close searcher: " + e.toString());\r
-              throw new ServletModuleFailure("Problem closing searcher: " + e.getMessage(), e);\r
-            }\r
-          }\r
-        }\r
-      }\r
-\r
-      try {\r
-        ArrayList theDocs = (ArrayList)session.getAttribute("theDocumentsSorted");\r
-        if (theDocs != null){\r
-\r
-          mergeData.put("numberOfHits", ((Integer)session.getAttribute("numberOfHits")).toString());\r
-          List theHits = new Vector();\r
-          int pIR=((Integer)session.getAttribute("positionInResults")).intValue();\r
-          int terminus;\r
-          int numHits=((Integer)session.getAttribute("numberOfHits")).intValue();\r
-\r
-          if (!(pIR+increment>=numHits)){\r
-            mergeData.put("hasNext","y");\r
-          }\r
-          else {\r
-            mergeData.put("hasNext", null);\r
-          }\r
-          if (pIR>0){\r
-            mergeData.put("hasPrevious","y");\r
-          }\r
-          else {\r
-            mergeData.put("hasPrevious", null);\r
-          }\r
-\r
-          if ((pIR+increment)>numHits){\r
-            terminus=numHits;\r
-          }\r
-          else {\r
-            terminus=pIR+increment;\r
-          }\r
-          for(int i = pIR; i < terminus; i++) {\r
-            Map h = new HashMap();\r
-            Document theHit = (Document)theDocs.get(i);\r
-            whereTerm.returnMeta(h,theHit);\r
-            creatorTerm.returnMeta(h,theHit);\r
-            titleTerm.returnMeta(h,theHit);\r
-            descriptionTerm.returnMeta(h,theHit);\r
-            dateTerm.returnMeta(h,theHit);\r
-            imagesTerm.returnMeta(h,theHit);\r
-            audioTerm.returnMeta(h,theHit);\r
-            videoTerm.returnMeta(h,theHit);\r
-            theHits.add(h);\r
-          }\r
-          mergeData.put("hits",theHits);\r
-        }\r
-      }\r
-      catch (Throwable e) {\r
-        logger.error("Can't iterate over hits: " + e.toString());\r
-\r
-        throw new ServletModuleFailure("Problem getting hits: " + e.getMessage(), e);\r
-      }\r
-\r
-      mergeData.put("queryString",queryString);\r
-\r
-      deliver(req, res, mergeData, null, searchResultsTemplate);\r
-    }\r
-    catch (NullPointerException n){\r
-      throw new ServletModuleFailure("Null Pointer: "+n.toString(), n);\r
-    }\r
-  }\r
-\r
-  /*\r
-   * Method for dynamically generating a pdf from a fo file\r
-   */\r
-  public void getpdf(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {\r
-    String ID_REQUEST_PARAM = "id";\r
-    String language = req.getParameter("language");\r
-    String generateFO=configuration.getString("GenerateFO");\r
-    String generatePDF=configuration.getString("GeneratePDF");\r
-\r
-\r
-    //don't do anything if we are not making FO files, or if we are\r
-    //pregenerating PDF's\r
-    if (generateFO.equals("yes") && generatePDF.equals("no")){\r
-      //fop complains unless you do the logging this way\r
-      org.apache.log.Logger log = null;\r
-      Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();\r
-      log = hierarchy.getLoggerFor("fop");\r
-      log.setPriority(Priority.WARN);\r
-\r
-      String producerStorageRoot=configuration.getString("Producer.StorageRoot");\r
-      String producerDocRoot=configuration.getString("Producer.DocRoot");\r
-      //      String templateDir=MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir");\r
-      String xslSheet=configuration.getString("Producer.HTML2FOStyleSheet");\r
-      try {\r
-        String idParam = req.getParameter(ID_REQUEST_PARAM);\r
-        if (idParam != null) {\r
-          EntityContent contentEnt =\r
-            (EntityContent)contentModule.getById(idParam);\r
-          String publishPath = StringUtil.webdbDate2path(contentEnt.getValue("date"));\r
-          String foFile;\r
-\r
-          if (language == null){\r
-            foFile = producerStorageRoot + producerDocRoot + "/"\r
-              + publishPath  + idParam + ".fo";\r
-          }\r
-          else{\r
-            foFile = producerStorageRoot + producerDocRoot + "/"\r
-              + language + publishPath  + idParam + ".fo";\r
-          }\r
-          logger.debug("USING FILES" + foFile + " and " + xslSheet);\r
-          XSLTInputHandler input = new XSLTInputHandler(new File(foFile),\r
-                                                        new File(xslSheet));\r
-\r
-          ByteArrayOutputStream out = new ByteArrayOutputStream();\r
-          res.setContentType("application/pdf");\r
-\r
-          Driver driver = new Driver();\r
-          driver.setLogger(log);\r
-          driver.setRenderer(Driver.RENDER_PDF);\r
-          driver.setOutputStream(out);\r
-          driver.render(input.getParser(), input.getInputSource());\r
-\r
-          byte[] content = out.toByteArray();\r
-          res.setContentLength(content.length);\r
-          res.getOutputStream().write(content);\r
-          res.getOutputStream().flush();\r
-        }\r
-        else {\r
-          throw new ServletModuleExc("Missing id.");\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        logger.error(t.toString());\r
-\r
-        throw new ServletModuleFailure(t);\r
-      }\r
-    }\r
-    else {\r
-      throw new ServletModuleExc("Can't generate a PDF because the config tells me not to.");\r
-    }\r
-  }\r
-\r
-  protected String createOneTimePasswd(){\r
-    Random r = new Random();\r
-    int random = r.nextInt();\r
-    long l = System.currentTimeMillis();\r
-    l = (l*l*l*l)/random;\r
-    if(l<0) l = l * -1;\r
-    String returnString = ""+l;\r
-\r
-    return returnString.substring(5);\r
-  }\r
-\r
-\r
-  /* this is an overwritten method of ServletModule in order\r
-     to use different bundles for open and admin */\r
-/*  public void deliver(HttpServletRequest req, HttpServletResponse res,\r
-                      TemplateModelRoot rtm, TemplateModelRoot popups,\r
-                      String templateFilename) throws ServletModuleFailure\r
-  {\r
-  }\r
-*/\r
-  public void deliver(HttpServletRequest aRequest, HttpServletResponse aResponse, Map aData, Map anExtra, String aGenerator)\r
-      throws ServletModuleFailure {\r
-    try {\r
-      deliver(aResponse.getWriter(), aRequest, aResponse, aData, anExtra, aGenerator);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  public void deliver(PrintWriter anOutputWriter, HttpServletRequest aRequest, HttpServletResponse aResponse, Map aData, Map anExtra, String aGenerator)\r
-      throws ServletModuleFailure {\r
-    try {\r
-      Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest), "bundles.open");\r
-      responseData.put("data", aData);\r
-      responseData.put("extra", anExtra);\r
-\r
-\r
-      Generator generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);\r
-      generator.generate(anOutputWriter, responseData, logger.asPrintWriter(logger.INFO_MESSAGE));\r
-\r
-      anOutputWriter.close();\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Error while generating " + aGenerator + ": " + e.getMessage());\r
-\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {\r
-    try {\r
-      logger.error("error: " + anException);\r
-      Map data = new HashMap();\r
-\r
-      data.put("errorstring", anException.getMessage());\r
-      data.put("date", StringUtil.date2readableDateTime(new GregorianCalendar()));\r
-\r
-      deliver(out, aRequest, aResponse, data, null, configuration.getString("ServletModule.OpenIndy.ErrorTemplate"));\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,\r
-                               PrintWriter out, ServletModuleUserExc anException) {\r
-    try {\r
-      logger.warn("user error: " + anException.getMessage());\r
-      Map data = new HashMap();\r
-\r
-      MessageResources messages = MessageResources.getMessageResources("bundles.open");\r
-      data.put("errorstring",\r
-              messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())\r
-          );\r
-      data.put("date", StringUtil.date2readableDateTime(new GregorianCalendar()));\r
-\r
-      deliver(out, aRequest, aResponse, data, null, configuration.getString("ServletModule.OpenIndy.UserErrorTemplate"));\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-\r
-}\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.Vector;
+import java.util.Locale;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.net.smtp.SMTPClient;
+import org.apache.commons.net.smtp.SMTPReply;
+import org.apache.fop.apps.Driver;
+import org.apache.fop.apps.XSLTInputHandler;
+import org.apache.log.Hierarchy;
+import org.apache.log.Priority;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Searcher;
+import org.apache.struts.util.MessageResources;
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.generator.Generator;
+import mir.log.LoggerWrapper;
+import mir.misc.FileHandler;
+import mir.misc.StringUtil;
+import mir.misc.WebdbMultipartRequest;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.servlet.ServletModuleUserExc;
+import mir.storage.StorageObjectFailure;
+import mir.util.ExceptionFunctions;
+import mir.util.HTTPRequestParser;
+import mir.util.StringRoutines;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.global.MirGlobal;
+import mircoders.media.MediaRequest;
+import mircoders.media.UnsupportedMediaFormatExc;
+import mircoders.module.ModuleComment;
+import mircoders.module.ModuleContent;
+import mircoders.module.ModuleImages;
+import mircoders.module.ModuleTopics;
+import mircoders.search.AudioSearchTerm;
+import mircoders.search.ContentSearchTerm;
+import mircoders.search.ImagesSearchTerm;
+import mircoders.search.KeywordSearchTerm;
+import mircoders.search.TextSearchTerm;
+import mircoders.search.TopicSearchTerm;
+import mircoders.search.UnIndexedSearchTerm;
+import mircoders.search.VideoSearchTerm;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseContent;
+import mircoders.storage.DatabaseContentToMedia;
+import mircoders.storage.DatabaseContentToTopics;
+import mircoders.storage.DatabaseImages;
+import mircoders.storage.DatabaseLanguage;
+import mircoders.storage.DatabaseTopics;
+
+/*
+ *  ServletModuleOpenIndy -
+ *   is the open-access-servlet, which is responsible for
+ *    adding comments to articles &
+ *    open-postings to the newswire
+ *
+ * @author mir-coders group
+ * @version $Id: ServletModuleOpenIndy.java,v 1.71 2003/04/09 02:06:09 zapata Exp $
+ *
+ */
+
+public class ServletModuleOpenIndy extends ServletModule
+{
+
+  private String        commentFormTemplate, commentFormDoneTemplate, commentFormDupeTemplate;
+  private String        postingFormTemplate, postingFormDoneTemplate, postingFormDupeTemplate;
+  private String        searchResultsTemplate;
+  private String        prepareMailTemplate,sentMailTemplate;
+  private ModuleContent contentModule;
+  private ModuleComment commentModule;
+  private ModuleImages  imageModule;
+  private ModuleTopics  topicsModule;
+  private String        directOp ="yes";
+  // Singelton / Kontruktor
+  private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleOpenIndy() {
+    super();
+    try {
+      logger = new LoggerWrapper("ServletModule.OpenIndy");
+
+      commentFormTemplate = configuration.getString("ServletModule.OpenIndy.CommentTemplate");
+      commentFormDoneTemplate = configuration.getString("ServletModule.OpenIndy.CommentDoneTemplate");
+      commentFormDupeTemplate = configuration.getString("ServletModule.OpenIndy.CommentDupeTemplate");
+      postingFormTemplate = configuration.getString("ServletModule.OpenIndy.PostingTemplate");
+      postingFormDoneTemplate = configuration.getString("ServletModule.OpenIndy.PostingDoneTemplate");
+      postingFormDupeTemplate = configuration.getString("ServletModule.OpenIndy.PostingDupeTemplate");
+      searchResultsTemplate = configuration.getString("ServletModule.OpenIndy.SearchResultsTemplate");
+      prepareMailTemplate = configuration.getString("ServletModule.OpenIndy.PrepareMailTemplate");
+      sentMailTemplate = configuration.getString("ServletModule.OpenIndy.SentMailTemplate");
+      directOp = configuration.getString("DirectOpenposting").toLowerCase();
+      mainModule = new ModuleComment(DatabaseComment.getInstance());
+      contentModule = new ModuleContent(DatabaseContent.getInstance());
+      topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
+      imageModule = new ModuleImages(DatabaseImages.getInstance());
+      defaultAction="addposting";
+    }
+    catch (StorageObjectFailure e) {
+      logger.error("servletmoduleopenindy could not be initialized: " + e.getMessage());
+    }
+  }
+
+  /**
+   * Method to return an "apology" when open postings are disabled
+   *
+   * @param aRequest
+   * @param aResponse
+   * @throws ServletModuleExc
+   * @throws ServletModuleUserExc
+   * @throws ServletModuleFailure
+   */
+  public void openPostingDisabled(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
+    deliver(aRequest, aResponse, (Map) null, null,
+       configuration.getString("ServletModule.OpenIndy.PostingDisabledTemplate"));
+  }
+
+
+  /**
+   *  Method for making a comment
+   */
+
+  public void addcomment(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+  {
+    if (MirGlobal.abuse().getOpenPostingDisabled()) {
+      openPostingDisabled(req, res);
+
+      return;
+    }
+
+    String aid = req.getParameter("aid"); // the article id the comment will belong to
+/*
+    String language = req.getParameter("language");
+ */
+
+    if (aid!=null && !aid.equals("")) {
+      try {
+        Map mergeData = new HashMap();
+
+        // onetimepasswd
+        if (MirGlobal.abuse().getOpenPostingPassword()) {
+          String passwd = this.createOneTimePasswd();
+          HttpSession session = req.getSession(false);
+          session.setAttribute("passwd", passwd);
+          mergeData.put("passwd", passwd);
+        }
+        else {
+          mergeData.put("passwd", (String) null);
+        }
+/*
+        if (language != null) {
+          HttpSession session = req.getSession(false);
+          session.setAttribute("Locale", new Locale(language, ""));
+          session.setAttribute("language", language);
+        }
+*/
+        mergeData.put("aid", aid);
+
+        Map extraInfo = new HashMap();
+        extraInfo.put("languagePopUpData", DatabaseLanguage.getInstance().getPopupData());
+
+        deliver(req, res, mergeData, extraInfo, commentFormTemplate);
+      }
+      catch (Throwable t) {
+        throw new ServletModuleFailure("ServletModuleOpenIndy.addcomment: " + t.getMessage(), t);
+      }
+    }
+    else throw new ServletModuleExc("aid not set!");
+  }
+
+  /**
+   *  Method for inserting a comment into the Database and delivering
+   *  the commentDone Page
+   */
+
+  public void inscomment(HttpServletRequest req, HttpServletResponse res)
+    throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+  {
+    if (MirGlobal.abuse().getOpenPostingDisabled()) {
+      openPostingDisabled(req, res);
+
+      return;
+    }
+
+    String aid = req.getParameter("to_media"); // the article id the comment will belong to
+    if (aid!=null && !aid.equals(""))
+      {
+        // ok, collecting data from form
+        try {
+          Map withValues = getIntersectingValues(req, DatabaseComment.getInstance());
+
+          //no html in comments(for now)
+          for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
+            String k=(String)i.next();
+            String v=(String)withValues.get(k);
+
+            withValues.put(k,StringUtil.removeHTMLTags(v));
+          }
+          withValues.put("is_published","1");
+          withValues.put("to_comment_status","1");
+
+          //checking the onetimepasswd
+          HttpSession session = req.getSession(false);
+          String sessionPasswd = (String) session.getAttribute("passwd");
+          if ( sessionPasswd != null){
+            String passwd = req.getParameter("passwd");
+            if ( passwd == null || passwd.length()==0) {
+              throw new ServletModuleUserExc("comment.error.missingpassword", new String[] {});
+            }
+            if (!sessionPasswd.equals(passwd)) {
+              throw new ServletModuleUserExc("comment.error.invalidpassword", new String[] {});
+            }
+            session.invalidate();
+          }
+
+          String id = mainModule.add(withValues);
+
+          if(id==null){
+            deliver(req, res, (Map) null, null, commentFormDupeTemplate);
+          }
+          else {
+            MirGlobal.abuse().logComment(req.getRemoteAddr(), id, new Date(), (String) req.getHeader("User-Agent"));
+
+            DatabaseContent.getInstance().setUnproduced("id="+aid);
+
+            try {
+              EntityComment comment = (EntityComment) DatabaseComment.getInstance().selectById(id);
+              MirGlobal.abuse().checkComment(comment, req, res);
+              MirGlobal.localizer().openPostings().afterCommentPosting(comment);
+            }
+            catch (Throwable t) {
+              throw new ServletModuleExc(t.getMessage());
+            }
+          }
+
+          // redirecting to url
+          // should implement back to article
+          Map mergeData = new HashMap();
+          deliver(req, res, mergeData, null, commentFormDoneTemplate);
+        }
+        catch (Throwable e) {
+          throw new ServletModuleFailure(e);
+        }
+      }
+    else throw new ServletModuleExc("aid not set!");
+
+  }
+
+  /**
+   *  Method for delivering the form-Page for open posting
+   */
+
+  public void addposting(HttpServletRequest req, HttpServletResponse res)
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+  {
+    try {
+      if (MirGlobal.abuse().getOpenPostingDisabled()) {
+        openPostingDisabled(req, res);
+
+        return;
+      }
+
+      Map mergeData = new HashMap();
+
+      // onetimepasswd
+      if (MirGlobal.abuse().getOpenPostingPassword()) {
+        String passwd = this.createOneTimePasswd();
+        HttpSession session = req.getSession(false);
+        session.setAttribute("passwd", passwd);
+        mergeData.put("passwd", passwd);
+      }
+      else {
+        mergeData.put("passwd", (String)null);
+      }
+
+      String maxMedia = configuration.getString("ServletModule.OpenIndy.MaxMediaUploadItems");
+      String defaultMedia = configuration.getString("ServletModule.OpenIndy.DefaultMediaUploadItems");
+      String numOfMedia = req.getParameter("medianum");
+
+      if (numOfMedia == null || numOfMedia.equals("")) {
+        numOfMedia = defaultMedia;
+      }
+      else if (Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) {
+        numOfMedia = maxMedia;
+      }
+
+      int mediaNum = Integer.parseInt(numOfMedia);
+      List mediaFields = new Vector();
+      for (int i = 0; i < mediaNum; i++) {
+        Integer mNum = new Integer(i + 1);
+        mediaFields.add(mNum.toString());
+      }
+      mergeData.put("medianum", numOfMedia);
+      mergeData.put("mediafields", mediaFields);
+      mergeData.put("to_topic", null);
+
+      Map extraInfo = new HashMap();
+      extraInfo.put("languagePopUpData", DatabaseLanguage.getInstance().getPopupData());
+      extraInfo.put("themenPopupData", topicsModule.getTopicsAsSimpleList());
+
+      extraInfo.put("topics", topicsModule.getTopicsList());
+      deliver(req, res, mergeData, extraInfo, postingFormTemplate);
+    }
+    catch (Throwable t) {
+      throw new ServletModuleFailure(t);
+    }
+  }
+
+  /**
+   *  Method for inserting an open posting into the Database and delivering
+   *  the postingDone Page
+   */
+
+  public void insposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+  {
+    if (MirGlobal.abuse().getOpenPostingDisabled()) {
+      openPostingDisabled(req, res);
+
+      return;
+    }
+
+    Map mergeData = new HashMap();
+    boolean setMedia=false;
+    boolean setTopic = false;
+
+    try {
+
+      WebdbMultipartRequest mp = null;
+      EntityList mediaList = null;
+      try {
+        // new MediaRequest, "1" is the id for the openPosting user
+        MediaRequest mediaReq = new MediaRequest("1", true);
+        mp = new WebdbMultipartRequest(req, (FileHandler)mediaReq);
+        mediaList = mediaReq.getEntityList();
+      }
+      catch (Throwable e) {
+        throw new ServletModuleFailure(e);
+      }
+
+      Map withValues = mp.getParameters();
+
+      //checking the onetimepasswd
+      HttpSession session = req.getSession(false);
+      String sessionPasswd = (String) session.getAttribute("passwd");
+      if (sessionPasswd != null){
+        String passwd = (String) withValues.get("passwd");
+
+        logger.debug("session password = " + sessionPasswd + ", form password = " + passwd);
+
+        if ( passwd == null || passwd.length()==0) {
+          throw new ServletModuleUserExc("posting.error.missingpassword", new String[] {});
+        }
+        if (!sessionPasswd.equals(passwd)) {
+          throw new ServletModuleUserExc("posting.error.invalidpassword", new String[] {});
+        }
+        session.invalidate();
+      }
+
+      if ((((String)withValues.get("title")).length() == 0) ||
+          (((String)withValues.get("description")).length() == 0) ||
+          (((String)withValues.get("content_data")).length() == 0))
+        throw new ServletModuleUserExc("posting.error.missingfield", new String[] {});
+
+      // call the routines that escape html
+
+      for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
+        String k=(String)i.next();
+        String v=(String)withValues.get(k);
+
+        if (k.equals("content_data")){
+          //this doesn't quite work yet, so for now, all html goes
+          //withValues.put(k,StringUtil.approveHTMLTags(v));
+          withValues.put(k,StringUtil.deleteForbiddenTags(v));
+        }
+        else if (k.equals("description")) {
+          String tmp = StringUtil.deleteForbiddenTags(v);
+          withValues.put(k,StringUtil.deleteHTMLTableTags(tmp));
+        }
+        else {
+          withValues.put(k,StringUtil.removeHTMLTags(v));
+        }
+
+      }
+
+      withValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+      withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
+      withValues.put("is_produced", "0");
+      withValues.put("is_published","1");
+      if (directOp.equals("yes"))
+        withValues.put("to_article_type","1");
+
+      withValues.put("to_publisher","1");
+
+      // inserting  content into database
+      String cid = contentModule.add(withValues);
+      logger.debug("id: "+cid);
+      //insert was not successfull
+      if(cid==null){
+
+        //How do we know that it was not succesful cause of a
+        //dupe, what if it failed cause of "No space left on device"?
+        //Or is there something I am missing? Wouldn't it be better
+        //to have an explicit dupe check and then insert? I have no
+        //idea what I am talking about. this comment is in case
+        //I forget to explicitely ask. -mh
+        deliver(req, res, mergeData, null, postingFormDupeTemplate);
+        return;
+      }
+
+      MirGlobal.abuse().logArticle(req.getRemoteAddr(), cid, new Date(), (String) req.getHeader("User-Agent"));
+
+      String[] to_topicsArr = mp.getParameterValues("to_topic");
+
+      if (to_topicsArr != null && to_topicsArr.length > 0) {
+        try{
+          DatabaseContentToTopics.getInstance().setTopics(cid,to_topicsArr);
+          setTopic = true;
+        }
+        catch (Throwable e) {
+          logger.error("setting content_x_topic failed");
+          contentModule.deleteById(cid);
+          throw new ServletModuleFailure("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString(), e);
+        } //end try
+      } //end if
+
+      //if we're here all is ok... associate the media to the article
+      for(int i=0;i<mediaList.size();i++) {
+        Entity mediaEnt = (Entity)mediaList.elementAt(i);
+        DatabaseContentToMedia.getInstance().addMedia(cid,mediaEnt.getId());
+      }
+
+      EntityContent article = (EntityContent) contentModule.getById(cid);
+
+      try {
+        MirGlobal.abuse().checkArticle(article, req, res);
+        MirGlobal.localizer().openPostings().afterContentPosting(article);
+      }
+      catch (Throwable t) {
+        logger.error("Error while post-processing article: " + t.getMessage());
+      }
+    }
+    catch (Throwable e) {
+      Throwable cause = ExceptionFunctions.traceCauseException(e);
+
+      if (cause instanceof UnsupportedMediaFormatExc) {
+        throw new ServletModuleUserExc("media.unsupportedformat", new String[] {} );
+      }
+      throw new ServletModuleFailure(e);
+    }
+
+    deliver(req, res, mergeData, null, postingFormDoneTemplate);
+  }
+
+  /**
+   * Method for preparing and sending a content as an email message
+   */
+
+  public void mail(HttpServletRequest req, HttpServletResponse res)
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+  {
+    String aid = req.getParameter("mail_aid");
+    if (aid == null){
+      throw new ServletModuleExc("An article id must be specified in requests to email an article.  Something therefore went badly wrong....");
+    }
+
+    String to = req.getParameter("mail_to");
+    String from = req.getParameter("mail_from");
+    String from_name = req.getParameter("mail_from_name");
+    String comment = req.getParameter("mail_comment");
+    String mail_language = req.getParameter("mail_language");
+
+    Map mergeData = new HashMap();
+
+    if (to == null || from == null || from_name == null|| to.equals("") || from.equals("") || from_name.equals("") || mail_language == null || mail_language.equals("")){
+
+      for (Enumeration theParams = req.getParameterNames(); theParams.hasMoreElements() ;) {
+        String pName=(String)theParams.nextElement();
+        if (pName.startsWith("mail_")){
+          mergeData.put( pName,req.getParameter(pName) );
+        }
+      }
+
+      deliver(req, res, mergeData, null, prepareMailTemplate);
+    }
+    else {
+      //run checks on to and from and mail_language to make sure no monkey business occurring
+      if (mail_language.indexOf('.') != -1 || mail_language.indexOf('/') != -1 ) {
+        throw new ServletModuleExc("Invalid language");
+      }
+      if (to.indexOf('\n') != -1
+          || to.indexOf('\r') != -1
+          || to.indexOf(',') != -1) {
+        throw new ServletModuleUserExc("email.error.invalidtoaddress", new String[] {to});
+      }
+      if (from.indexOf('\n') != -1 || from.indexOf('\r') != -1 || from.indexOf(',') != -1 ) {
+        throw new ServletModuleUserExc("email.error.invalidfromaddress", new String[] {from});
+      }
+
+
+      EntityContent contentEnt;
+      try{
+        contentEnt = (EntityContent)contentModule.getById(aid);
+      }
+      catch (Throwable e){
+        throw new ServletModuleFailure("Couldn't get content for article "+aid + ": " + e.getMessage(), e);
+      }
+      String producerStorageRoot=configuration.getString("Producer.StorageRoot");
+      String producerDocRoot=configuration.getString("Producer.DocRoot");
+      String publishPath = contentEnt.getValue("publish_path");
+      String txtFilePath = producerStorageRoot + producerDocRoot + "/" + mail_language +
+                                                                                                         publishPath + "/" + aid + ".txt";
+
+
+      File inputFile = new File(txtFilePath);
+      String content;
+
+      try{
+        FileReader in = new FileReader(inputFile);
+        StringWriter out = new StringWriter();
+        int c;
+        while ((c = in.read()) != -1)
+          out.write(c);
+        in.close();
+        content= out.toString();
+      }
+      catch (FileNotFoundException e){
+        throw new ServletModuleFailure("No text file found in " + txtFilePath, e);
+      }
+      catch (IOException e){
+        throw new ServletModuleFailure("Problem reading file in " + txtFilePath, e);
+      }
+      // add some headers
+      content = "To: " + to + "\nReply-To: "+ from + "\n" + content;
+      // put in the comment where it should go
+      if (comment != null) {
+        String commentTextToInsert = "\n\nAttached comment from " + from_name + ":\n" + comment;
+        try {
+          content=StringRoutines.performRegularExpressionReplacement(content,"!COMMENT!",commentTextToInsert);
+        }
+        catch (Throwable e){
+          throw new ServletModuleFailure("Problem doing regular expression replacement " + e.toString(), e);
+        }
+      }
+      else{
+        try {
+          content=StringRoutines.performRegularExpressionReplacement(content,"!COMMENT!","");
+        }
+        catch (Throwable e){
+          throw new ServletModuleFailure("Problem doing regular expression replacement " + e.toString(), e);
+        }
+      }
+
+      SMTPClient client=new SMTPClient();
+      try {
+        int reply;
+        client.connect(configuration.getString("ServletModule.OpenIndy.SMTPServer"));
+
+        reply = client.getReplyCode();
+
+        if (!SMTPReply.isPositiveCompletion(reply)) {
+          client.disconnect();
+          throw new ServletModuleExc("SMTP server refused connection.");
+        }
+
+        client.sendSimpleMessage(configuration.getString("ServletModule.OpenIndy.EmailIsFrom"), to, content);
+
+        client.disconnect();
+        //mission accomplished
+        deliver(req, res, mergeData, null, sentMailTemplate);
+      }
+      catch(IOException e) {
+        if(client.isConnected()) {
+          try {
+            client.disconnect();
+          } catch(IOException f) {
+            // do nothing
+          }
+        }
+        throw new ServletModuleFailure(e);
+      }
+    }
+  }
+
+  /**
+   * Method for querying a lucene index
+   *
+   * @param req
+   * @param res
+   * @throws ServletModuleExc
+   * @throws ServletModuleUserExc
+   * @throws ServletModuleFailure
+   */
+
+  public void search(HttpServletRequest req, HttpServletResponse res)
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
+    try {
+      final String[] search_variables = { "search_content", "search_boolean", "search_creator",
+          "search_topic", "search_hasImages", "search_hasAudio", "search_hasVideo", "search_sort",
+          "search_submit", "search_back", "search_forward" };
+      HTTPRequestParser requestParser = new HTTPRequestParser(req);
+
+      int increment=10;
+
+      HttpSession session = req.getSession(false);
+
+      String queryString="";
+
+      Map mergeData = new HashMap();
+
+      KeywordSearchTerm dateTerm = new KeywordSearchTerm("date_formatted","search_date","webdb_create_formatted","webdb_create_formatted","webdb_create_formatted");
+      UnIndexedSearchTerm whereTerm = new UnIndexedSearchTerm("","","","where","where");
+      TextSearchTerm creatorTerm = new TextSearchTerm("creator","search_creator","creator","creator","creator");
+      TextSearchTerm titleTerm = new TextSearchTerm("title","search_content","title","title","title");
+      TextSearchTerm descriptionTerm =  new TextSearchTerm("description","search_content","description","description","description");
+      ContentSearchTerm contentTerm = new ContentSearchTerm("content_data","search_content","content","","");
+      TopicSearchTerm topicTerm = new TopicSearchTerm();
+      ImagesSearchTerm imagesTerm = new ImagesSearchTerm();
+      AudioSearchTerm audioTerm = new AudioSearchTerm();
+      VideoSearchTerm videoTerm = new VideoSearchTerm();
+
+      //make the query available to subsequent iterations
+
+      Iterator j = Arrays.asList(search_variables).iterator();
+      while (j.hasNext()) {
+        String variable = (String) j.next();
+
+        mergeData.put(variable, requestParser.getParameter(variable));
+      }
+
+      try{
+        mergeData.put("topics", topicsModule.getTopicsAsSimpleList());
+      }
+      catch(Throwable e) {
+        logger.debug("Can't get topics: " + e.toString());
+      }
+
+      String searchBackValue = req.getParameter("search_back");
+      String searchForwardValue = req.getParameter("search_forward");
+
+      if (searchBackValue != null){
+        int totalHits = ((Integer) session.getAttribute("numberOfHits")).intValue();
+        int newPosition=((Integer)session.getAttribute("positionInResults")).intValue()-increment;
+        if (newPosition<0)
+          newPosition=0;
+        if (newPosition >= totalHits)
+          newPosition=totalHits-1;
+        session.setAttribute("positionInResults",new Integer(newPosition));
+      }
+      else {
+        if (searchForwardValue != null){
+          int totalHits = ((Integer) session.getAttribute("numberOfHits")).intValue();
+          int newPosition=((Integer)session.getAttribute("positionInResults")).intValue()+increment;
+          if (newPosition<0)
+            newPosition=0;
+          if (newPosition >= totalHits)
+            newPosition=totalHits-1;
+
+          session.setAttribute("positionInResults",new Integer(newPosition));
+        }
+        else {
+          String indexPath=configuration.getString("IndexPath");
+
+
+          String creatorFragment = creatorTerm.makeTerm(req);
+          if (creatorFragment != null){
+            queryString = queryString + " +" + creatorFragment;
+          }
+
+          // search title, description, and content for something
+          // the contentTerm uses param "search_boolean" to combine its terms
+          String contentFragment = contentTerm.makeTerm(req);
+          if (contentFragment != null){
+            logger.debug("contentFragment: " + contentFragment);
+            queryString = queryString + " +" + contentFragment;
+          }
+
+          String topicFragment = topicTerm.makeTerm(req);
+          if (topicFragment != null){
+            queryString = queryString + " +" + topicFragment;
+          }
+
+          String imagesFragment = imagesTerm.makeTerm(req);
+          if (imagesFragment != null){
+            queryString = queryString + " +" + imagesFragment;
+          }
+
+          String audioFragment = audioTerm.makeTerm(req);
+          if (audioFragment != null){
+            queryString = queryString + " +" + audioFragment;
+          }
+
+          String videoFragment = videoTerm.makeTerm(req);
+          if (videoFragment != null){
+            queryString = queryString + " +" + videoFragment;
+          }
+
+          if (queryString == null || queryString == ""){
+            queryString = "";
+          }
+          else{
+            try{
+              Searcher searcher = null;
+              try {
+                searcher = new IndexSearcher(indexPath);
+              }
+              catch(IOException e) {
+                logger.debug("Can't open indexPath: " + indexPath);
+                throw new ServletModuleExc("Problem with Search Index! : "+ e.toString());
+              }
+
+              Query query = null;
+              try {
+                query = QueryParser.parse(queryString, "content", new StandardAnalyzer());
+              }
+              catch(Exception e) {
+                searcher.close();
+                logger.debug("Query don't parse: " + queryString);
+                throw new ServletModuleExc("Problem with Query String! (was '"+queryString+"')");
+              }
+
+              Hits hits = null;
+              try {
+                hits = searcher.search(query);
+              }
+              catch(IOException e) {
+                searcher.close();
+                logger.debug("Can't get hits: " + e.toString());
+                throw new ServletModuleExc("Problem getting hits!");
+              }
+
+              int start = 0;
+              int end = hits.length();
+
+              String sortBy=req.getParameter("search_sort");
+              if (sortBy == null || sortBy.equals("")){
+                throw new ServletModuleExc("Please let me sort by something!(missing search_sort)");
+              }
+
+              // here is where the documents will go for storage across sessions
+              ArrayList theDocumentsSorted = new ArrayList();
+
+              if (sortBy.equals("score")){
+                for(int i = start; i < end; i++) {
+                  theDocumentsSorted.add(hits.doc(i));
+                }
+              }
+              else{
+                // then we'll sort by date!
+                Map dateToPosition = new HashMap(end,1.0F); //we know how big it will be
+                for(int i = start; i < end; i++) {
+                  String creationDate=(hits.doc(i)).get("creationDate");
+                  // do a little dance in case two contents created at the same second!
+                  if (dateToPosition.containsKey(creationDate)){
+                    ((ArrayList) (dateToPosition.get(creationDate))).add(new Integer(i));
+                  }
+                  else{
+                    ArrayList thePositions = new ArrayList();
+                    thePositions.add(new Integer(i));
+                    dateToPosition.put(creationDate,thePositions);
+                  }
+                }
+                Set keys = dateToPosition.keySet();
+                ArrayList keyList= new ArrayList(keys);
+                Collections.sort(keyList);
+                if (sortBy.equals("date_desc")){
+                  Collections.reverse(keyList);
+                }
+                else{
+                  if (!sortBy.equals("date_asc")){
+                    throw new ServletModuleExc("don't know how to sort by: "+ sortBy);
+                  }
+                }
+                ListIterator keyTraverser = keyList.listIterator();
+                while (keyTraverser.hasNext()){
+                  ArrayList positions = (ArrayList)dateToPosition.get((keyTraverser.next()));
+                  ListIterator positionsTraverser=positions.listIterator();
+                  while (positionsTraverser.hasNext()){
+                    theDocumentsSorted.add(hits.doc(((Integer)(positionsTraverser.next())).intValue()));
+                  }
+                }
+              }
+
+              try{
+                searcher.close();
+              }
+              catch (IOException e){
+                logger.debug("Can't close searcher: " + e.toString());
+                throw new ServletModuleFailure("Problem closing searcher(normal):" + e.getMessage(), e);
+              }
+
+
+              session.removeAttribute("numberOfHits");
+              session.removeAttribute("theDocumentsSorted");
+              session.removeAttribute("positionInResults");
+
+              session.setAttribute("numberOfHits",new Integer(end));
+              session.setAttribute("theDocumentsSorted",theDocumentsSorted);
+              session.setAttribute("positionInResults",new Integer(0));
+
+            }
+            catch (IOException e){
+              logger.debug("Can't close searcher: " + e.toString());
+              throw new ServletModuleFailure("Problem closing searcher: " + e.getMessage(), e);
+            }
+          }
+        }
+      }
+
+      try {
+        ArrayList theDocs = (ArrayList)session.getAttribute("theDocumentsSorted");
+        if (theDocs != null){
+
+          mergeData.put("numberOfHits", ((Integer)session.getAttribute("numberOfHits")).toString());
+          List theHits = new Vector();
+          int pIR=((Integer)session.getAttribute("positionInResults")).intValue();
+          int terminus;
+          int numHits=((Integer)session.getAttribute("numberOfHits")).intValue();
+
+          if (!(pIR+increment>=numHits)){
+            mergeData.put("hasNext","y");
+          }
+          else {
+            mergeData.put("hasNext", null);
+          }
+          if (pIR>0){
+            mergeData.put("hasPrevious","y");
+          }
+          else {
+            mergeData.put("hasPrevious", null);
+          }
+
+          if ((pIR+increment)>numHits){
+            terminus=numHits;
+          }
+          else {
+            terminus=pIR+increment;
+          }
+          for(int i = pIR; i < terminus; i++) {
+            Map h = new HashMap();
+            Document theHit = (Document)theDocs.get(i);
+            whereTerm.returnMeta(h,theHit);
+            creatorTerm.returnMeta(h,theHit);
+            titleTerm.returnMeta(h,theHit);
+            descriptionTerm.returnMeta(h,theHit);
+            dateTerm.returnMeta(h,theHit);
+            imagesTerm.returnMeta(h,theHit);
+            audioTerm.returnMeta(h,theHit);
+            videoTerm.returnMeta(h,theHit);
+            theHits.add(h);
+          }
+          mergeData.put("hits",theHits);
+        }
+      }
+      catch (Throwable e) {
+        logger.error("Can't iterate over hits: " + e.toString());
+
+        throw new ServletModuleFailure("Problem getting hits: " + e.getMessage(), e);
+      }
+
+      mergeData.put("queryString",queryString);
+
+      deliver(req, res, mergeData, null, searchResultsTemplate);
+    }
+    catch (NullPointerException n){
+      throw new ServletModuleFailure("Null Pointer: "+n.toString(), n);
+    }
+  }
+
+  /*
+   * Method for dynamically generating a pdf from a fo file
+   */
+  public void getpdf(HttpServletRequest req, HttpServletResponse res)
+      throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
+    String ID_REQUEST_PARAM = "id";
+    String language = req.getParameter("language");
+    String generateFO=configuration.getString("GenerateFO");
+    String generatePDF=configuration.getString("GeneratePDF");
+
+
+    //don't do anything if we are not making FO files, or if we are
+    //pregenerating PDF's
+    if (generateFO.equals("yes") && generatePDF.equals("no")){
+      //fop complains unless you do the logging this way
+      org.apache.log.Logger log = null;
+      Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
+      log = hierarchy.getLoggerFor("fop");
+      log.setPriority(Priority.WARN);
+
+      String producerStorageRoot=configuration.getString("Producer.StorageRoot");
+      String producerDocRoot=configuration.getString("Producer.DocRoot");
+      //      String templateDir=MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir");
+      String xslSheet=configuration.getString("Producer.HTML2FOStyleSheet");
+      try {
+        String idParam = req.getParameter(ID_REQUEST_PARAM);
+        if (idParam != null) {
+          EntityContent contentEnt =
+            (EntityContent)contentModule.getById(idParam);
+          String publishPath = StringUtil.webdbDate2path(contentEnt.getValue("date"));
+          String foFile;
+
+          if (language == null){
+            foFile = producerStorageRoot + producerDocRoot + "/"
+              + publishPath  + idParam + ".fo";
+          }
+          else{
+            foFile = producerStorageRoot + producerDocRoot + "/"
+              + language + publishPath  + idParam + ".fo";
+          }
+          logger.debug("USING FILES" + foFile + " and " + xslSheet);
+          XSLTInputHandler input = new XSLTInputHandler(new File(foFile),
+                                                        new File(xslSheet));
+
+          ByteArrayOutputStream out = new ByteArrayOutputStream();
+          res.setContentType("application/pdf");
+
+          Driver driver = new Driver();
+          driver.setLogger(log);
+          driver.setRenderer(Driver.RENDER_PDF);
+          driver.setOutputStream(out);
+          driver.render(input.getParser(), input.getInputSource());
+
+          byte[] content = out.toByteArray();
+          res.setContentLength(content.length);
+          res.getOutputStream().write(content);
+          res.getOutputStream().flush();
+        }
+        else {
+          throw new ServletModuleExc("Missing id.");
+        }
+      }
+      catch (Throwable t) {
+        logger.error(t.toString());
+
+        throw new ServletModuleFailure(t);
+      }
+    }
+    else {
+      throw new ServletModuleExc("Can't generate a PDF because the config tells me not to.");
+    }
+  }
+
+  protected String createOneTimePasswd(){
+    Random r = new Random();
+    int random = r.nextInt();
+    long l = System.currentTimeMillis();
+    l = (l*l*l*l)/random;
+    if(l<0) l = l * -1;
+    String returnString = ""+l;
+
+    return returnString.substring(5);
+  }
+
+
+  /* this is an overwritten method of ServletModule in order
+     to use different bundles for open and admin */
+/*  public void deliver(HttpServletRequest req, HttpServletResponse res,
+                      TemplateModelRoot rtm, TemplateModelRoot popups,
+                      String templateFilename) throws ServletModuleFailure
+  {
+  }
+*/
+  public void deliver(HttpServletRequest aRequest, HttpServletResponse aResponse, Map aData, Map anExtra, String aGenerator)
+      throws ServletModuleFailure {
+    try {
+      deliver(aResponse.getWriter(), aRequest, aResponse, aData, anExtra, aGenerator);
+    }
+    catch (Throwable t) {
+      throw new ServletModuleFailure(t);
+    }
+  }
+
+  public void deliver(PrintWriter anOutputWriter, HttpServletRequest aRequest, HttpServletResponse aResponse, Map aData, Map anExtra, String aGenerator)
+      throws ServletModuleFailure {
+    try {
+      Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}, "bundles.open");
+      responseData.put("data", aData);
+      responseData.put("extra", anExtra);
+
+
+      Generator generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);
+      generator.generate(anOutputWriter, responseData, logger.asPrintWriter(logger.INFO_MESSAGE));
+
+      anOutputWriter.close();
+    }
+    catch (Throwable e) {
+      logger.error("Error while generating " + aGenerator + ": " + e.getMessage());
+
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {
+    try {
+      logger.error("error: " + anException);
+      Map data = new HashMap();
+
+      data.put("errorstring", anException.getMessage());
+      data.put("date", StringUtil.date2readableDateTime(new GregorianCalendar()));
+
+      deliver(out, aRequest, aResponse, data, null, configuration.getString("ServletModule.OpenIndy.ErrorTemplate"));
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,
+                               PrintWriter out, ServletModuleUserExc anException) {
+    try {
+      logger.warn("user error: " + anException.getMessage());
+      Map data = new HashMap();
+
+      MessageResources messages = MessageResources.getMessageResources("bundles.open");
+      data.put("errorstring",
+              messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())
+          );
+      data.put("date", StringUtil.date2readableDateTime(new GregorianCalendar()));
+
+      deliver(out, aRequest, aResponse, data, null, configuration.getString("ServletModule.OpenIndy.UserErrorTemplate"));
+    }
+    catch (Throwable e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+
+}
+
+
+
index 6d4be8e..c3d41eb 100755 (executable)
@@ -107,7 +107,7 @@ public class ServletModuleProducer extends ServletModule
     try {
       generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator("producerqueue.template");
 
-      generationData = ServletHelper.makeGenerationData(getLocale(aRequest));
+      generationData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
       generationData.put( "thisurl", "module=Producer&do=showProducerQueueStatus");
 
       producersData = new Vector();
index d3d29eb..28ed279 100755 (executable)
@@ -40,11 +40,11 @@ package mircoders.storage;
  * @version 1.0\r
  */\r
 \r
+import freemarker.template.SimpleList;\r
 import mir.log.LoggerWrapper;\r
 import mir.storage.Database;\r
 import mir.storage.StorageObject;\r
 import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
 \r
 \r
 public class DatabaseArticleType extends Database implements StorageObject{\r
@@ -52,11 +52,7 @@ public class DatabaseArticleType extends Database implements StorageObject{
   private static DatabaseArticleType instance;\r
   private static SimpleList articletypePopupData;\r
 \r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseArticleType getInstance() throws\r
-      StorageObjectFailure {\r
+  public synchronized static DatabaseArticleType getInstance() throws StorageObjectFailure {\r
     if (instance == null) {\r
       instance = new DatabaseArticleType();\r
       instance.myselfDatabase = instance;\r
@@ -74,6 +70,4 @@ public class DatabaseArticleType extends Database implements StorageObject{
   public SimpleList getPopupData() throws StorageObjectFailure {\r
     return getPopupData("name", false);\r
   }\r
-\r
-\r
 }\r
index fa98493..b5aa0b7 100755 (executable)
@@ -1,94 +1,94 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.util.GregorianCalendar;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-public class DatabaseAudio extends Database implements StorageObject{\r
-\r
-  private static DatabaseAudio instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseAudio getInstance() throws\r
-      StorageObjectFailure {\r
-    if (instance == null) {\r
-      instance = new DatabaseAudio();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseAudio() throws StorageObjectFailure {\r
-    super();\r
-    logger = new LoggerWrapper("Database.Audio");\r
-\r
-    hasTimestamp = true;\r
-    theTable = "audio";\r
-    theCoreTable = "media";\r
-    theEntityClass = mircoders.entity.EntityAudio.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-\r
-    super.update(theEntity);\r
-  }\r
-\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-    return super.insert(theEntity);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.util.GregorianCalendar;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+public class DatabaseAudio extends Database implements StorageObject{
+
+  private static DatabaseAudio instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseAudio getInstance() throws
+      StorageObjectFailure {
+    if (instance == null) {
+      instance = new DatabaseAudio();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseAudio() throws StorageObjectFailure {
+    super();
+    logger = new LoggerWrapper("Database.Audio");
+
+    hasTimestamp = true;
+    theTable = "audio";
+    theCoreTable = "media";
+    theEntityClass = mircoders.entity.EntityAudio.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+
+    super.update(theEntity);
+  }
+
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+    return super.insert(theEntity);
+  }
+
+}
index d5eda99..06b8bb4 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.sql.Connection;\r
-import java.sql.SQLException;\r
-import java.sql.Statement;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>This class implements the access to the comment-table for the\r
- *    media table.\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseComment extends Database implements StorageObject{\r
-\r
-  private static DatabaseComment instance;\r
-\r
-  public static DatabaseComment getInstance() {\r
-    if (instance == null) {\r
-      synchronized (DatabaseComment.class) {\r
-        if (instance == null) {\r
-          instance = new DatabaseComment();\r
-          instance.myselfDatabase = instance;\r
-        }\r
-      }\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseComment() {\r
-    super();\r
-    hasTimestamp = false;\r
-    theTable = "comment";\r
-    logger = new LoggerWrapper("Database.Comment");\r
-\r
-    this.theEntityClass = mircoders.entity.EntityComment.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-\r
-  public boolean deleteByContentId(String id) throws StorageObjectFailure {\r
-    Statement stmt = null;\r
-    Connection con = null;\r
-    String sql;\r
-    int res = 0;\r
-\r
-    /** @todo comments and topics should be deleted */\r
-    sql = "delete from " + theTable + " where to_media=" + id;\r
-    logger.info("DELETE "+ sql);\r
-\r
-    try {\r
-      con = getPooledCon();\r
-      stmt = con.createStatement();\r
-      res = stmt.executeUpdate(sql);\r
-    }\r
-    catch (SQLException sqe) {\r
-      new StorageObjectFailure(sqe);\r
-      return false;\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-    return true;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>This class implements the access to the comment-table for the
+ *    media table.
+ *
+ *
+ */
+
+public class DatabaseComment extends Database implements StorageObject{
+
+  private static DatabaseComment instance;
+
+  public static DatabaseComment getInstance() {
+    if (instance == null) {
+      synchronized (DatabaseComment.class) {
+        if (instance == null) {
+          instance = new DatabaseComment();
+          instance.myselfDatabase = instance;
+        }
+      }
+    }
+    return instance;
+  }
+
+  private DatabaseComment() {
+    super();
+    hasTimestamp = false;
+    theTable = "comment";
+    logger = new LoggerWrapper("Database.Comment");
+
+    this.theEntityClass = mircoders.entity.EntityComment.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+
+  public boolean deleteByContentId(String id) throws StorageObjectFailure {
+    Statement stmt = null;
+    Connection con = null;
+    String sql;
+    int res = 0;
+
+    /** @todo comments and topics should be deleted */
+    sql = "delete from " + theTable + " where to_media=" + id;
+    logger.info("DELETE "+ sql);
+
+    try {
+      con = getPooledCon();
+      stmt = con.createStatement();
+      res = stmt.executeUpdate(sql);
+    }
+    catch (SQLException sqe) {
+      new StorageObjectFailure(sqe);
+      return false;
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+    return true;
+  }
+}
index 83ae0cc..904cb6c 100755 (executable)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-/**\r
- * Title:\r
- * Description:\r
- * Copyright:    Copyright (c) 2001\r
- * Company:\r
- * @author:\r
- * @version 1.0\r
- */\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-\r
-public class DatabaseCommentStatus extends Database implements StorageObject{\r
-\r
-  private static DatabaseCommentStatus instance;\r
-\r
-  public static DatabaseCommentStatus getInstance() throws StorageObjectFailure {\r
-    if (instance == null) {\r
-      synchronized (DatabaseCommentStatus.class) {\r
-        if (instance == null) {\r
-          instance = new DatabaseCommentStatus();\r
-          instance.myselfDatabase = instance;\r
-        }\r
-      }\r
-    }\r
-\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseCommentStatus() throws StorageObjectFailure {\r
-    super();\r
-    hasTimestamp = false;\r
-    theTable = "comment_status";\r
-    logger = new LoggerWrapper("Database.CommentStatus");\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", false);\r
-  }\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+/**
+ * Title:
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:
+ * @author:
+ * @version 1.0
+ */
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+
+public class DatabaseCommentStatus extends Database implements StorageObject{
+
+  private static DatabaseCommentStatus instance;
+
+  public static DatabaseCommentStatus getInstance() throws StorageObjectFailure {
+    if (instance == null) {
+      synchronized (DatabaseCommentStatus.class) {
+        if (instance == null) {
+          instance = new DatabaseCommentStatus();
+          instance.myselfDatabase = instance;
+        }
+      }
+    }
+
+    return instance;
+  }
+
+  private DatabaseCommentStatus() throws StorageObjectFailure {
+    super();
+    hasTimestamp = false;
+    theTable = "comment_status";
+    logger = new LoggerWrapper("Database.CommentStatus");
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", false);
+  }
 }
\ No newline at end of file
index f930397..1572cb2 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.sql.Connection;\r
-import java.sql.ResultSet;\r
-import java.sql.Statement;\r
-\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectExc;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.entity.EntityUploadedMedia;\r
-\r
-/**\r
- * <b>implements abstract DB connection to the content_x_media SQL table\r
- *\r
- * @author RK, mir-coders group\r
- * @version $Id: DatabaseContentToMedia.java,v 1.16 2003/03/09 03:53:12 zapata Exp $\r
- *\r
- */\r
-\r
-public class DatabaseContentToMedia extends Database implements StorageObject{\r
-\r
-  private static DatabaseContentToMedia instance;\r
-\r
-  public static DatabaseContentToMedia getInstance() {\r
-    if (instance == null) {\r
-      synchronized (DatabaseContentToMedia.class) {\r
-        if (instance == null) {\r
-          instance = new DatabaseContentToMedia();\r
-          instance.myselfDatabase = instance;\r
-        }\r
-      }\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseContentToMedia() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.ContentToMedia");\r
-\r
-    hasTimestamp = false;\r
-    theTable = "content_x_media";\r
-    theEntityClass = mir.entity.GenericEntity.class;\r
-  }\r
-\r
-  /**\r
-   * get all the media-files belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getMedia(EntityContent content) throws StorageObjectFailure {\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        // media should stay in uploaded order. this is especially important\r
-        // for photo stories which require a specific chronologic order.\r
-        // this is why we have the the second parameter "id"\r
-        returnList = DatabaseMedia.getInstance().selectByWhereClause(subselect,\r
-            "id", -1);\r
-      }\r
-      catch (Throwable e) {\r
-        logger.debug("-- get media failed " + e.toString());\r
-        throw new StorageObjectFailure("-- get media failed ", e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  public boolean hasMedia(EntityContent content) throws StorageObjectFailure,\r
-      StorageObjectExc {\r
-    if (content != null) {\r
-      try {\r
-        if (selectByWhereClause("content_id=" + content.getId(), -1).size() ==\r
-            0)\r
-          return false;\r
-        else\r
-          return true;\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.hasMedia: " + e.toString());\r
-        throw new StorageObjectFailure("DatabaseContentToMedia.hasMedia: " +\r
-                                       e.toString(), e);\r
-      }\r
-    }\r
-    else {\r
-      logger.error("DatabaseContentToMedia.hasMedia: content == null");\r
-      throw new StorageObjectExc(\r
-          "DatabaseContentToMedia.hasMedia: content == null");\r
-    }\r
-  }\r
-\r
-  /**\r
-   * get all the audio belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getAudio(EntityContent content) throws StorageObjectFailure {\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      //this is not supported by mysql\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        // media should stay in uploaded order. this is especially important\r
-        // for photo stories which require a specific chronologic order.\r
-        // this is why we have the the second parameter "id"\r
-        returnList = DatabaseAudio.getInstance().selectByWhereClause(subselect,\r
-            "id", -1);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.getAudio: " + e.toString());\r
-        throw new StorageObjectFailure("DatabaseContentToMedia.getAudio: " +\r
-                                       e.toString(), e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * get all the video belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getVideo(EntityContent content) throws StorageObjectFailure {\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      //this is not supported by mysql\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        // media should stay in uploaded order. this is especially important\r
-        // for photo stories which require a specific chronologic order.\r
-        // this is why we have the the second parameter "id"\r
-        returnList = DatabaseVideo.getInstance().selectByWhereClause(subselect,\r
-            "id", -1);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.getVideo: " + e.toString());\r
-        throw new StorageObjectFailure("DatabaseContentToMedia.getVideo: " +\r
-                                       e.toString(), e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * get all the images belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getImages(EntityContent content) throws\r
-      StorageObjectFailure {\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      //this is not supported by mysql\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        // media should stay in uploaded order. this is especially important\r
-        // for photo stories which require a specific chronologic order.\r
-        // this is why we have the the second parameter "id"\r
-        returnList = DatabaseImages.getInstance().selectByWhereClause(subselect,\r
-            "id", -1);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.getImages: " + e.toString());\r
-        throw new StorageObjectFailure("DatabaseContentToMedia.getImages: " +\r
-                                       e.toString(), e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * get all the uploaded/other Media belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getOther(EntityContent content) throws StorageObjectFailure {\r
-    /** @todo this should only fetch published media / rk */\r
-\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      //this is not supported by mysql\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        // media should stay in uploaded order. this is especially important\r
-        // for photo stories which require a specific chronologic order.\r
-        // this is why we have the the second parameter "id"\r
-        returnList = DatabaseOther.getInstance().selectByWhereClause(subselect,\r
-            "id");\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.getOther: " + e.toString());\r
-        throw new StorageObjectFailure("DatabaseContentToMedia.getOther: " + e.toString(), e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * get all the uploaded/other Media belonging to a content entity\r
-   *\r
-   */\r
-  public EntityList getUploadedMedia(EntityContent content) throws\r
-      StorageObjectFailure {\r
-    /** @todo this should only fetch published media / rk */\r
-\r
-    EntityList returnList = null;\r
-    if (content != null) {\r
-      // get all to_topic from media_x_topic\r
-      String id = content.getId();\r
-      //this is not supported by mysql\r
-      String subselect = "id in (select media_id from " + theTable +\r
-          " where content_id=" + id + ")";\r
-\r
-      try {\r
-        returnList = DatabaseUploadedMedia.getInstance().selectByWhereClause(\r
-            subselect,\r
-            "id");\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToMedia.getUploadedMedia: " + e.toString());\r
-        throw new StorageObjectFailure(\r
-            "DatabaseContentToMedia.getUploadedMedia: " + e.toString(), e);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  public void setMedia(String contentId, String[] mediaId) throws\r
-      StorageObjectFailure {\r
-    if (contentId == null) {\r
-      return;\r
-    }\r
-    if (mediaId == null || mediaId[0] == null) {\r
-      return;\r
-    }\r
-    //first delete all row with content_id=contentId\r
-    String sql = "delete from " + theTable + " where content_id=" + contentId;\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      ResultSet rs = executeSql(stmt, sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- set media failed -- delete");\r
-      throw new StorageObjectFailure("-- set media failed -- delete", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    //now insert\r
-    //first delete all row with content_id=contentId\r
-    for (int i = 0; i < mediaId.length; i++) {\r
-      sql = "insert into " + theTable + " (content_id,media_id) values ("\r
-          + contentId + "," + mediaId[i] + ")";\r
-      try {\r
-        con = getPooledCon();\r
-        // should be a preparedStatement because is faster\r
-        stmt = con.createStatement();\r
-        int rs = executeUpdate(stmt, sql);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("-- set topics failed -- insert");\r
-        throw new StorageObjectFailure("-- set topics failed -- insert ", e);\r
-      }\r
-      finally {\r
-        freeConnection(con, stmt);\r
-      }\r
-    }\r
-  }\r
-\r
-  public void addMedia(String contentId, String mediaId) throws\r
-      StorageObjectFailure {\r
-    if (contentId == null && mediaId == null) {\r
-      return;\r
-    }\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    //now insert\r
-\r
-    String sql = "insert into " + theTable + " (content_id,media_id) values ("\r
-        + contentId + "," + mediaId + ")";\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- add media failed -- insert");\r
-      throw new StorageObjectFailure("-- add media failed -- insert ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-  }\r
-\r
-  public void setMedia(String contentId, String mediaId) throws\r
-      StorageObjectFailure {\r
-    if (contentId == null && mediaId == null) {\r
-      return;\r
-    }\r
-    //first delete all row with content_id=contentId\r
-    String sql = "delete from " + theTable + " where content_id=" + contentId;\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- set media failed -- delete");\r
-      throw new StorageObjectFailure("-- set media failed -- delete ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    //now insert\r
-    //first delete all row with content_id=contentId\r
-\r
-    sql = "insert into " + theTable + " (content_id,media_id) values ("\r
-        + contentId + "," + mediaId + ")";\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- set media failed -- insert");\r
-      throw new StorageObjectFailure("-- set media failed -- insert ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-  }\r
-\r
-  public void deleteByContentId(String contentId) throws StorageObjectFailure {\r
-    if (contentId == null) {\r
-      //theLog.printDebugInfo("-- delete topics failed -- no content id");\r
-      return;\r
-    }\r
-    //delete all row with content_id=contentId\r
-    String sql = "delete from " + theTable + " where content_id=" + contentId;\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- delete by contentId failed  ");\r
-      throw new StorageObjectFailure(\r
-          "-- delete by content id failed -- delete ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-  }\r
-\r
-  public void deleteByMediaId(String mediaId) throws StorageObjectFailure {\r
-    if (mediaId == null) {\r
-      //theLog.printDebugInfo("-- delete topics failed -- no topic id");\r
-      return;\r
-    }\r
-    //delete all row with content_id=contentId\r
-    String sql = "delete from " + theTable + " where media_id=" + mediaId;\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-      logger.debug("-- delete media success ");\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- delete media failed ");\r
-      throw new StorageObjectFailure("-- delete by media id failed -- ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-  }\r
-\r
-  public void delete(String contentId, String mediaId) throws\r
-      StorageObjectFailure {\r
-    if (mediaId == null || contentId == null) {\r
-      logger.debug("-- delete media failed -- missing parameter");\r
-      return;\r
-    }\r
-    //delete all row with content_id=contentId and media_id=mediaId\r
-    String sql = "delete from " + theTable + " where media_id=" + mediaId +\r
-        " and content_id= " + contentId;\r
-\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt, sql);\r
-      logger.debug("-- delete content_x_media success ");\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- delete content_x_media failed ");\r
-      throw new StorageObjectFailure("-- delete content_x_media failed -- ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-  }\r
-\r
-  public EntityList getContent(EntityUploadedMedia media) throws\r
-      StorageObjectFailure {\r
-    EntityList returnList = null;\r
-    if (media != null) {\r
-      String id = media.getId();\r
-      String select = "select content_id from " + theTable + " where media_id=" +\r
-          id;\r
-\r
-      // execute select statement\r
-      Connection con = null;\r
-      Statement stmt = null;\r
-      try {\r
-        con = getPooledCon();\r
-        // should be a preparedStatement because is faster\r
-        stmt = con.createStatement();\r
-        ResultSet rs = executeSql(stmt, select);\r
-        if (rs != null) {\r
-          String mediaSelect = "id IN (";\r
-          boolean first = true;\r
-          while (rs.next()) {\r
-            if (first == false)\r
-              mediaSelect += ",";\r
-            mediaSelect += rs.getString(1);\r
-            first = false;\r
-          }\r
-          mediaSelect += ")";\r
-          if (first == false)\r
-            returnList = DatabaseContent.getInstance().selectByWhereClause(\r
-                mediaSelect, -1);\r
-        }\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("-- get content failed");\r
-        throw new StorageObjectFailure("-- get content failed -- ", e);\r
-      }\r
-      finally {\r
-        freeConnection(con, stmt);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * Returns a EntityList with all content-objects having a relation to a media\r
-   */\r
-\r
-  public EntityList getContent() throws StorageObjectFailure {\r
-    EntityList returnList = null;\r
-\r
-    String select = "select distinct content_id from " + theTable;\r
-    // execute select statement\r
-    Connection con = null;\r
-    Statement stmt = null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      ResultSet rs = executeSql(stmt, select);\r
-      if (rs != null) {\r
-        String mediaSelect = "id IN (";\r
-        boolean first = true;\r
-        while (rs.next()) {\r
-          if (first == false)\r
-            mediaSelect += ",";\r
-          mediaSelect += rs.getString(1);\r
-          first = false;\r
-        }\r
-        mediaSelect += ")";\r
-        if (first == false)\r
-          returnList = DatabaseContent.getInstance().selectByWhereClause(\r
-              mediaSelect, "webdb_lastchange desc");\r
-      }\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- get content failed");\r
-      throw new StorageObjectFailure("-- get content failed -- ", e);\r
-    }\r
-    finally {\r
-      freeConnection(con, stmt);\r
-    }\r
-\r
-    return returnList;\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectExc;
+import mir.storage.StorageObjectFailure;
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityUploadedMedia;
+
+/**
+ * <b>implements abstract DB connection to the content_x_media SQL table
+ *
+ * @author RK, mir-coders group
+ * @version $Id: DatabaseContentToMedia.java,v 1.17 2003/04/09 02:06:10 zapata Exp $
+ *
+ */
+
+public class DatabaseContentToMedia extends Database implements StorageObject{
+
+  private static DatabaseContentToMedia instance;
+
+  public static DatabaseContentToMedia getInstance() {
+    if (instance == null) {
+      synchronized (DatabaseContentToMedia.class) {
+        if (instance == null) {
+          instance = new DatabaseContentToMedia();
+          instance.myselfDatabase = instance;
+        }
+      }
+    }
+    return instance;
+  }
+
+  private DatabaseContentToMedia() {
+    super();
+
+    logger = new LoggerWrapper("Database.ContentToMedia");
+
+    hasTimestamp = false;
+    theTable = "content_x_media";
+    theEntityClass = mir.entity.GenericEntity.class;
+  }
+
+  /**
+   * get all the media-files belonging to a content entity
+   *
+   */
+  public EntityList getMedia(EntityContent content) throws StorageObjectFailure {
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        // media should stay in uploaded order. this is especially important
+        // for photo stories which require a specific chronologic order.
+        // this is why we have the the second parameter "id"
+        returnList = DatabaseMedia.getInstance().selectByWhereClause(subselect,
+            "id", -1);
+      }
+      catch (Throwable e) {
+        logger.debug("-- get media failed " + e.toString());
+        throw new StorageObjectFailure("-- get media failed ", e);
+      }
+    }
+    return returnList;
+  }
+
+  public boolean hasMedia(EntityContent content) throws StorageObjectFailure,
+      StorageObjectExc {
+    if (content != null) {
+      try {
+        if (selectByWhereClause("content_id=" + content.getId(), -1).size() ==
+            0)
+          return false;
+        else
+          return true;
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.hasMedia: " + e.toString());
+        throw new StorageObjectFailure("DatabaseContentToMedia.hasMedia: " +
+                                       e.toString(), e);
+      }
+    }
+    else {
+      logger.error("DatabaseContentToMedia.hasMedia: content == null");
+      throw new StorageObjectExc(
+          "DatabaseContentToMedia.hasMedia: content == null");
+    }
+  }
+
+  /**
+   * get all the audio belonging to a content entity
+   *
+   */
+  public EntityList getAudio(EntityContent content) throws StorageObjectFailure {
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      //this is not supported by mysql
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        // media should stay in uploaded order. this is especially important
+        // for photo stories which require a specific chronologic order.
+        // this is why we have the the second parameter "id"
+        returnList = DatabaseAudio.getInstance().selectByWhereClause(subselect,
+            "id", -1);
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.getAudio: " + e.toString());
+        throw new StorageObjectFailure("DatabaseContentToMedia.getAudio: " +
+                                       e.toString(), e);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * get all the video belonging to a content entity
+   *
+   */
+  public EntityList getVideo(EntityContent content) throws StorageObjectFailure {
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      //this is not supported by mysql
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        // media should stay in uploaded order. this is especially important
+        // for photo stories which require a specific chronologic order.
+        // this is why we have the the second parameter "id"
+        returnList = DatabaseVideo.getInstance().selectByWhereClause(subselect,
+            "id", -1);
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.getVideo: " + e.toString());
+        throw new StorageObjectFailure("DatabaseContentToMedia.getVideo: " +
+                                       e.toString(), e);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * get all the images belonging to a content entity
+   *
+   */
+  public EntityList getImages(EntityContent content) throws
+      StorageObjectFailure {
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      //this is not supported by mysql
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        // media should stay in uploaded order. this is especially important
+        // for photo stories which require a specific chronologic order.
+        // this is why we have the the second parameter "id"
+        returnList = DatabaseImages.getInstance().selectByWhereClause(subselect,
+            "id", -1);
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.getImages: " + e.toString());
+        throw new StorageObjectFailure("DatabaseContentToMedia.getImages: " +
+                                       e.toString(), e);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * get all the uploaded/other Media belonging to a content entity
+   *
+   */
+  public EntityList getOther(EntityContent content) throws StorageObjectFailure {
+    /** @todo this should only fetch published media / rk */
+
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      //this is not supported by mysql
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        // media should stay in uploaded order. this is especially important
+        // for photo stories which require a specific chronologic order.
+        // this is why we have the the second parameter "id"
+        returnList = DatabaseOther.getInstance().selectByWhereClause(subselect,
+            "id");
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.getOther: " + e.toString());
+        throw new StorageObjectFailure("DatabaseContentToMedia.getOther: " + e.toString(), e);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * get all the uploaded/other Media belonging to a content entity
+   *
+   */
+  public EntityList getUploadedMedia(EntityContent content) throws
+      StorageObjectFailure {
+    /** @todo this should only fetch published media / rk */
+
+    EntityList returnList = null;
+    if (content != null) {
+      // get all to_topic from media_x_topic
+      String id = content.getId();
+      //this is not supported by mysql
+      String subselect = "id in (select media_id from " + theTable +
+          " where content_id=" + id + ")";
+
+      try {
+        returnList = DatabaseUploadedMedia.getInstance().selectByWhereClause(
+            subselect,
+            "id");
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToMedia.getUploadedMedia: " + e.toString());
+        throw new StorageObjectFailure(
+            "DatabaseContentToMedia.getUploadedMedia: " + e.toString(), e);
+      }
+    }
+    return returnList;
+  }
+
+  public void setMedia(String contentId, String[] mediaId) throws
+      StorageObjectFailure {
+    if (contentId == null) {
+      return;
+    }
+    if (mediaId == null || mediaId[0] == null) {
+      return;
+    }
+    //first delete all row with content_id=contentId
+    String sql = "delete from " + theTable + " where content_id=" + contentId;
+
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      ResultSet rs = executeSql(stmt, sql);
+    }
+    catch (Exception e) {
+      logger.error("-- set media failed -- delete");
+      throw new StorageObjectFailure("-- set media failed -- delete", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+
+    //now insert
+    //first delete all row with content_id=contentId
+    for (int i = 0; i < mediaId.length; i++) {
+      sql = "insert into " + theTable + " (content_id,media_id) values ("
+          + contentId + "," + mediaId[i] + ")";
+      try {
+        con = getPooledCon();
+        // should be a preparedStatement because is faster
+        stmt = con.createStatement();
+        int rs = executeUpdate(stmt, sql);
+      }
+      catch (Exception e) {
+        logger.error("-- set topics failed -- insert");
+        throw new StorageObjectFailure("-- set topics failed -- insert ", e);
+      }
+      finally {
+        freeConnection(con, stmt);
+      }
+    }
+  }
+
+  public void addMedia(String contentId, String mediaId) throws
+      StorageObjectFailure {
+    if (contentId == null && mediaId == null) {
+      return;
+    }
+
+    Connection con = null;
+    Statement stmt = null;
+    //now insert
+
+    String sql = "insert into " + theTable + " (content_id,media_id) values ("
+        + contentId + "," + mediaId + ")";
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+    }
+    catch (Exception e) {
+      logger.error("-- add media failed -- insert");
+      throw new StorageObjectFailure("-- add media failed -- insert ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+  }
+
+  public void setMedia(String contentId, String mediaId) throws
+      StorageObjectFailure {
+    if (contentId == null && mediaId == null) {
+      return;
+    }
+    //first delete all row with content_id=contentId
+    String sql = "delete from " + theTable + " where content_id=" + contentId;
+
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+    }
+    catch (Exception e) {
+      logger.error("-- set media failed -- delete");
+      throw new StorageObjectFailure("-- set media failed -- delete ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+
+    //now insert
+    //first delete all row with content_id=contentId
+
+    sql = "insert into " + theTable + " (content_id,media_id) values ("
+        + contentId + "," + mediaId + ")";
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+    }
+    catch (Exception e) {
+      logger.error("-- set media failed -- insert");
+      throw new StorageObjectFailure("-- set media failed -- insert ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+  }
+
+  public void deleteByContentId(String contentId) throws StorageObjectFailure {
+    if (contentId == null) {
+      //theLog.printDebugInfo("-- delete topics failed -- no content id");
+      return;
+    }
+    //delete all row with content_id=contentId
+    String sql = "delete from " + theTable + " where content_id=" + contentId;
+
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+    }
+    catch (Exception e) {
+      logger.error("-- delete by contentId failed  ");
+      throw new StorageObjectFailure(
+          "-- delete by content id failed -- delete ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+  }
+
+  public void deleteByMediaId(String mediaId) throws StorageObjectFailure {
+    if (mediaId == null) {
+      //theLog.printDebugInfo("-- delete topics failed -- no topic id");
+      return;
+    }
+    //delete all row with content_id=contentId
+    String sql = "delete from " + theTable + " where media_id=" + mediaId;
+
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+      logger.debug("-- delete media success ");
+    }
+    catch (Exception e) {
+      logger.error("-- delete media failed ");
+      throw new StorageObjectFailure("-- delete by media id failed -- ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+  }
+
+  public void delete(String contentId, String mediaId) throws
+      StorageObjectFailure {
+    if (mediaId == null || contentId == null) {
+      logger.debug("-- delete media failed -- missing parameter");
+      return;
+    }
+    //delete all row with content_id=contentId and media_id=mediaId
+    String sql = "delete from " + theTable + " where media_id=" + mediaId +
+        " and content_id= " + contentId;
+
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt, sql);
+      logger.debug("-- delete content_x_media success ");
+    }
+    catch (Exception e) {
+      logger.error("-- delete content_x_media failed ");
+      throw new StorageObjectFailure("-- delete content_x_media failed -- ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+  }
+
+  public EntityList getContent(EntityUploadedMedia media) throws
+      StorageObjectFailure {
+    EntityList returnList = null;
+    if (media != null) {
+      String id = media.getId();
+      String select = "select content_id from " + theTable + " where media_id=" +
+          id;
+
+      // execute select statement
+      Connection con = null;
+      Statement stmt = null;
+      try {
+        con = getPooledCon();
+        // should be a preparedStatement because is faster
+        stmt = con.createStatement();
+        ResultSet rs = executeSql(stmt, select);
+        if (rs != null) {
+          String mediaSelect = "id IN (";
+          boolean first = true;
+          while (rs.next()) {
+            if (first == false)
+              mediaSelect += ",";
+            mediaSelect += rs.getString(1);
+            first = false;
+          }
+          mediaSelect += ")";
+          if (first == false)
+            returnList = DatabaseContent.getInstance().selectByWhereClause(
+                mediaSelect, -1);
+        }
+      }
+      catch (Exception e) {
+        logger.error("-- get content failed");
+        throw new StorageObjectFailure("-- get content failed -- ", e);
+      }
+      finally {
+        freeConnection(con, stmt);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * Returns a EntityList with all content-objects having a relation to a media
+   */
+
+  public EntityList getContent() throws StorageObjectFailure {
+    EntityList returnList = null;
+
+    String select = "select distinct content_id from " + theTable;
+    // execute select statement
+    Connection con = null;
+    Statement stmt = null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      ResultSet rs = executeSql(stmt, select);
+      if (rs != null) {
+        String mediaSelect = "id IN (";
+        boolean first = true;
+        while (rs.next()) {
+          if (first == false)
+            mediaSelect += ",";
+          mediaSelect += rs.getString(1);
+          first = false;
+        }
+        mediaSelect += ")";
+        if (first == false)
+          returnList = DatabaseContent.getInstance().selectByWhereClause(
+              mediaSelect, "webdb_lastchange desc");
+      }
+    }
+    catch (Exception e) {
+      logger.error("-- get content failed");
+      throw new StorageObjectFailure("-- get content failed -- ", e);
+    }
+    finally {
+      freeConnection(con, stmt);
+    }
+
+    return returnList;
+  }
+
+}
index 3dc3116..9bf6560 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.sql.Connection;\r
-import java.sql.ResultSet;\r
-import java.sql.Statement;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.entity.EntityTopics;\r
-\r
-/**\r
- * <b>This class implements the 1-n-relation between\r
- * content and topic\r
- *\r
- */\r
-\r
-public class DatabaseContentToTopics extends Database implements StorageObject{\r
-\r
-  private static DatabaseContentToTopics instance;\r
-\r
-  public static DatabaseContentToTopics getInstance() {\r
-    if (instance == null) {\r
-      synchronized (DatabaseContentToTopics.class) {\r
-        if (instance == null) {\r
-          instance = new DatabaseContentToTopics();\r
-          instance.myselfDatabase = instance;\r
-        }\r
-      }\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseContentToTopics() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.ContentToTopics");\r
-\r
-    hasTimestamp = false;\r
-    theTable="content_x_topic";\r
-    theEntityClass = mir.entity.GenericEntity.class;\r
-  }\r
-\r
-  /**\r
-   * This class return an EntityList of Topics\r
-   * @param EntityContent content\r
-   * @returns EntityList\r
-   */\r
-  public EntityList getTopics(EntityContent content) {\r
-    EntityList returnList=null;\r
-    if (content != null) {\r
-      // get all to_topic from content_x_topic\r
-      String id = content.getId();\r
-      String subselect = "id in (select topic_id from " + theTable + " where content_id=" + id+")";\r
-\r
-      try {\r
-        returnList = DatabaseTopics.getInstance().selectByWhereClause(subselect,-1);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("-- get topics failed " + e.toString());\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * Returns a ArrayList of Integer-Objects from a content-id.\r
-   * @returns ArrayList\r
-   */\r
-  public ArrayList getTopicsOfContent(String contentId)\r
-    throws StorageObjectFailure {\r
-    ArrayList returnList = new ArrayList();\r
-\r
-    if (contentId != null) {\r
-      String sql = "select topic_id from " + theTable + " where content_id=" + contentId;\r
-      Connection con=null;Statement stmt=null;\r
-      try {\r
-        con = getPooledCon();\r
-        // should be a preparedStatement because is faster\r
-        stmt = con.createStatement();\r
-        ResultSet rs = executeSql(stmt,sql);\r
-        if(rs!=null){\r
-          while(rs.next()){\r
-            returnList.add(new Integer(rs.getInt("topic_id")));\r
-          }\r
-        }\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("DatabaseContentToTopics.getTopicsOfContent: " + e.getMessage());\r
-      }\r
-      finally {\r
-        freeConnection(con,stmt);\r
-      }\r
-    }\r
-    return returnList;\r
-  }\r
-\r
-  /**\r
-   * Set new topics\r
-   */\r
-  public void setTopics(String contentId, String[] topicId)\r
-    throws StorageObjectFailure {\r
-    if (contentId == null){\r
-      return;\r
-    }\r
-    if (topicId==null || topicId[0]==null) {\r
-      return;\r
-    }\r
-    //first check which topics this article has\r
-    Collection hasTopics = getTopicsOfContent(contentId);\r
-    Collection toSet = new ArrayList();\r
-    Collection toDelete = new ArrayList();\r
-\r
-    if(hasTopics!=null && hasTopics.size()>0){\r
-      //now we check if there are new topics and copy them to an array.\r
-      for(int i = 0; i< topicId.length;i++){\r
-        boolean set=false;\r
-        int whichTopic = 0;\r
-        for(Iterator it=hasTopics.iterator();it.hasNext();){\r
-          Integer topic = (Integer)it.next();\r
-          if(topicId[i].equals(topic.toString())){\r
-            set=true;\r
-          } else {\r
-            whichTopic = i;\r
-          }\r
-        }\r
-        if(set==false){\r
-          toSet.add(topicId[i]);\r
-          logger.debug("to set: "+ topicId[i]);\r
-        }\r
-      }\r
-      //now we check if we have to delete topics\r
-      for(Iterator it=hasTopics.iterator();it.hasNext();){\r
-        boolean delete=true;\r
-        int whichTopic = 0;\r
-        Integer topic = (Integer)it.next();\r
-        for(int i = 0; i< topicId.length;i++){\r
-          if(topicId[i].equals(topic.toString())){\r
-            delete=false;\r
-          } else {\r
-            whichTopic = i;\r
-          }\r
-        }\r
-        if(delete==true){\r
-          toDelete.add(topic.toString());\r
-          logger.debug("to delete: "+ topic.toString());\r
-        }\r
-      }\r
-    } else {\r
-      //all the topics has to be set, so we copy all to the array\r
-                        for (int i = 0; i < topicId.length; i++){\r
-                                toSet.add(topicId[i]);\r
-                        }\r
-    }\r
-\r
-    //first delete all row with content_id=contentId\r
-    String sql = "delete from "+ theTable +" where content_id=" + contentId\r
-                + " and topic_id in (";\r
-    boolean first=false;\r
-    for(Iterator it = toDelete.iterator(); it.hasNext();){\r
-      if(first==false){\r
-        first=true;\r
-      } else {\r
-        sql+=",";\r
-      }\r
-      sql+= (String)it.next();\r
-    }\r
-    sql+=")";\r
-    Connection con=null;Statement stmt=null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      int rs = executeUpdate(stmt,sql);\r
-    } catch (Exception e) {\r
-      logger.error("-- deleting topics failed");\r
-    } finally {\r
-      freeConnection(con,stmt);\r
-    }\r
-\r
-    //now insert\r
-    //first delete all row with content_id=contentId\r
-    for (Iterator it = toSet.iterator(); it.hasNext();) {\r
-      sql = "insert into "+ theTable +" (content_id,topic_id) values ("\r
-            + contentId + "," + (String)it.next() + ")";\r
-      try {\r
-        con = getPooledCon();\r
-        // should be a preparedStatement because is faster\r
-        stmt = con.createStatement();\r
-        int rs = executeUpdate(stmt,sql);\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("-- set topics failed -- insert laenge topicId" + topicId.length);\r
-      } finally {\r
-        freeConnection(con,stmt);\r
-      }\r
-    }\r
-  }\r
-\r
-  public void deleteByContentId(String contentId)\r
-    throws StorageObjectFailure {\r
-    if (contentId == null) {\r
-      //theLog.printDebugInfo("-- delete topics failed -- no content id");\r
-      return;\r
-    }\r
-    //delete all row with content_id=contentId\r
-    String sql = "delete from "+ theTable +" where content_id=" + contentId;\r
-\r
-    Connection con=null;Statement stmt=null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      ResultSet rs = executeSql(stmt,sql);\r
-    } catch (Exception e) {\r
-      //theLog.printDebugInfo("-- delete topics failed  ");\r
-    } finally {\r
-      freeConnection(con,stmt);\r
-    }\r
-  }\r
-\r
-  public void deleteByTopicId(String topicId)\r
-    throws StorageObjectFailure {\r
-    if (topicId == null) {\r
-      //theLog.printDebugInfo("-- delete topics failed -- no topic id");\r
-      return;\r
-    }\r
-    //delete all row with content_id=contentId\r
-    String sql = "delete from "+ theTable +" where topic_id=" + topicId;\r
-\r
-    Connection con=null;Statement stmt=null;\r
-    try {\r
-      con = getPooledCon();\r
-      // should be a preparedStatement because is faster\r
-      stmt = con.createStatement();\r
-      ResultSet rs = executeSql(stmt,sql);\r
-    }\r
-    catch (Exception e) {\r
-      logger.error("-- delete topics failed ");\r
-    }\r
-    finally {\r
-      freeConnection(con,stmt);\r
-    }\r
-  }\r
-\r
-\r
-  public EntityList getContent(EntityTopics topic)\r
-    throws StorageObjectFailure {\r
-    EntityList returnList=null;\r
-    if (topic != null) {\r
-      String id = topic.getId();\r
-      String select = "select content_id from " + theTable + " where topic_id=" + id;\r
-\r
-      // execute select statement\r
-      Connection con=null;Statement stmt=null;\r
-      try {\r
-        con = getPooledCon();\r
-        // should be a preparedStatement because is faster\r
-        stmt = con.createStatement();\r
-        ResultSet rs = executeSql(stmt,select);\r
-        if (rs!=null) {\r
-          String topicSelect= "id IN (";\r
-          boolean first=true;\r
-          while (rs.next()) {\r
-            if (first==false) topicSelect+=",";\r
-            topicSelect += rs.getString(1);\r
-            first=false;\r
-          }\r
-          topicSelect+=")";\r
-          if (first==false)\r
-            returnList = DatabaseContent.getInstance().selectByWhereClause(topicSelect,-1);\r
-        }\r
-      }\r
-      catch (Exception e) {\r
-        logger.error("-- get contetn failed");\r
-      }\r
-      finally { freeConnection(con,stmt);}\r
-    }\r
-    return returnList;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityTopics;
+
+/**
+ * <b>This class implements the 1-n-relation between
+ * content and topic
+ *
+ */
+
+public class DatabaseContentToTopics extends Database implements StorageObject{
+
+  private static DatabaseContentToTopics instance;
+
+  public static DatabaseContentToTopics getInstance() {
+    if (instance == null) {
+      synchronized (DatabaseContentToTopics.class) {
+        if (instance == null) {
+          instance = new DatabaseContentToTopics();
+          instance.myselfDatabase = instance;
+        }
+      }
+    }
+    return instance;
+  }
+
+  private DatabaseContentToTopics() {
+    super();
+
+    logger = new LoggerWrapper("Database.ContentToTopics");
+
+    hasTimestamp = false;
+    theTable="content_x_topic";
+    theEntityClass = mir.entity.GenericEntity.class;
+  }
+
+  /**
+   * This class return an EntityList of Topics
+   * @param EntityContent content
+   * @returns EntityList
+   */
+  public EntityList getTopics(EntityContent content) {
+    EntityList returnList=null;
+    if (content != null) {
+      // get all to_topic from content_x_topic
+      String id = content.getId();
+      String subselect = "id in (select topic_id from " + theTable + " where content_id=" + id+")";
+
+      try {
+        returnList = DatabaseTopics.getInstance().selectByWhereClause(subselect,-1);
+      }
+      catch (Exception e) {
+        logger.error("-- get topics failed " + e.toString());
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * Returns a ArrayList of Integer-Objects from a content-id.
+   * @returns ArrayList
+   */
+  public ArrayList getTopicsOfContent(String contentId)
+    throws StorageObjectFailure {
+    ArrayList returnList = new ArrayList();
+
+    if (contentId != null) {
+      String sql = "select topic_id from " + theTable + " where content_id=" + contentId;
+      Connection con=null;Statement stmt=null;
+      try {
+        con = getPooledCon();
+        // should be a preparedStatement because is faster
+        stmt = con.createStatement();
+        ResultSet rs = executeSql(stmt,sql);
+        if(rs!=null){
+          while(rs.next()){
+            returnList.add(new Integer(rs.getInt("topic_id")));
+          }
+        }
+      }
+      catch (Exception e) {
+        logger.error("DatabaseContentToTopics.getTopicsOfContent: " + e.getMessage());
+      }
+      finally {
+        freeConnection(con,stmt);
+      }
+    }
+    return returnList;
+  }
+
+  /**
+   * Set new topics
+   */
+  public void setTopics(String contentId, String[] topicId)
+    throws StorageObjectFailure {
+    if (contentId == null){
+      return;
+    }
+    if (topicId==null || topicId[0]==null) {
+      return;
+    }
+    //first check which topics this article has
+    Collection hasTopics = getTopicsOfContent(contentId);
+    Collection toSet = new ArrayList();
+    Collection toDelete = new ArrayList();
+
+    if(hasTopics!=null && hasTopics.size()>0){
+      //now we check if there are new topics and copy them to an array.
+      for(int i = 0; i< topicId.length;i++){
+        boolean set=false;
+        int whichTopic = 0;
+        for(Iterator it=hasTopics.iterator();it.hasNext();){
+          Integer topic = (Integer)it.next();
+          if(topicId[i].equals(topic.toString())){
+            set=true;
+          } else {
+            whichTopic = i;
+          }
+        }
+        if(set==false){
+          toSet.add(topicId[i]);
+          logger.debug("to set: "+ topicId[i]);
+        }
+      }
+      //now we check if we have to delete topics
+      for(Iterator it=hasTopics.iterator();it.hasNext();){
+        boolean delete=true;
+        int whichTopic = 0;
+        Integer topic = (Integer)it.next();
+        for(int i = 0; i< topicId.length;i++){
+          if(topicId[i].equals(topic.toString())){
+            delete=false;
+          } else {
+            whichTopic = i;
+          }
+        }
+        if(delete==true){
+          toDelete.add(topic.toString());
+          logger.debug("to delete: "+ topic.toString());
+        }
+      }
+    } else {
+      //all the topics has to be set, so we copy all to the array
+                        for (int i = 0; i < topicId.length; i++){
+                                toSet.add(topicId[i]);
+                        }
+    }
+
+    //first delete all row with content_id=contentId
+    String sql = "delete from "+ theTable +" where content_id=" + contentId
+                + " and topic_id in (";
+    boolean first=false;
+    for(Iterator it = toDelete.iterator(); it.hasNext();){
+      if(first==false){
+        first=true;
+      } else {
+        sql+=",";
+      }
+      sql+= (String)it.next();
+    }
+    sql+=")";
+    Connection con=null;Statement stmt=null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      int rs = executeUpdate(stmt,sql);
+    } catch (Exception e) {
+      logger.error("-- deleting topics failed");
+    } finally {
+      freeConnection(con,stmt);
+    }
+
+    //now insert
+    //first delete all row with content_id=contentId
+    for (Iterator it = toSet.iterator(); it.hasNext();) {
+      sql = "insert into "+ theTable +" (content_id,topic_id) values ("
+            + contentId + "," + (String)it.next() + ")";
+      try {
+        con = getPooledCon();
+        // should be a preparedStatement because is faster
+        stmt = con.createStatement();
+        int rs = executeUpdate(stmt,sql);
+      }
+      catch (Exception e) {
+        logger.error("-- set topics failed -- insert laenge topicId" + topicId.length);
+      } finally {
+        freeConnection(con,stmt);
+      }
+    }
+  }
+
+  public void deleteByContentId(String contentId)
+    throws StorageObjectFailure {
+    if (contentId == null) {
+      //theLog.printDebugInfo("-- delete topics failed -- no content id");
+      return;
+    }
+    //delete all row with content_id=contentId
+    String sql = "delete from "+ theTable +" where content_id=" + contentId;
+
+    Connection con=null;Statement stmt=null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      ResultSet rs = executeSql(stmt,sql);
+    } catch (Exception e) {
+      //theLog.printDebugInfo("-- delete topics failed  ");
+    } finally {
+      freeConnection(con,stmt);
+    }
+  }
+
+  public void deleteByTopicId(String topicId)
+    throws StorageObjectFailure {
+    if (topicId == null) {
+      //theLog.printDebugInfo("-- delete topics failed -- no topic id");
+      return;
+    }
+    //delete all row with content_id=contentId
+    String sql = "delete from "+ theTable +" where topic_id=" + topicId;
+
+    Connection con=null;Statement stmt=null;
+    try {
+      con = getPooledCon();
+      // should be a preparedStatement because is faster
+      stmt = con.createStatement();
+      ResultSet rs = executeSql(stmt,sql);
+    }
+    catch (Exception e) {
+      logger.error("-- delete topics failed ");
+    }
+    finally {
+      freeConnection(con,stmt);
+    }
+  }
+
+
+  public EntityList getContent(EntityTopics topic)
+    throws StorageObjectFailure {
+    EntityList returnList=null;
+    if (topic != null) {
+      String id = topic.getId();
+      String select = "select content_id from " + theTable + " where topic_id=" + id;
+
+      // execute select statement
+      Connection con=null;Statement stmt=null;
+      try {
+        con = getPooledCon();
+        // should be a preparedStatement because is faster
+        stmt = con.createStatement();
+        ResultSet rs = executeSql(stmt,select);
+        if (rs!=null) {
+          String topicSelect= "id IN (";
+          boolean first=true;
+          while (rs.next()) {
+            if (first==false) topicSelect+=",";
+            topicSelect += rs.getString(1);
+            first=false;
+          }
+          topicSelect+=")";
+          if (first==false)
+            returnList = DatabaseContent.getInstance().selectByWhereClause(topicSelect,-1);
+        }
+      }
+      catch (Exception e) {
+        logger.error("-- get contetn failed");
+      }
+      finally { freeConnection(con,stmt);}
+    }
+    return returnList;
+  }
+}
index c611dfc..6b0bd9e 100755 (executable)
@@ -1,72 +1,72 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseImageColor extends Database implements StorageObject{\r
-\r
-  private static DatabaseImageColor instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseImageColor getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseImageColor();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseImageColor() {\r
-    super();\r
-    logger = new LoggerWrapper("Database.ImageColor");\r
-    hasTimestamp = false;\r
-    theTable = "img_color";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", true);\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageColor extends Database implements StorageObject{
+
+  private static DatabaseImageColor instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseImageColor getInstance() {
+    if (instance == null) {
+      instance = new DatabaseImageColor();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseImageColor() {
+    super();
+    logger = new LoggerWrapper("Database.ImageColor");
+    hasTimestamp = false;
+    theTable = "img_color";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", true);
+  }
+}
index 217d4c7..776b679 100755 (executable)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseImageFormat extends Database implements StorageObject{\r
-\r
-  private static DatabaseImageFormat instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseImageFormat getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseImageFormat();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseImageFormat() {\r
-    super();\r
-    logger = new LoggerWrapper("Database.ImageFormat");\r
-    hasTimestamp = false;\r
-    theTable = "img_format";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", true);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageFormat extends Database implements StorageObject{
+
+  private static DatabaseImageFormat instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseImageFormat getInstance() {
+    if (instance == null) {
+      instance = new DatabaseImageFormat();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseImageFormat() {
+    super();
+    logger = new LoggerWrapper("Database.ImageFormat");
+    hasTimestamp = false;
+    theTable = "img_format";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", true);
+  }
+
+}
index c3bf576..677e635 100755 (executable)
@@ -1,74 +1,74 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseImageLayout extends Database implements StorageObject{\r
-\r
-  private static DatabaseImageLayout instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseImageLayout getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseImageLayout();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseImageLayout() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.ImageLayout");\r
-    hasTimestamp = false;\r
-    theTable = "img_layout";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", true);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageLayout extends Database implements StorageObject{
+
+  private static DatabaseImageLayout instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseImageLayout getInstance() {
+    if (instance == null) {
+      instance = new DatabaseImageLayout();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseImageLayout() {
+    super();
+
+    logger = new LoggerWrapper("Database.ImageLayout");
+    hasTimestamp = false;
+    theTable = "img_layout";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", true);
+  }
+
+}
index e3754fe..2743ba6 100755 (executable)
@@ -1,72 +1,72 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseImageType extends Database implements StorageObject{\r
-  private static DatabaseImageType instance;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseImageType getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseImageType();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseImageType() {\r
-    super();\r
-    logger = new LoggerWrapper("Database.ImageType");\r
-\r
-    hasTimestamp = false;\r
-    theTable = "img_type";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", true);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageType extends Database implements StorageObject{
+  private static DatabaseImageType instance;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseImageType getInstance() {
+    if (instance == null) {
+      instance = new DatabaseImageType();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseImageType() {
+    super();
+    logger = new LoggerWrapper("Database.ImageType");
+
+    hasTimestamp = false;
+    theTable = "img_type";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", true);
+  }
+
+}
index e44eb28..0638f33 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.util.GregorianCalendar;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseImages extends Database implements StorageObject{\r
-\r
-  private static DatabaseImages instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseImages getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseImages();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseImages() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Images");\r
-\r
-    hasTimestamp = true;\r
-    theTable = "images";\r
-    theCoreTable = "media";\r
-    theEntityClass = mircoders.entity.EntityImages.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-\r
-    super.update(theEntity);\r
-  }\r
-\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-\r
-    return super.insert(theEntity);\r
-  }\r
-\r
-  // initialisierungen aus den statischen Tabellen\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.util.GregorianCalendar;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImages extends Database implements StorageObject{
+
+  private static DatabaseImages instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseImages getInstance() {
+    if (instance == null) {
+      instance = new DatabaseImages();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseImages() {
+    super();
+
+    logger = new LoggerWrapper("Database.Images");
+
+    hasTimestamp = true;
+    theTable = "images";
+    theCoreTable = "media";
+    theEntityClass = mircoders.entity.EntityImages.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+
+    super.update(theEntity);
+  }
+
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+
+    return super.insert(theEntity);
+  }
+
+  // initialisierungen aus den statischen Tabellen
+
+}
index 0d2b585..dddac23 100755 (executable)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-/**\r
- * Title: DatabaseLanguage\r
- * Description:\r
- * Copyright:    Copyright (c) 2001\r
- * Company:      Indymedia\r
- * @author\r
- * @version 1.0\r
- */\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-\r
-public class DatabaseLanguage extends Database implements StorageObject{\r
-\r
-  private static DatabaseLanguage instance;\r
-  private static SimpleList languagePopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseLanguage getInstance() throws\r
-      StorageObjectFailure {\r
-    if (instance == null) {\r
-      instance = new DatabaseLanguage();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseLanguage() throws StorageObjectFailure {\r
-    super();\r
-    logger = new LoggerWrapper("Database.Language");\r
-\r
-    this.hasTimestamp = false;\r
-    this.theTable = "language";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    SimpleList pData = null;\r
-    pData = getPopupData("name", false);\r
-\r
-    return pData;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+/**
+ * Title: DatabaseLanguage
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+
+public class DatabaseLanguage extends Database implements StorageObject{
+
+  private static DatabaseLanguage instance;
+  private static SimpleList languagePopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseLanguage getInstance() throws
+      StorageObjectFailure {
+    if (instance == null) {
+      instance = new DatabaseLanguage();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseLanguage() throws StorageObjectFailure {
+    super();
+    logger = new LoggerWrapper("Database.Language");
+
+    this.hasTimestamp = false;
+    this.theTable = "language";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    SimpleList pData = null;
+    pData = getPopupData("name", false);
+
+    return pData;
+  }
+}
index 0499acb..3ca88c3 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mircoders.storage;\r
-\r
-import java.sql.Connection;\r
-import java.sql.PreparedStatement;\r
-import java.sql.ResultSet;\r
-import java.sql.SQLException;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import mir.util.JDBCStringRoutines;\r
-\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-public class DatabaseLinksImcs extends Database implements StorageObject {\r
-\r
-  private static DatabaseLinksImcs instance;\r
-\r
-  public static DatabaseLinksImcs getInstance() {\r
-    if (instance == null) {\r
-      synchronized (DatabaseLinksImcs.class) {\r
-        if (instance == null) {\r
-          DatabaseLinksImcs newInstance;\r
-\r
-          newInstance = new DatabaseLinksImcs();\r
-          newInstance.myselfDatabase = newInstance;\r
-          instance = newInstance;\r
-        }\r
-      }\r
-    }\r
-\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseLinksImcs() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("ServletModule.Database.LinksImcs");\r
-    hasTimestamp = false;\r
-    theTable = "links_imcs";\r
-\r
-    theEntityClass = mircoders.entity.EntityLinksImcs.class;\r
-  }\r
-\r
-  /** @todo toooo much copy/paste in this class //rk  */\r
-\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    String returnId = "0";\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-    //cache\r
-    invalidatePopupCache();\r
-    try {\r
-      Map theEntityValues = theEntity.getValues();\r
-      List streamedInput = theEntity.streamedInput();\r
-      StringBuffer f = new StringBuffer();\r
-      StringBuffer v = new StringBuffer();\r
-      String aField, aValue;\r
-      boolean firstField = true;\r
-      // make sql-string\r
-      for (int i = 0; i < getFields().size(); i++) {\r
-        aField = (String) getFields().get(i);\r
-        if (!aField.equals(thePKeyName)) {\r
-          aValue = null;\r
-          // sonderfaelle\r
-          if (aField.equals("webdb_create")) {\r
-            aValue = "NOW()";\r
-          }\r
-          else {\r
-            if (streamedInput != null && streamedInput.contains(aField)) {\r
-              aValue = "?";\r
-            }\r
-            else {\r
-              if (theEntityValues.containsKey(aField)) {\r
-                if (aField.equals("to_parent_id")) {\r
-                  aValue = JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField));\r
-                }\r
-                else {\r
-                  aValue = "'" + JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField)) +  "'";\r
-                }\r
-              }\r
-            }\r
-          }\r
-          // wenn Wert gegeben, dann einbauen\r
-          if (aValue != null) {\r
-            if (firstField == false) {\r
-              f.append(",");\r
-              v.append(",");\r
-            }\r
-            else {\r
-              firstField = false;\r
-            }\r
-            f.append(aField);\r
-            v.append(aValue);\r
-          }\r
-        }\r
-      } // end for\r
-      // insert into db\r
-      StringBuffer sqlBuf =\r
-          new StringBuffer("insert into ").append(theTable).append("(").append(f).append(") values (").append(v).append(")");\r
-      String sql = sqlBuf.toString();\r
-\r
-      logger.info("INSERT: " + sql);\r
-\r
-      con = getPooledCon();\r
-      con.setAutoCommit(false);\r
-      pstmt = con.prepareStatement(sql);\r
-      if (streamedInput != null) {\r
-        for (int i = 0; i < streamedInput.size(); i++) {\r
-          String inputString = (String) theEntityValues.get(streamedInput.get(i));\r
-          pstmt.setBytes(i + 1, inputString.getBytes());\r
-        }\r
-      }\r
-      pstmt.execute();\r
-      pstmt = con.prepareStatement(theAdaptor.getLastInsertSQL( (Database)\r
-          myselfDatabase));\r
-      ResultSet rs = pstmt.executeQuery();\r
-      rs.next();\r
-      returnId = rs.getString(1);\r
-      theEntity.setId(returnId);\r
-    }\r
-    catch (SQLException sqe) {\r
-      throwSQLException(sqe, "insert");\r
-    }\r
-    finally {\r
-      try {\r
-        con.setAutoCommit(true);\r
-      }\r
-      catch (Exception e) {\r
-        ;\r
-      }\r
-      freeConnection(con, pstmt);\r
-    }\r
-    return returnId;\r
-  }\r
-\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    Connection con = null;\r
-    PreparedStatement pstmt = null;\r
-    List streamedInput = theEntity.streamedInput();\r
-    Map theEntityValues = theEntity.getValues();\r
-    String id = theEntity.getId();\r
-    String aField;\r
-    StringBuffer fv = new StringBuffer();\r
-    boolean firstField = true;\r
-    //cache\r
-    invalidatePopupCache();\r
-    // build sql statement\r
-    for (int i = 0; i < getFields().size(); i++) {\r
-      aField = (String) metadataFields.get(i);\r
-      // only normal cases\r
-      if (! (aField.equals(thePKeyName) || aField.equals("webdb_create") ||\r
-             aField.equals("webdb_lastchange") ||\r
-             (streamedInput != null && streamedInput.contains(aField)))) {\r
-        if (theEntityValues.containsKey(aField)) {\r
-          if (firstField == false) {\r
-            fv.append(", ");\r
-          }\r
-          else {\r
-            firstField = false;\r
-          }\r
-          if (aField.equals("to_parent_id")) {\r
-            fv.append(aField).append("=").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField)));\r
-          }\r
-          else {\r
-            fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField))).append("'");\r
-          }\r
-        }\r
-      }\r
-    }\r
-    StringBuffer sql = new StringBuffer("update ").append(theTable).append(\r
-        " set ").append(fv);\r
-    // exceptions\r
-    if (metadataFields.contains("webdb_lastchange")) {\r
-      sql.append(",webdb_lastchange=NOW()");\r
-    }\r
-    if (streamedInput != null) {\r
-      for (int i = 0; i < streamedInput.size(); i++) {\r
-        sql.append(",").append(streamedInput.get(i)).append("=?");\r
-      }\r
-    }\r
-    sql.append(" where id=").append(id);\r
-    logger.info("UPDATE: " + sql);\r
-    // execute sql\r
-    try {\r
-      con = getPooledCon();\r
-      con.setAutoCommit(false);\r
-      pstmt = con.prepareStatement(sql.toString());\r
-      if (streamedInput != null) {\r
-        for (int i = 0; i < streamedInput.size(); i++) {\r
-          String inputString = (String) theEntityValues.get(streamedInput.get(i));\r
-          pstmt.setBytes(i + 1, inputString.getBytes());\r
-        }\r
-      }\r
-      pstmt.executeUpdate();\r
-    }\r
-    catch (SQLException sqe) {\r
-      throwSQLException(sqe, "update");\r
-    }\r
-    finally {\r
-      try {\r
-        con.setAutoCommit(true);\r
-      }\r
-      catch (Exception e) {\r
-        ;\r
-      }\r
-      freeConnection(con, pstmt);\r
-    }\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mircoders.storage;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import mir.util.JDBCStringRoutines;
+
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+public class DatabaseLinksImcs extends Database implements StorageObject {
+
+  private static DatabaseLinksImcs instance;
+
+  public static DatabaseLinksImcs getInstance() {
+    if (instance == null) {
+      synchronized (DatabaseLinksImcs.class) {
+        if (instance == null) {
+          DatabaseLinksImcs newInstance;
+
+          newInstance = new DatabaseLinksImcs();
+          newInstance.myselfDatabase = newInstance;
+          instance = newInstance;
+        }
+      }
+    }
+
+    return instance;
+  }
+
+  private DatabaseLinksImcs() {
+    super();
+
+    logger = new LoggerWrapper("ServletModule.Database.LinksImcs");
+    hasTimestamp = false;
+    theTable = "links_imcs";
+
+    theEntityClass = mircoders.entity.EntityLinksImcs.class;
+  }
+
+  /** @todo toooo much copy/paste in this class //rk  */
+
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    String returnId = "0";
+    Connection con = null;
+    PreparedStatement pstmt = null;
+    //cache
+    invalidatePopupCache();
+    try {
+      Map theEntityValues = theEntity.getValues();
+      List streamedInput = theEntity.streamedInput();
+      StringBuffer f = new StringBuffer();
+      StringBuffer v = new StringBuffer();
+      String aField, aValue;
+      boolean firstField = true;
+      // make sql-string
+      for (int i = 0; i < getFields().size(); i++) {
+        aField = (String) getFields().get(i);
+        if (!aField.equals(thePKeyName)) {
+          aValue = null;
+          // sonderfaelle
+          if (aField.equals("webdb_create")) {
+            aValue = "NOW()";
+          }
+          else {
+            if (streamedInput != null && streamedInput.contains(aField)) {
+              aValue = "?";
+            }
+            else {
+              if (theEntityValues.containsKey(aField)) {
+                if (aField.equals("to_parent_id")) {
+                  aValue = JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField));
+                }
+                else {
+                  aValue = "'" + JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField)) +  "'";
+                }
+              }
+            }
+          }
+          // wenn Wert gegeben, dann einbauen
+          if (aValue != null) {
+            if (firstField == false) {
+              f.append(",");
+              v.append(",");
+            }
+            else {
+              firstField = false;
+            }
+            f.append(aField);
+            v.append(aValue);
+          }
+        }
+      } // end for
+      // insert into db
+      StringBuffer sqlBuf =
+          new StringBuffer("insert into ").append(theTable).append("(").append(f).append(") values (").append(v).append(")");
+      String sql = sqlBuf.toString();
+
+      logger.info("INSERT: " + sql);
+
+      con = getPooledCon();
+      con.setAutoCommit(false);
+      pstmt = con.prepareStatement(sql);
+      if (streamedInput != null) {
+        for (int i = 0; i < streamedInput.size(); i++) {
+          String inputString = (String) theEntityValues.get(streamedInput.get(i));
+          pstmt.setBytes(i + 1, inputString.getBytes());
+        }
+      }
+      pstmt.execute();
+      pstmt = con.prepareStatement(theAdaptor.getLastInsertSQL( (Database)
+          myselfDatabase));
+      ResultSet rs = pstmt.executeQuery();
+      rs.next();
+      returnId = rs.getString(1);
+      theEntity.setId(returnId);
+    }
+    catch (SQLException sqe) {
+      throwSQLException(sqe, "insert");
+    }
+    finally {
+      try {
+        con.setAutoCommit(true);
+      }
+      catch (Exception e) {
+        ;
+      }
+      freeConnection(con, pstmt);
+    }
+    return returnId;
+  }
+
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    Connection con = null;
+    PreparedStatement pstmt = null;
+    List streamedInput = theEntity.streamedInput();
+    Map theEntityValues = theEntity.getValues();
+    String id = theEntity.getId();
+    String aField;
+    StringBuffer fv = new StringBuffer();
+    boolean firstField = true;
+    //cache
+    invalidatePopupCache();
+    // build sql statement
+    for (int i = 0; i < getFields().size(); i++) {
+      aField = (String) metadataFields.get(i);
+      // only normal cases
+      if (! (aField.equals(thePKeyName) || aField.equals("webdb_create") ||
+             aField.equals("webdb_lastchange") ||
+             (streamedInput != null && streamedInput.contains(aField)))) {
+        if (theEntityValues.containsKey(aField)) {
+          if (firstField == false) {
+            fv.append(", ");
+          }
+          else {
+            firstField = false;
+          }
+          if (aField.equals("to_parent_id")) {
+            fv.append(aField).append("=").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField)));
+          }
+          else {
+            fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField))).append("'");
+          }
+        }
+      }
+    }
+    StringBuffer sql = new StringBuffer("update ").append(theTable).append(
+        " set ").append(fv);
+    // exceptions
+    if (metadataFields.contains("webdb_lastchange")) {
+      sql.append(",webdb_lastchange=NOW()");
+    }
+    if (streamedInput != null) {
+      for (int i = 0; i < streamedInput.size(); i++) {
+        sql.append(",").append(streamedInput.get(i)).append("=?");
+      }
+    }
+    sql.append(" where id=").append(id);
+    logger.info("UPDATE: " + sql);
+    // execute sql
+    try {
+      con = getPooledCon();
+      con.setAutoCommit(false);
+      pstmt = con.prepareStatement(sql.toString());
+      if (streamedInput != null) {
+        for (int i = 0; i < streamedInput.size(); i++) {
+          String inputString = (String) theEntityValues.get(streamedInput.get(i));
+          pstmt.setBytes(i + 1, inputString.getBytes());
+        }
+      }
+      pstmt.executeUpdate();
+    }
+    catch (SQLException sqe) {
+      throwSQLException(sqe, "update");
+    }
+    finally {
+      try {
+        con.setAutoCommit(true);
+      }
+      catch (Exception e) {
+        ;
+      }
+      freeConnection(con, pstmt);
+    }
+  }
+
 }
\ No newline at end of file
index 7a9848b..5457e73 100755 (executable)
@@ -31,8 +31,8 @@
 
 package mircoders.storage;
 
-import mir.log.LoggerWrapper;
-import mir.storage.Database;
+import mir.log.LoggerWrapper;\r
+import mir.storage.Database;\r
 import mir.storage.StorageObject;
 
 
@@ -47,12 +47,8 @@ import mir.storage.StorageObject;
 
 
 public class DatabaseMessages extends Database implements StorageObject{
-
   private static DatabaseMessages instance;
 
-  // the following *has* to be sychronized cause this static method
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..
-  // see the "Singletons with needles and thread" article at JavaWorld -mh
   public synchronized static DatabaseMessages getInstance() {
     if (instance == null) {
       instance = new DatabaseMessages();
index fce632d..3ed1554 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-\r
-import java.util.GregorianCalendar;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseOther extends Database implements StorageObject{\r
-  private static DatabaseOther instance;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseOther getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseOther();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseOther() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.OtherMedia");\r
-\r
-    hasTimestamp = true;\r
-    theTable = "other_media";\r
-    theCoreTable = "media";\r
-    theEntityClass = mircoders.entity.EntityOther.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-\r
-    super.update(theEntity);\r
-  }\r
-\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-    return super.insert(theEntity);\r
-  }\r
-\r
-  // initialisierungen aus den statischen Tabellen\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+
+import java.util.GregorianCalendar;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseOther extends Database implements StorageObject{
+  private static DatabaseOther instance;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseOther getInstance() {
+    if (instance == null) {
+      instance = new DatabaseOther();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseOther() {
+    super();
+
+    logger = new LoggerWrapper("Database.OtherMedia");
+
+    hasTimestamp = true;
+    theTable = "other_media";
+    theCoreTable = "media";
+    theEntityClass = mircoders.entity.EntityOther.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+
+    super.update(theEntity);
+  }
+
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+    return super.insert(theEntity);
+  }
+
+  // initialisierungen aus den statischen Tabellen
+
+}
index 3c87f89..772c318 100755 (executable)
@@ -1,74 +1,74 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseRights extends Database implements StorageObject{\r
-  private static DatabaseRights instance;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseRights getInstance() throws\r
-      StorageObjectFailure {\r
-    if (instance == null) {\r
-      instance = new DatabaseRights();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseRights() throws StorageObjectFailure {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Rights");\r
-\r
-    hasTimestamp = false;\r
-    theTable = "rights";\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("name", true);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseRights extends Database implements StorageObject{
+  private static DatabaseRights instance;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseRights getInstance() throws
+      StorageObjectFailure {
+    if (instance == null) {
+      instance = new DatabaseRights();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseRights() throws StorageObjectFailure {
+    super();
+
+    logger = new LoggerWrapper("Database.Rights");
+
+    hasTimestamp = false;
+    theTable = "rights";
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("name", true);
+  }
+
+}
index 2445eb3..09a1544 100755 (executable)
@@ -1,75 +1,75 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseTopics extends Database implements StorageObject{\r
-\r
-  private static DatabaseTopics instance;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseTopics getInstance() throws\r
-      StorageObjectFailure {\r
-    if (instance == null) {\r
-      instance = new DatabaseTopics();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseTopics() throws StorageObjectFailure {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Topics");\r
-\r
-    hasTimestamp = false;\r
-    theTable = "topic";\r
-    theEntityClass = mircoders.entity.EntityTopics.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseTopics extends Database implements StorageObject{
+
+  private static DatabaseTopics instance;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseTopics getInstance() throws
+      StorageObjectFailure {
+    if (instance == null) {
+      instance = new DatabaseTopics();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseTopics() throws StorageObjectFailure {
+    super();
+
+    logger = new LoggerWrapper("Database.Topics");
+
+    hasTimestamp = false;
+    theTable = "topic";
+    theEntityClass = mircoders.entity.EntityTopics.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+}
index edf5d96..5d91315 100755 (executable)
@@ -1,87 +1,87 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.EntityRelation;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-\r
-public class DatabaseUploadedMedia extends Database implements StorageObject {\r
-  private static DatabaseUploadedMedia  instance;\r
-  private static EntityRelation         relationMediaType;\r
-\r
-  public static DatabaseUploadedMedia getInstance() {\r
-    if (instance == null ) {\r
-      synchronized(DatabaseUploadedMedia.class) {\r
-        if (instance == null ) {\r
-          instance = new DatabaseUploadedMedia();\r
-          instance.myselfDatabase = instance;\r
-        }\r
-      }\r
-    }\r
-\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseUploadedMedia() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.UploadedMedia");\r
-\r
-    theTable="uploaded_media";\r
-    theCoreTable="media";\r
-    relationMediaType = new EntityRelation("to_media_type", "id", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);\r
-    theEntityClass = mircoders.entity.EntityUploadedMedia.class;\r
-  }\r
-\r
-\r
-  /**\r
-   * returns the media_type that belongs to the media item (via entityrelation)\r
-   * where db-flag is_published is true\r
-   */\r
-  public Entity getMediaType(Entity ent) throws StorageObjectFailure {\r
-    Entity type=null;\r
-    try {\r
-      type = relationMediaType.getOne(ent);\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("DatabaseUploadedMedia :: failed to get media_type: " + t.getMessage());\r
-\r
-      throw new StorageObjectFailure("DatabaseUploadedMedia :: failed to get media_type", t);\r
-    }\r
-    return type;\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.entity.Entity;
+import mir.entity.EntityRelation;
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+
+public class DatabaseUploadedMedia extends Database implements StorageObject {
+  private static DatabaseUploadedMedia  instance;
+  private static EntityRelation         relationMediaType;
+
+  public static DatabaseUploadedMedia getInstance() {
+    if (instance == null ) {
+      synchronized(DatabaseUploadedMedia.class) {
+        if (instance == null ) {
+          instance = new DatabaseUploadedMedia();
+          instance.myselfDatabase = instance;
+        }
+      }
+    }
+
+    return instance;
+  }
+
+  private DatabaseUploadedMedia() {
+    super();
+
+    logger = new LoggerWrapper("Database.UploadedMedia");
+
+    theTable="uploaded_media";
+    theCoreTable="media";
+    relationMediaType = new EntityRelation("to_media_type", "id", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
+    theEntityClass = mircoders.entity.EntityUploadedMedia.class;
+  }
+
+
+  /**
+   * returns the media_type that belongs to the media item (via entityrelation)
+   * where db-flag is_published is true
+   */
+  public Entity getMediaType(Entity ent) throws StorageObjectFailure {
+    Entity type=null;
+    try {
+      type = relationMediaType.getOne(ent);
+    }
+    catch (Throwable t) {
+      logger.error("DatabaseUploadedMedia :: failed to get media_type: " + t.getMessage());
+
+      throw new StorageObjectFailure("DatabaseUploadedMedia :: failed to get media_type", t);
+    }
+    return type;
+  }
+
+}
index 1373abb..580cc26 100755 (executable)
@@ -1,75 +1,75 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseUsers extends Database implements StorageObject{\r
-\r
-  private static DatabaseUsers instance;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseUsers getInstance() throws\r
-      StorageObjectFailure {\r
-    if (instance == null) {\r
-      instance = new DatabaseUsers();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseUsers() throws StorageObjectFailure {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Users");\r
-\r
-    hasTimestamp = false;\r
-    theTable = "webdb_users";\r
-    theEntityClass = mircoders.entity.EntityUsers.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("login", true);\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseUsers extends Database implements StorageObject{
+
+  private static DatabaseUsers instance;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseUsers getInstance() throws
+      StorageObjectFailure {
+    if (instance == null) {
+      instance = new DatabaseUsers();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseUsers() throws StorageObjectFailure {
+    super();
+
+    logger = new LoggerWrapper("Database.Users");
+
+    hasTimestamp = false;
+    theTable = "webdb_users";
+    theEntityClass = mircoders.entity.EntityUsers.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("login", true);
+  }
+}
index e1cdf4e..0c720e8 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-import java.util.GregorianCalendar;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle\r
- *\r
- *\r
- */\r
-\r
-public class DatabaseVideo extends Database implements StorageObject{\r
-\r
-  private static DatabaseVideo instance;\r
-  private static SimpleList publisherPopupData;\r
-\r
-  // the following *has* to be sychronized cause this static method\r
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..\r
-  // see the "Singletons with needles and thread" article at JavaWorld -mh\r
-  public synchronized static DatabaseVideo getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseVideo();\r
-      instance.myselfDatabase = instance;\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseVideo() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Video");\r
-\r
-    hasTimestamp = true;\r
-    theTable = "video";\r
-    theCoreTable = "media";\r
-    theEntityClass = mircoders.entity.EntityVideo.class;\r
-  }\r
-\r
-  public SimpleList getPopupData() throws StorageObjectFailure {\r
-    return getPopupData("title", true);\r
-  }\r
-\r
-  public void update(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-\r
-    super.update(theEntity);\r
-  }\r
-\r
-  public String insert(Entity theEntity) throws StorageObjectFailure {\r
-    String date = theEntity.getValue("date");\r
-    if (date == null) {\r
-      date = StringUtil.date2webdbDate(new GregorianCalendar());\r
-      theEntity.setValueForProperty("date", date);\r
-    }\r
-    return super.insert(theEntity);\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+import java.util.GregorianCalendar;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseVideo extends Database implements StorageObject{
+
+  private static DatabaseVideo instance;
+  private static SimpleList publisherPopupData;
+
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo..
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseVideo getInstance() {
+    if (instance == null) {
+      instance = new DatabaseVideo();
+      instance.myselfDatabase = instance;
+    }
+    return instance;
+  }
+
+  private DatabaseVideo() {
+    super();
+
+    logger = new LoggerWrapper("Database.Video");
+
+    hasTimestamp = true;
+    theTable = "video";
+    theCoreTable = "media";
+    theEntityClass = mircoders.entity.EntityVideo.class;
+  }
+
+  public SimpleList getPopupData() throws StorageObjectFailure {
+    return getPopupData("title", true);
+  }
+
+  public void update(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+
+    super.update(theEntity);
+  }
+
+  public String insert(Entity theEntity) throws StorageObjectFailure {
+    String date = theEntity.getValue("date");
+    if (date == null) {
+      date = StringUtil.date2webdbDate(new GregorianCalendar());
+      theEntity.setValueForProperty("date", date);
+    }
+    return super.insert(theEntity);
+  }
+
+}
index 1a5edaa..942a2b2 100755 (executable)
@@ -101,6 +101,7 @@ public class BundleTool {
 \r
     result = new PropertiesManipulator();\r
 \r
+    // skip past the header in the slave bundle\r
     Iterator i = slave.getEntries();\r
     while (i.hasNext()) {\r
       Object e = i.next();\r
@@ -130,6 +131,11 @@ public class BundleTool {
       else if (e instanceof PropertiesManipulator.Entry) {\r
         String key = ( (PropertiesManipulator.Entry) e).getKey();\r
         String value = slave.get(key);\r
+\r
+        if (value==null || value.length()==0) {\r
+          result.addComment("# missing (master value = \"" +master.get(key)+"\")");\r
+        }\r
+\r
         result.addEntry(key, value);\r
       }\r
 \r
@@ -164,11 +170,18 @@ public class BundleTool {
 \r
     try {\r
       bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding);\r
+    }\r
+    catch (Throwable t) {\r
+      Throwable s = ExceptionFunctions.traceCauseException(t);\r
 \r
+      System.out.println("Unable to read sourcefile: " + s.toString());\r
+      return;\r
+    }\r
+    try {\r
       PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle));\r
     }\r
     catch (Throwable t) {\r
-      System.out.println("Unable to read master properties: " + t.getMessage());\r
+      System.out.println("Unable to write bundle: " + t.toString());\r
       return;\r
     }\r
   }\r
diff --git a/templates/admin/FUNCTIONS.template b/templates/admin/FUNCTIONS.template
new file mode 100755 (executable)
index 0000000..296f540
--- /dev/null
@@ -0,0 +1,231 @@
+<comment>creates a full table incl. edit/delete entry.id</comment>
+<function ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>
+
+<table cellspacing="2" border="0">
+       
+       <tr>
+               <list column_head_texts as indexVariable>
+                       <td class="${column_head_CSS}">
+                               <b>${indexVariable}</b> 
+                       </td>
+               </list>
+                       <td class="${column_head_CSS}">
+                               &nbsp;
+                       </td>   
+       </tr>
+
+       
+<list contentlist as entry>
+       <if grey=="1">
+               <assign grey="0">
+               <tr class="${listrow1CSS}">
+       <else>
+               <assign grey="1"> 
+               <tr class="${listrow2CSS}">
+       </if>
+               
+       <list data_keys as indexVariable>               
+                       <td>
+                               ${entry[indexVariable]}
+                       </td>
+       </list>
+               <td>
+                       <a class="listcommand" href="${config.actionRoot}?module=${module_name}&do=delete&id=${entry.id}">${lang("delete")}</a>
+                       | <a class="listcommand" href="${config.actionRoot}?module=${module_name}&do=edit&id=${entry.id}">${lang("edit")}</a>
+               </td>
+       </tr>
+</list>
+       
+       
+       <tr>            
+               <td colspan="${column_nr}" class="table_foot">
+                       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
+               </td>
+       </tr>
+
+</table>
+</function>
+
+<comment>creates browse links, only called if necessary</comment>
+<function PrevNextPage(module_name)>
+       <p>
+      <if (data.prev || data.next)>
+        <form method="post" action="${config.actionRoot}">
+          <input type="hidden" name="module" value="${module_name}">
+          <input type="hidden" name="where" value="${data.where}">
+          <if data.prev>
+            <input type="hidden" name="do" value="list">
+            <input type="hidden" name="prevoffset" value="${data.prev}">
+            <input type="submit" name="prev" value="${lang("list.previous")}">
+          </if>
+          <if data.next>
+            <input type="hidden" name="do" value="list">
+            <input type="hidden" name="nextoffset" value="${data.next}">
+            <input type="submit" name="next" value="${lang("list.next")}">
+          </if>
+        </form>
+      </if>
+       </p>
+</function>
+
+<comment>extra navigation</comment>
+<function AddOrBack(module_name, module_jumpback, do_jumpback)>
+    <p>
+      <a class="link_box" href="${config.actionRoot}?module=${module_name}&do=add">[+] ${lang("add")}</a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}?module=${module_jumpback}&do=${do_jumpback}">[&lt;] ${lang("back")} </a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+</function>
+
+
+
+<comment>4 functions to create Table rows with input-fields</comment>
+<function TextInputTableRow (label, size, maxlength, fieldname, fieldcontent)>
+       <tr>
+               <td align="right" class="table_left">
+                       <b>${label}:</b>
+               </td>
+               
+               <td class="listrow2">
+                       <input type="text" size="${size}" maxlength="${maxlength}" name="${fieldname}" value="${fieldcontent}">
+               </td>
+       </tr>
+</function>
+
+<function TextInputTableRowLight (label, size, maxlength, fieldname, fieldcontent)>
+       <tr>
+               <td align="right" class="table_left_light">
+                       <b>${label}:</b>
+               </td>
+               
+               <td class="listrow1">
+                       <input type="text" size="${size}" maxlength="${maxlength}" name="${fieldname}" value="${fieldcontent}">
+               </td>
+       </tr>
+</function>
+
+
+
+<function TextAreaTableRow (label, cols, rows, fieldname, fieldcontent )>
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       <b>${label}:</b>
+               </td>
+               
+               <td class="listrow2">
+                       <textarea cols="${cols}" rows="${rows}" name="${fieldname}">${fieldcontent}</textarea>
+               </td>
+       </tr>
+</function>
+
+<function TextAreaTableRowLight (label, cols, rows, fieldname, fieldcontent )>
+       <tr>
+               <td align="right" valign="top" class="table_left_light">
+                       <b>${label}:</b>
+               </td>
+               
+               <td class="listrow1">
+                       <textarea cols="${cols}" rows="${rows}" name="${fieldname}">${fieldcontent}</textarea>
+               </td>
+       </tr>
+</function>
+
+<comment>complete search-form for contenentries, not sure if it works from everywhere</comment>
+<function ContentSearch (layout)>
+
+      <form method="POST" action="${config.actionRoot}">
+        <input type="hidden" name="module" value="Content">
+        <input type="hidden" name="do" value="search">
+        <input type="hidden" name="selectarticleurl" value="${utility.encodeHTML(selectarticleurl)}">
+         
+        <table border="0" cellpadding="2" cellspacing="3">
+          <tr <if !layout>class="bg_neutral"</if>>
+            <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> ${lang("contentsearch.value")}</td>
+            <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> ${lang("contentsearch.field")}</td>
+            <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> ${lang("contentsearch.publishedstate")}</td>
+            <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> ${lang("contentsearch.articletype")}</td>
+            <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> ${lang("contentsearch.order")}</td>
+                       <td <if layout>class="table_head"<else>class="small bg_neutral"</if> valign="bottom"> &nbsp;</td>
+          </tr>
+          <tr>
+            <td <if layout>class="listrow2"</if>><input type="text" size="10" maxlength="20" name="searchvalue" value="${searchvalue}"></td>
+            <td <if layout>class="listrow2"</if>>
+                     <select name="searchfield">
+                  <option value="title"<if searchfield=="title"> selected</if>>${lang("contentsearch.field.title")}</option>
+                  <option value="creator"<if searchfield=="creator"> selected</if>>${lang("contentsearch.field.creator")}</option>
+                  <option value="contents"<if searchfield=="content"> selected</if>>${lang("contentsearch.field.contents")}</option>
+                </select>
+            </td>
+            <td <if layout>class="listrow2"</if>>
+                <select name="searchispublished">
+                  <option value="">--</option>
+                  <option value="0" <if searchispublished=="0"> selected</if>>${lang("contentsearch.publishedstate.hidden")}</option>
+                  <option value="1" <if searchispublished=="1"> selected</if>>${lang("contentsearch.publishedstate.published")}</option>
+                </select>
+            </td>
+            <td <if layout>class="listrow2"</if>>
+                <select name="searcharticletype">
+                  <option value="">--</option>
+                  <list articletypes as at>
+                    <option value="${at.id}" <if searcharticletype==at.id> selected</if>>${lang("articletypes."+at.name)}</option>
+                  </list>
+                </select>
+            </td>
+            <td <if layout>class="listrow2"</if>>
+                <select name="searchorder">
+                  <option value="datedesc" <if searchorder=="datedesc"> selected</if>>${lang("contentsearch.order.datedesc")}</option>
+                  <option value="dateasc" <if searchorder=="dateasc"> selected</if>>${lang("contentsearch.order.dateasc")}</option>
+                  <option value="title" <if searchorder=="title"> selected</if>>${lang("contentsearch.order.title")}</option>
+                  <option value="creator" <if searchorder=="creator"> selected</if>>${lang("contentsearch.order.creator")}</option>
+                </select>
+            </td>
+            <td <if layout>class="listrow2"</if>>
+                <input class="majorbutton" type="submit" name="search" value="${lang("contentsearch.searchbutton")}">
+            </td>
+          </tr>
+        </table>
+      </form>
+
+</function>
+
+<comment>browse function, only called if necessary</comment>
+<function PrevNext (align)>
+       <if prevurl || nexturl>      
+               <p align="${align}">
+               <if prevurl>
+                       <a class="link_box" href="${config.actionRoot}?${prevurl}"> [ &lt; ] ${lang("list.previous")}</a>&nbsp;&nbsp; 
+               </if>
+               <if nexturl>
+                       <a  class="link_box" href="${config.actionRoot}?${nexturl}">   ${lang("list.next")} [ &gt; ]</a>
+               </if>
+               </p>
+       </if>
+</function>
+
+<comment>multifunctional help - popup or not - big or small designs</comment>
+<function Help (HelpUrl, popup, big )>
+       <if popup>
+               
+               <Script Language="JavaScript">
+                       <!-- 
+                       function openwindowlink() {
+                       newwin = window.open("${HelpUrl}","windowname","height=320,width=320,top=200,left=300, scrollbars,resizable")
+                       }
+                       // end hiding -->
+               </Script>
+               
+               <a href="JavaScript: openwindowlink()">
+                       <if big><span class="link_help"><else><span class="link_help_small"></if>
+                               <if big> [ ? ] ${lang("help")}<else>[?]</if>
+                       </span>
+               </a>            
+       
+       <else>
+               
+               <if big>
+                       <a href="${HelpUrl}" target="_blank"><span class="link_help"> [ ? ] ${lang("help")}</span></a>
+               <else>
+                       <a href="${HelpUrl}" target="_blank"><span class="link_help_small">[?]</span></a>               
+               </if>
+       </if>
+</function>
diff --git a/templates/admin/FUNCTIONS_media.template b/templates/admin/FUNCTIONS_media.template
new file mode 100755 (executable)
index 0000000..ccd0924
--- /dev/null
@@ -0,0 +1,143 @@
+<comment>
+       the complete medialist-template in two functions
+       not used for image-list because imagelist uses other display method
+</comment>
+
+<function MediaSearch (module)>
+
+<form method="post" action="${config.actionRoot}">
+
+<input type="hidden" name="module" value="${module}">
+<input type="hidden" name="do" value="list">
+<input type="hidden" name="cid" value="${data.cid}">
+
+<table border="0" cellspacing="2" cellpadding="2">
+       <tr>
+               <td class="table_head">${lang("search")}:</td>
+               <td class="table_head">${lang("medialist.search_text_in")}:</td>
+               <td class="table_head">${lang("media.published")}:</td>
+               <td class="table_head">${lang("media.mediafolder")}:</td>
+               <td class="table_head">&nbsp;</td>
+               <td><a class="link_box" href="${config.actionRoot}?module=${module}&do=add">[+] ${lang("add")} </a></td>
+       </tr>
+
+       <tr>
+               <td class="listrow2">
+                       <input type="text" size="20" maxlength="30" name="query_text" value="${data.query_text}">
+               </td>   
+               <td class="listrow2">
+                       <select name="query_field">
+                               <option value="title"<if data.query_field=="title"> selected</if>>${lang("media.title")}</option>
+                               <option value="creator"<if data.query_field=="creator"> selected</if>>${lang("media.creator")}</option>
+                               <option value="place"<if data.query_field=="place"> selected</if>>${lang("media.location")}</option>
+                               <option value="keywords"<if data.query_field=="keywords"> selected</if>>${lang("media.keywords")}</option>
+                       </select>
+               </td>
+               
+               <td class="listrow2">
+                       <select name="query_is_published">
+                               <option value="">${lang("dontcare")}</option>
+                               <option value="0" <if data.query_is_published=="0"> selected</if>>${lang("no")}</option>
+                               <option value="1" <if data.query_is_published=="1"> selected</if>>${lang("yes")}</option>
+                       </select>
+               </td>
+               
+               <td class="listrow2">
+               <select name="query_media_folder">
+               <list extra.mediafolderPopupData as m>
+               <option value="${m.key}" <if m.key == data.query_media_folder>selected</if>>${m.value}</option>
+               </list>
+               </select>
+               </td>
+               
+               <td class="listrow2">
+                       <input type="submit" name="search" value="${lang("filter")}">
+               </td>
+               
+               <td>
+               &nbsp;
+               </td>
+       </tr>
+</table>
+
+</form>
+
+</function>
+
+<function MediaList (module)>
+
+<table>
+
+  <tr class="darkgrey" >
+       <td class="table_head">
+       <b>${lang("media.icon")}</b></td>
+       <td class="table_head">
+       <b>${lang("media.title")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.format")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.size")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.mediafolder")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.creator")}</b></td>
+    <td class="table_head">
+       &nbsp;</td>
+
+  </tr>
+       <if data.contentlist>
+       <list data.contentlist as entry>
+       <tr <if grey=="1"><assign grey="0">class="listrow1"<else>class="listrow2"<assign grey="1"> </if>>
+               <td>
+                       <a href="${config.actionRoot}?module=${module}&do=getMedia&id=${entry.id}">
+                       <img src="${config.docRoot}/img/${entry.big_icon}" border=0></a>
+               </td>
+               <td>
+                       ${entry.title}&nbsp;
+                       <if entry.description><br>${entry.description}</if>
+               </td>
+               <td>
+                       ${entry.media_descr}&nbsp;
+               </td>
+               <td>
+                       ${entry.human_readable_size}&nbsp;
+               </td>
+               <td>
+                       ${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;
+               </td>
+               <td>
+                       ${entry.creator}&nbsp;
+               </td>
+               <td>&nbsp;
+                       <if data.cid>
+                               <a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
+                       <else>
+                               <a href="${config.actionRoot}?module=${module}&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
+                       | <a href="${config.actionRoot}?module=${module}&do=edit&id=${entry.id}">${lang("edit")}</a>
+                       </if>
+               </td>
+       </tr>
+       </list>
+       <tr>
+               <td colspan="7" class="table_foot">
+                       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
+               </td>
+       </tr>
+
+       <tr>
+               <td>
+                       <if data.prev>
+                               <a href="${config.actionRoot}?module=${module}&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">${lang("list.previous")}</a>&nbsp;
+                       </if>
+                       <if data.next>
+                               <a href="${config.actionRoot}?module=${module}&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">${lang("list.next")}</a>
+                       </if>
+               </td>
+       </tr>
+
+<else>
+  <tr><td align="center" class="box" colspan="7">${lang("no_matches_found")}</td></tr>
+</if>
+</table>
+
+</function>
index 23b00ac..b8410ad 100755 (executable)
@@ -5,7 +5,7 @@
         <if anId>
           <input type="hidden" name="id" value="${anId}">
         </if>
-        <if grey=="1"><assign grey="0"><tr class="list1"><else><tr class="list2"><assign grey="1"> </if>
+        <if grey=="1"><assign grey="0"><tr class="listrow1"><else><tr class="listrow2"><assign grey="1"> </if>
           <td>
             <select name="type">
               <list filtertypes as t>
           <td><input type="text" name="expression" size="30" value="${utility.encodeHTML(anExpression)}"></td>
           <if anId>
             <td>
-              <input class="majorbutton" type="submit" name="save" value="${lang("save")}">
+              <input type="submit" name="save" value="${lang("save")}">
             </td>
             <td>
-                <a href="${config.actionRoot}?module=Abuse&do=deletefilter&id=${anId}">${lang("delete")}</a>
+                <a class="listcommand" href="${config.actionRoot}?module=Abuse&do=deletefilter&id=${anId}">[${lang("delete")}]</a>
                 &nbsp;
             </td>
           <else>
         </tr>
       </form>
 </function>
+
+
 <html>
-  <head>
-    <title>${config["Mir.Name"]} | ${lang("userlist.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  </head>
+<head>
+       <title>${config["Mir.Name"]} | ${lang("userlist.htmltitle")}</title>
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+</head>
+
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+<include "head.template">
+<p>
+       <a class="link_box" href="${config.actionRoot}?module=Abuse">[ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
+       <a class="link_box" href="${config.actionRoot}?module=Abuse&do=showlog">${lang("abuse.showlog")}</a>
+       <br><br>
+</p>
+<table border="0" cellpadding="2" cellspacing="1">
+       <tr>
+               <td class="table_head"><b>${lang("abuse.filter.type")}</b></td>
+               <td class="table_head"><b>${lang("abuse.filter.expression")}</b></td>
+               <td class="table_head"><b>&nbsp;</b></td>
+               <td class="table_head"><b>&nbsp;</b></td>
+       </tr>
 
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-    <include "head.template">
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse">${lang("back")}</a>
-    </p>
-    <table border="0" cellpadding="2" cellspacing="1">
-      <tr class="darkgrey">
-        <td><span class="witesmall"><b>${lang("abuse.filter.type")}</b></span></td>
-        <td><span class="witesmall"><b>${lang("abuse.filter.expression")}</b></span></td>
-        <td><span class="witesmall"><b>&nbsp;</b></span></td>
-      </tr>
-      
-      <assign grey="0">      
-      <list filters as i>
-        <call showFilterEntry(i.type, i.expression, i.id)>
-      </list>
-      
-      <call showFilterEntry("", "", "")>
-    </table>
+       <assign grey="0">      
+       <list filters as i>
+               <call showFilterEntry(i.type, i.expression, i.id)>
+       </list>
 
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse">${lang("back")}</a>
-    </p>
+       <call showFilterEntry("", "", "")>
+       </table>
 
+       
+<p>
+       <a class="link_box" href="${config.actionRoot}?module=Abuse">[ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
+       <a class="link_box" href="${config.actionRoot}?module=Abuse&do=showlog">${lang("abuse.showlog")}</a>
+</p>
     <include "foot.template">
   </body>
 </html>
index cfe1ecd..73d1507 100755 (executable)
@@ -6,21 +6,23 @@
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
     <include "head.template">
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse">${lang("back")}</a>
-    </p>
-
-    <table border="0" cellpadding="2" cellspacing="1">
+    
+       <p>
+               <a class="link_box" href="${config.actionRoot}?module=Abuse"> [ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
+               <a class="link_box" href="${config.actionRoot}?module=Abuse&do=showfilters">${lang("abuse.showfilters")}</a>
+               <br>
+       </p>
+    <table border="0" cellpadding="2" cellspacing="3">
       <tr class="darkgrey">
-        <td><span class="witesmall"><b>${lang("abuse.log.time")}</b></span></td>
-        <td><span class="witesmall"><b>${lang("abuse.log.address")}</b></span></td>
-        <td><span class="witesmall"><b>${lang("abuse.log.object")}</b></span></td>
-        <td><span class="witesmall"><b>${lang("abuse.log.browser")}</b></span></td>
+        <td class="table_head">${lang("abuse.log.time")}</td>
+        <td class="table_head">${lang("abuse.log.address")}</td>
+        <td class="table_head">${lang("abuse.log.object")}</td>
+        <td class="table_head">${lang("abuse.log.browser")}</td>
       </tr>
       
       <assign grey="0">      
       <list log as l>
-        <if grey=="1"><assign grey="0"><tr class="list1"><else><tr class="list2"><assign grey="1"> </if>
+        <if grey=="1"><assign grey="0"><tr class="listrow1"><else><tr class="listrow2"><assign grey="1"> </if>
           <td>${l.timestamp["yyyy-MM-dd  HH:mm"]}</td>
           <td>${l.ip}</td>
           <td>
           <td>${l.browser}</td>
         </tr>
       </list>
+         <tr>
+               <td colspan="4" class="table_foot">&nbsp;</td>
+         </tr>
     </table>
 
     <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse">${lang("back")}</a>
+      <a class="link_box" href="${config.actionRoot}?module=Abuse"> [ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
+         <a class="link_box" href="${config.actionRoot}?module=Abuse&do=showfilters">${lang("abuse.showfilters")}</a>
     </p>
 
     <include "foot.template">
index 3429669..0c82b95 100755 (executable)
 <html>
-  <head>
-    <title>${config["Mir.Name"]} | ${lang("userlist.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  </head>
+<head>
+       <title>${config["Mir.Name"]} | ${lang("abuse.htmltitle")}</title>
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+</head>
 
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-    <include "head.template">
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse&do=showlog">${lang("abuse.showlog")}</a>
-    </p>
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse&do=showfilters">${lang("abuse.showfilters")}</a>
-    </p>
-    <p>
-      <form method="post" action="${config.actionRoot}">
-        <input type="hidden" name="module" value="Abuse">
-        <input type="hidden" name="do" value="savesettings">
-        
-        <table border="0" cellpadding="2" cellspacing="1">
-          <tr class="darkgrey">
-            <td><span class="witesmall"><b>${lang("abuse.setting")}</b></span></td>
-            <td><span class="witesmall"><b>${lang("abuse.value")}</b></span></td>
-          </tr>
-          <tr class="list1">
-            <td>
-              ${lang("abuse.disableopenpostings")}
-            </td>
-            <td>
-              <input type="checkbox" name="disableop" value="1" <if disableop=="1">checked="1"</if>>
-            </td>
-          </tr>
-          <tr class="list1">
-            <td>
-              ${lang("abuse.openpostingpassword")}
-            </td>
-            <td>
-              <input type="checkbox" name="passwordop" value="1" <if passwordop=="1">checked="1"</if>>
-            </td>
-          </tr>
-          <tr class="list2">
-            <td>
-              ${lang("abuse.logpostings")}
-            </td>
-            <td>
-              <input type="checkbox" name="logenabled" value="1" <if logenabled=="1">checked="1"</if>>
-            </td>
-          </tr>
-          <tr class="list2">
-            <td>
-              ${lang("abuse.logsize")}'
-            </td>
-            <td>
-              <input type="text" size="10" name="logsize" value="${logsize}">
-            </td>
-          </tr>
-          <tr class="list1">
-            <td>
-              ${lang("abuse.cookies")}
-            </td>
-            <td>
-              <input type="checkbox" name="usecookies" value="1" <if usecookies=="1">checked="1"</if>>
-            </td>
-          </tr>
-          <tr class="list1">
-            <td>
-              ${lang("abuse.articleaction")}
-            </td>
-            <td>
-              <select name="articleaction">
-                <list articleactions as a>
-                  <option value="${a.identifier}" <if articleaction==a.identifier>selected="1"</if>>${utility.encodeHTML(lang(a.resource))}</option>
-                </list>
-              </select>
-            </td>
-          </tr>
-          <tr class="list1">
-            <td>
-              ${lang("abuse.commentaction")}
-            </td>
-            <td>
-              <select name="commentaction">
-                <list commentactions as a>
-                  <option value="${a.identifier}" <if commentaction==a.identifier>selected="1"</if>>${utility.encodeHTML(lang(a.resource))}</option>
-                </list>
-              </select>
-            </td>
-          </tr>
-        </table>
-        <p>
-          <input class="majorbutton" type="submit" name="submit" value="${lang("save")}">
-      </form>
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
-      <a class="majorcommand" href="${config.actionRoot}?module=Abuse&do=showfilters">${lang("abuse.showfilters")}</a>
-    </p>
+<include "FUNCTIONS.template">
+<include "head.template">
+<p>
+       <a class="link_box"  href="${config.actionRoot}?module=Admin&do=superusermenu">[ &lt; ] ${lang("back")}</a>
+</p>
 
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+<table cellspacing="15">
+<tr>
+<td valign="top">
 
-    <include "foot.template">
-  </body>
+<form method="post" action="${config.actionRoot}">
+       <input type="hidden" name="module" value="Abuse">
+       <input type="hidden" name="do" value="savesettings">
+
+       <table border="0" cellpadding="2" cellspacing="3">
+               <tr>
+                       <td class="table_head"><b>${lang("abuse.setting")}</b></td>
+                       <td class="table_head"><b>${lang("abuse.value")}</b></td>
+               </tr>
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.disableopenpostings")}
+                       </td>
+                       <td class="listrow2">
+                               <input type="checkbox" name="disableop" value="1" <if disableop=="1">checked="1"</if>>
+                       </td>
+               </tr>
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.openpostingpassword")}
+                       </td>
+                       <td class="listrow2">
+                               <input type="checkbox" name="passwordop" value="1" <if passwordop=="1">checked="1"</if>>
+                       </td>
+               </tr>
+               
+               <tr class="x-small"><td colspan="2">&nbsp;</td></tr>
+               
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.logpostings")}
+                       </td>
+                       <td class="listrow2">
+                               <input type="checkbox" name="logenabled" value="1" <if logenabled=="1">checked="1"</if>>
+                       </td>
+               </tr>
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.logsize")}
+                       </td>
+                       <td class="listrow2">
+                               <input type="text" size="10" name="logsize" value="${logsize}">
+                       </td>
+               </tr>
+               
+               <tr class="x-small"><td colspan="2">&nbsp;</td></tr>            
+               
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.cookies")}
+                       </td>
+                       <td class="listrow2">
+                               <input type="checkbox" name="usecookies" value="1" <if usecookies=="1">checked="1"</if>>
+                       </td>
+               </tr>
+               
+               <tr class="x-small"><td colspan="2">&nbsp;</td></tr>            
+               
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.articleaction")}
+                       </td>
+                       <td class="listrow2">
+                       <select name="articleaction">
+                               <list articleactions as a>
+                               <option value="${a.identifier}" <if articleaction==a.identifier>selected="1"</if>>${utility.encodeHTML(lang(a.resource))}</option>
+                               </list>
+                       </select>
+                       </td>
+               </tr>
+               <tr>
+                       <td class="table_left">
+                               ${lang("abuse.commentaction")}
+                       </td>
+                       <td class="listrow2">
+                       <select name="commentaction">
+                               <list commentactions as a>
+                               <option value="${a.identifier}" <if commentaction==a.identifier>selected="1"</if>>${utility.encodeHTML(lang(a.resource))}</option>
+                               </list>
+                       </select>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2" class="table_foot">
+                               <input class="majorbutton" type="submit" name="submit" value="${lang("save")}">
+                       </td>
+               </tr>
+       </table>
+</form>
+
+</td>
+<td valign="top">
+
+<p class="box">
+       &gt; <a href="${config.actionRoot}?module=Abuse&do=showlog">${lang("abuse.showlog")}</a><br>
+       &gt; <a href="${config.actionRoot}?module=Abuse&do=showfilters">${lang("abuse.showfilters")}</a>
+</p>
+
+</td>
+</tr>
+</table>
+
+
+
+<p>
+       <a class="link_box"  href="${config.actionRoot}?module=Admin&do=superusermenu">[ &lt; ] ${lang("back")}</a>
+</p>
+
+       <include "foot.template">
+</body>
 </html>
 
 
index 62af13e..cc7efa4 100755 (executable)
@@ -2,50 +2,48 @@
   <head>
     <title>${config["Mir.Name"]} | ${lang("articletype.htmltitle")}</title>
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  <head>
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-  
-    <include "head.template">
-    <form action="${config.actionRoot}" method="post">
+<head>
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+<include "FUNCTIONS.template">  
+<include "head.template">
+<form action="${config.actionRoot}" method="post">
 
-       <input type="hidden" name="module" value="ArticleType">
-       <input type="hidden" name="id" value="${data.id}">
-       <if data.new>
-         <input type="hidden" name="do" value="insert">
-       <else>
-         <input type="hidden" name="do" value="update">
-       </if>
+       <input type="hidden" name="module" value="ArticleType">
+       <input type="hidden" name="id" value="${data.id}">
+       <if data.new>
+               <input type="hidden" name="do" value="insert">
+       <else>
+               <input type="hidden" name="do" value="update">
+       </if>
     
-      <table border="0">
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-               <B>${lang("articletype.id")}:</B></span></td>
-          <td>
-            ${data.id}
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-               <B>${lang("articletype.name")}:</B></span></td>
-          <td>
-            <input type="text" size="40" name="name" value="${data.name}">
-          </td>
-        </tr>
-        <tr>
-          <td colspan="2" align="right">
-            <span class="witetext">
-              <if data.new>
-                <input type="submit" name="save" value="${lang("insert")}">
-              <else>
-                <input type="submit" name="save" value="${lang("save")}">
-              </if> 
-            </span>
-          </td>
-        </tr>
-      </table>
+       <table border="0">
+               <tr>
+                       <td align="right" class="table_left">
+                               <B>${lang("articletype.id")}: </B>
+                       </td>
+                       <td class="listrow2">
+                               ${data.id}
+                       </td>
+               </tr>
+
+               <call TextInputTableRow (lang("articletype.name"), 40, 255, "name", data.name)>
+
+
+               <tr>
+                       <td colspan="2" align="right" class="table_foot">
+                               <if data.new>
+                                       <input type="submit" name="save" value="${lang("insert")}">
+                               <else>
+                                       <input type="submit" name="save" value="${lang("save")}">
+                               </if> 
+                       </td>
+               </tr>
+       </table>
+
+</form>
 
-    </form>
+<p><a class="link_box" href="${config.actionRoot}?module=ArticleType&do=list">[&lt;] ${lang("back")} </a> &nbsp;</p>
 
-    <include "foot.template">
-  </body>
+<include "foot.template">
+</body>
 </html>
index a07d8b1..7355611 100755 (executable)
@@ -4,83 +4,32 @@
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
   </head>
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+    
+               <include "FUNCTIONS.template">
 
-    <include "head.template">
-
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=ArticleType&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+               <assign contentlist = data.contentlist>
+               <assign column_nr = 3>
+               <assign data_keys = ["id","name"]>
+               <assign column_head_texts = [lang("articletype.id"), lang("articletype.name")]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "ArticleType">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "superusermenu">
+       
+       <include "templates/admin/head.template">
+       
+       <call AddOrBack(module_name, module_jumpback, do_jumpback)>
 
     <if data.contentlist>
-      <table border="0">
-        <tr class="darkgrey">
-          <td>
-            <span class="witesmall">
-              <b>${lang("articletype.id")}</b>
-            </span>
-          </td>
-          <td>
-            <span class="witesmall">
-                   <b>${lang("articletype.name")}</b>
-                 </span>
-               </td>
-          <td>
-            &nbsp;
-          </td>
-        </tr>
-        <list data.contentlist as entry>
-          <if grey=="1">
-            <assign grey="0">
-            <tr class="list1">
-          <else>
-            <assign grey="1"> 
-            <tr class="list2">
-          </if>
-            <td><span class="small">${entry.id}&nbsp;</span></td>
-            <td><span class="small">${entry.name}&nbsp;</span></td>
-            <td>
-              <span class="text">&nbsp;
-                  <a href="${config.actionRoot}?module=ArticleType&do=delete&id=${entry.id}">${lang("delete")}</a>
-                | <a href="${config.actionRoot}?module=ArticleType&do=edit&id=${entry.id}">${lang("edit")}</a>
-              </span>
-            </td>
-          </tr>
-        </list>
-        <tr>
-          <td colspan="2" class="darkgrey">
-            <span class="witesmall">
-              ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
-                 </span>
-               </td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>
-      <p>
-      <if (data.prev || data.next)>
-        <form method="post" action="${config.actionRoot}">
-          <input type="hidden" name="module" value="ArticleType">
-          <input type="hidden" name="where" value="${data.where}">
-          <if data.prev>
-            <input type="hidden" name="do" value="list">
-            <input type="hidden" name="prevoffset" value="${data.prev}">
-            <input type="submit" name="prev" value="${lang("list.previous")}">
-          </if>
-          <if data.next>
-            <input type="hidden" name="do" value="list">
-            <input type="hidden" name="nextoffset" value="${data.next}">
-            <input type="submit" name="next" value="${lang("list.next")}">
-          </if>
-        </form>
-      </if>
-    <else>
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>
+               <call AddOrBack(module_name, module_jumpback, do_jumpback)>
+       <else>
       <P align="center">${lang("no_matches_found")}</p>
     </if>
     
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=ArticleType&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
 
     <include "foot.template">
   </body>
index 5e43100..215a51a 100755 (executable)
@@ -11,31 +11,32 @@ function openWin(url) {
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+<include "FUNCTIONS.template">
 <include "head.template">
 
 <if data.new>
 <form action="${config.actionRoot}?module=Audio&do=add" method="post">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
        <table border="0">
-       <tr>
-       <td align="right" class="darkgrey">
-       <span class="witesmall">
-       <b>${lang("media.nr_of_media")}</b> <br>
-       </span>
-       </td>
-       <td>
-       <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
-       </td>
-       </tr>
+               <tr>
+                       <td align="right" class="table_left">
+                               <b>${lang("media.nr_of_media")} :</b><br>
+                       </td>
+                       <td class="listrow2">
+                               <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+                       </td>
+               </tr>
        </table>
 </form>
 </if>
+
+
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Audio&do=<if data.new>insert<else>update</if>&id=${data.id}">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">
@@ -45,121 +46,98 @@ function openWin(url) {
 
        <if !data.new>
        <tr>
-    <td align="right" class="darkgrey">
-               <span class="witesmall">
+       <td align="right" valign="top">
                        <a href="${config.actionRoot}?module=Audio&do=getMedia&id=${data.id}">
-                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
-    <td valign="bottom"><span class="spezialtext">
-               ${lang("media.created")}: ${data.webdb_create}
-        <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
-               <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
-               ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
-               ${lang("media.size")}: ${data.human_readable_size}<br>
-               ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
-       </td>
+                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a>&nbsp;&nbsp;
+               </td>
+               <td valign="bottom" class="small">
+                       ${lang("media.created")}: ${data.webdb_create}
+                       <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
+                       <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
+                       ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
+                       ${lang("media.size")}: ${data.human_readable_size}<br>
+                       ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
+               </td>
        </tr>
        </if>
 
        <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.mediafolder")}:</B></span></td>
-    <td>
-               <select name="to_media_folder">
-               <list extra.mediafolderPopupData as m>
-               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
-               </list>
-           </select>
-       </td>
+               <td align="right" class="table_left">
+                       <B>${lang("media.mediafolder")}:</B>
+               </td>
+               <td class="listrow2">
+                       <select name="to_media_folder">
+                       <list extra.mediafolderPopupData as m>
+                               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
+                       </list>
+               </select>
+               </td>
        </tr>
-
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.description")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.date")}:</B></span></td>
-    <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
-               <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.location")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.creator")}:</B></span></td>
-    <td>
-               <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.keywords")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.comment")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.source")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
-       </tr>
-       <tr>
+       
+       <call TextInputTableRow (lang("media.description"), 40, 255, "description", data.description)>
+       <call TextInputTableRow (lang("media.date"), 8, 8, "date", data.date)>
+       <call TextInputTableRowLight (lang("year"), 20, 40, "year", data.year)>
+       <call TextInputTableRow (lang("media.location"), 40, 80, "place", data.place)>
+       <call TextInputTableRow (lang("media.creator"), 40, 80, "creator", data.creator)>
+       <call TextAreaTableRow (lang("media.keywords"), 40, 2, "keywords", data.keywords)>
+       <call TextAreaTableRow (lang("media.comment"), 40, 2, "comment", data.comment)>
+       <call TextInputTableRow (lang("media.source"), 40, 80, "source", data.source)>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
+       
        <if data.new>
        <tr>
-       <td>
-               ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-       </td>
+               <td align="right" class="table_left">
+                       ${lang("media.is_published")} : 
+               </td>
+               <td class="listrow2" style='border: 1px solid #FF0000;'>
+                       <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>> 
+               </td>
        </tr>
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
        <list data.mediafields as m>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
-
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
-               </font> </td>
-               <td>
+                </td>
+               <td class="listrow2">
                        <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
                </td>
-               </tr>
-               <tr>
-               <td align="right" class="darkgrey"></td>
-               <td>
-                               <INPUT TYPE="file" NAME="mpfile${m}"><br>
+       </tr>
+       <tr>
+               <td align="right">
+                       &nbsp;
                </td>
-               </tr>
+               <td class="listrow2">
+                       <INPUT TYPE="file" NAME="mpfile${m}"><br>
+               </td>
+       </tr>
        </list>
        <else>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
                </td>
-               <td>
+               <td class="listrow2">
                        <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
                </td>
-               </tr>
+       </tr>
        </if>
 
-    <td colspan="2" align="right"> <span class="text">
+    <td colspan="2" align="right" class="table_foot">
        <if data.new>
       <input type="submit" name="save" value="${lang("insert")}">
     <else>
      ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
+    &nbsp;&nbsp;<input type="submit" name="save" value="${lang("save")}">
+    </if> </form>
     </td>
 </table>
+
+<p><a class="link_box" href="${config.actionRoot}?module=Audio&do=list">[&lt;] ${lang("list")} </a> &nbsp;</p>
+
 <include "foot.template">
 </body>
 </html>
index c01f401..0a67543 100755 (executable)
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+<include "FUNCTIONS_media.template">
+<call MediaSearch ("Audio")>
+<p>&nbsp;</p>
+<call MediaList   ("Audio")>
 
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr>
-    <td colspan="5"><form method="post" action="${config.actionRoot}">
-       <input type="hidden" name="module" value="Audio">
-       <input type="hidden" name="do" value="list">
-       <input type="hidden" name="cid" value="${data.cid}">
-       <table border="0">
-       <tr class="pink">
-               <td>${lang("medialist.search_text_in")}:</td>
-               <td>${lang("media.published")}:</td>
-               <td>${lang("media.mediafolder")}:</td>
-               <td>&nbsp;</td>
-       </tr>
-
-       <tr>
-       <td>
-               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">
-               <select name="query_field">
-               <option value="title"<if data.query_field=="title"> selected</if>>${lang("media.title")}</option>
-               <option value="creator"<if data.query_field=="creator"> selected</if>>${lang("media.creator")}</option>
-               <option value="place"<if data.query_field=="place"> selected</if>>${lang("media.location")}</option>
-               <option value="keywords"<if data.query_field=="keywords"> selected</if>>${lang("media.keywords")}</option>
-       </select>
-       </td>
-       <td>
-               <select name="query_is_published">
-                   <option value="">${lang("dontcare")}</option>
-               <option value="0" <if data.query_is_published=="0"> selected</if>>${lang("no")}</option>
-                   <option value="1" <if data.query_is_published=="1"> selected</if>>${lang("yes")}</option>
-           </select>
-       </td>
-       <td>
-       <select name="query_media_folder">
-       <list extra.mediafolderPopupData as m>
-       <option value="${m.key}" <if m.key == data.query_media_folder>selected</if>>${m.value}</option>
-       </list>
-       </select>
-       </td>
-       <td>
-               <input type="submit" name="search" value="${lang("filter")}">
-       </td>
-       </tr>
-       </table>
-       </form>
-       </td>
-  </tr>
-
-  <tr class="darkgrey" >
-       <td><span class="witesmall">
-       <b>${lang("media.icon")}</b></span></td>
-       <td><span class="witesmall">
-       <b>${lang("media.title")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.format")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.size")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.mediafolder")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.creator")}</b></span></td>
-  </tr>
-  <if data.contentlist>
-  <list data.contentlist as entry>
-  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
-  <td>
-         <a href="${config.actionRoot}?module=Audio&do=getMedia&id=${entry.id}">
-         <img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
-  <td>${entry.title}&nbsp;
-         <if entry.description><br>${entry.description}</if></td>
-  <td>${entry.media_descr}&nbsp;</td>
-  <td>${entry.human_readable_size}&nbsp;</td>
-  <td>${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;</td>
-  <td>${entry.creator}&nbsp;</td>
-  <td><span class="text">&nbsp;
-       <if data.cid><a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
-       <else>
-       <a href="${config.actionRoot}?module=Audio&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=Audio&do=edit&id=${entry.id}">${lang("edit")}</a>
-       </if>
-       </span></td>
-  </tr>
-  </list>
-  <tr>
-    <td colspan="4" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-      / ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
-  </tr>
-
-<tr><td>
-<if data.prev>
-       <a href="${config.actionRoot}?module=Audio&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">zurueck</a>&nbsp;
-</if>
-<if data.next>
-<a href="${config.actionRoot}?module=Audio&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">weiter</a>
-</if>
-</td></tr>
-<else>
-  <tr><td align="center">${lang("no_matches_found")}</td></tr>
-</if>
-</table>
 <include "foot.template">
 </body>
 </html>
index 8c5e370..cc2b5da 100755 (executable)
@@ -7,36 +7,46 @@
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+<include "FUNCTIONS.template">
+
+
 <form action="${config.actionRoot}" method="post">
        <input type="hidden" name="module" value="Breaking">
        <input type="hidden" name="id" value="${data.id}">
        <if data.new><input type="hidden" name="do" value="insert">
        <else><input type="hidden" name="do" value="update"></if>
 <table border="0">
+  
   <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("breaking.date")}:</B></span></td>
-    <td>
+    <td align="right" class="table_left">
+        <B>${lang("breaking.date")}:</B>
+       </td>
+    <td class="listrow2">
       ${data.webdb_create_formatted}
     </td>
   </tr>
 
+  
+  
   <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("breaking.text")}:</B> ${lang("breaking.textinfo")}</span></td>
-    <td>
-        <textarea cols="50" rows="3" name="text" wrap=virtual>${data.text}</textarea>
+    <td align="right" class="table_left">
+       <B>${lang("breaking.text")}:</B><br> ${lang("breaking.textinfo")}</td>
+    <td class="listrow2">
+        <textarea cols="50" rows="5" name="text" wrap=virtual>${data.text}</textarea>
     </td>
   </tr>
 
   <tr>
-    <td colspan="2" align="right"> <span class="wite"><if data.new>
-      <input type="submit" name="save" value="${lang("insert")}">
-    <else>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
+    <td colspan="2" align="right" class="table_foot">
+               <if data.new>
+                       <input type="submit" name="save" value="${lang("insert")}">
+               <else>
+                       <input type="submit" name="save" value="${lang("save")}">
+               </if> 
     </td>
 </table>
+</form>
+<p><a class="link_box" href="${config.actionRoot}?module=Breaking&do=list">[&lt;] ${lang("back")}</a></p>
 <include "foot.template">
 </body>
 </html>
index 34b75cc..39975cb 100755 (executable)
@@ -6,43 +6,44 @@
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
-<include "head.template">
-<if data.contentlist>
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr class="darkgrey">
-    <td><span class="witesmall"><b>${lang("breaking.date")}</b></span></td>
-    <td><span class="witesmall"><b>${lang("breaking.text")}</b></span></td>
-    <td>&nbsp;</td>
-  </tr>
-
-  <list data.contentlist as entry>
-  <tr
-       <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
-  <td>${entry.webdb_create_formatted}&nbsp;</td>
-  <td>${entry.text}&nbsp;</td>
-  <td><span class="text">&nbsp;<a href="${config.actionRoot}?module=Breaking&do=delete&id=${entry.id}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=Breaking&do=edit&id=${entry.id}">${lang("edit")}</a></span></td>
-  </tr>
-  </list>
-  <tr>
-    <td colspan="3" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-      /  ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
-  </tr>
-</table>
-
-      <P>
-<if data.prev>
-       <a href="${config.actionRoot}?module=Breaking&do=list&where=${data.where}&prevoffset=${data.prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;
-</if>
-<if data.next>
-<a href="${config.actionRoot}?module=Breaking&do=list&where=${data.where}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
-</if>
-
-<else>
-  <P align="center">${lang("no_matches_found")}</p>
-</if>
-<include "foot.template">
+       <include "FUNCTIONS.template">
+  
+    <include "head.template">
+
+               <comment>configure this template here</comment>
+               <assign contentlist =
+                data.contentlist>
+               <assign column_nr = 3>
+               <assign column_head_texts = [lang("breaking.date"), lang("breaking.text")]>
+               <assign data_keys = ["webdb_create_formatted", "text",]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "Breaking">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "">
+
+    <if data.contentlist>
+       
+       <p>
+      <a class="link_box" href="${config.actionRoot}?module=Breaking&do=add">[+] ${lang("add")}</a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+               
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>   
+               <call PrevNextPage(module_name)>          
+   <else>
+               <P align="center" class="box">${lang("no_matches_found")}</p>
+    </if>
+    
+        <p>
+      <a class="link_box" href="${config.actionRoot}?module=Breaking&do=add">[+] ${lang("add")}</a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+
+
+    <include "foot.template">
 </body>
 </html>
 
index 408e365..2673cba 100755 (executable)
@@ -5,7 +5,8 @@
   <head>
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+       
+       <include "FUNCTIONS.template">
     <include "head.template">
       
     <form method="post" action="${config.actionRoot}">
        </if>
     
        <table border="0">      
-       <tr> 
-          <td align="right" class="editfieldname">
+       
+               <tr><td colspan="2" class="table_head">${lang("comment.htmltitle")}</td></tr>
+               
+               
+               <tr> 
+          <td align="right" class="table_left">
             ${lang("comment.date")}
           </td>
-          <td>
+          <td class="listrow2">
             ${utility.encodeHTML(utility.encodeHTML(data.webdb_create))}
           </td>
         </tr>
       
-       <tr>
-          <td align="right" class="editfieldname">
+       
+               <tr>
+          <td align="right" class="table_left">
             ${lang("comment.status")}
           </td>
-          <td>
+          <td class="listrow2">
             <select name="to_comment_status">
               <list extra.comment_status_values as a>
                 <option value="${a.key}" <if (a.key == data.to_comment_status)>selected</if>>${lang("commentstatus."+a.value)}</option>
             </select>
           </td>
         </tr>
-      
-        <tr>
-          <td align="right" class="editfieldname">
-            ${lang("comment.title")}
-          </td>
-      
-          <td>
-            <input type="text" size="40" maxlength="255" name="title" value="${utility.encodeHTML(data.title)}">
-          </td>
-        </tr>
-      
-       <tr>
-          <td align="right" class="editfieldname">
-            ${lang("comment.creator")}
-          </td>
-          <td>
-            <input type="text" size="40" maxlength="80" name="creator" value="${utility.encodeHTML(data.creator)}">
-          </td>
-        </tr>
-      
-       <tr>
-          <td align="right" class="editfieldname">
-            ${lang("comment.url")}
-          </td>
-          <td>
-            <input type="text" size="40" maxlength="255" name="main_url" value="${utility.encodeHTML(data.main_url)}">
-          </td>
-        </tr>
-      
-       <tr>
-          <td align="right" class="editfieldname">
-            ${lang("comment.email")}
-          </td>
-          <td>
-            <input type="text" size="40" maxlength="80" name="email" value="${utility.encodeHTML(data.email)}">
-          </td>
-        </tr>
-      
-        <tr>
-          <td align="right" class="editfieldname">
-            ${lang("comment.phone")}
-          </td>
-          <td>
-            <input type="text" size="40" maxlength="80" name="phone" value="${utility.encodeHTML(data.phone)}">
-          </td>
-        </tr>
-      
-        <tr>
-          <td align="right" class="editfieldname">
-           ${lang("comment.address")}
-         </td>
-          <td>
-            <input type="text" size="40" maxlength="80" name="address" value="${utility.encodeHTML(data.address)}">
-          </td>
-        </tr>
+       
+        
+               <call TextInputTableRow (lang("comment.title"), 40, 255, "title", utility.encodeHTML(data.title))>
+               <call TextInputTableRow (lang("comment.creator"), 40, 80, "creator", utility.encodeHTML(data.creator))>
+               <call TextInputTableRow (lang("comment.url"), 40, 255, "main_url", utility.encodeHTML(data.main_url))>
+               <call TextInputTableRow (lang("comment.email"), 40, 80, "email", utility.encodeHTML(data.email))>
+               <call TextInputTableRow (lang("comment.phone"), 40, 80, "phone", utility.encodeHTML(data.phone))>
+               <call TextInputTableRow (lang("comment.address"), 40, 80, "address", utility.encodeHTML(data.address))>
+               
+       
         <tr>
-          <td align="right" class="editfieldname">
+          <td align="right" class="table_left">
            ${lang("comment.language")}
          </td>
-          <td>
+          <td class="listrow2">
             <select name="to_language">
               <list extra.languages as l>
                 <option value="${l.key}" <if (l.key == data.to_language)>selected</if>>${l.value}</option>
         </tr>
       
         <tr>
-          <td align="right" class="editfieldname" valign="top">
+          <td align="right" class="table_left" valign="top">
             ${lang("comment.text")}<br>
             ${lang("comment.html")}<input type="checkbox" name="is_html" value="1"<if data.is_html=="1"> checked</if>>
           </td>
-          <td>
+          <td class="listrow2">
             <textarea cols="60" rows="10" name="description" wrap="virtual">${utility.encodeHTML(data.description)}</textarea>
           </td>
         </tr>
         <tr>
-          <td colspan="2" align="right"> 
+          <td colspan="2" align="right" class="table_foot" 
             <span class="text">
              ${lang("comment.published")} <input type="checkbox" name="is_published" value="1" <if data.is_published=="1"> checked</if>>
              <if new>
         </tr>
       </table>
     </form>
+       
+        <p>
+      <a class="link_box" href="${config.actionRoot}?module=Comment&do=list">[&lt;] ${lang("list")} </a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+       
     <include "foot.template">
   </body>
 </html>
index 165ab7f..4675103 100755 (executable)
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+
 <assign grey="0">
 
 <form method="post" action="${config.actionRoot}">
-  <input type="hidden" name="module" value="Comment">
-  <input type="hidden" name="do" value="search">
+       <input type="hidden" name="module" value="Comment">
+       <input type="hidden" name="do" value="search">
    
-  <table border="0" cellpadding="2" cellspacing="1">
-    <tr class="pink">
-      <td>${lang("commentsearch.field")}</td>
-      <td>${lang("commentsearch.value")}</td>
-      <td>${lang("commentsearch.publishedstate")}</td>
-      <td>${lang("commentsearch.status")}</td>
-      <td>${lang("commentsearch.order")}</td>
-    </tr>
-    <tr>
-      <td>
-          <input type="text"   size="10" maxlength="20" name="searchtext" value="${searchtext}">
-      </td>
+       <table border="0" cellpadding="2" cellspacing="3">
+       <tr>
+               <td class="table_head">${lang("commentsearch.field")}</td>
+               <td class="table_head">${lang("commentsearch.value")}</td>
+               <td class="table_head">${lang("commentsearch.publishedstate")}</td>
+               <td class="table_head">${lang("commentsearch.status")}</td>
+               <td class="table_head">${lang("commentsearch.order")}</td>
+               <td class="table_head">&nbsp;</td>
+       </tr>
 
-      <td>
-             <select name="searchfield">
-            <option value="title"<if searchfield=="title"> selected</if>>${lang("commentsearch.field.title")}</option>
-            <option value="creator"<if searchfield=="creator"> selected</if>>${lang("commentsearch.field.creator")}</option>
-            <option value="description"<if searchfield=="description"> selected</if>>${lang("commentsearch.field.description")}</option>
-          </select>
-      </td>
-      <td>
-          <select name="searchispublished">
-            <option value="">--</option>
-            <option value="0" <if searchispublished=="0"> selected</if>>${lang("commentsearch.publishedstate.hidden")}</option>
-            <option value="1" <if searchispublished=="1"> selected</if>>${lang("commentsearch.publishedstate.published")}</option>
-          </select>
-      </td>
-      <td>
-          <select name="searchstatus">
-            <option value="">--</option>
-            <list commentstatuses as cs>
-              <option value="${cs.id}" <if searchstatus==cs.id> selected</if>>${lang("commentstatus." + cs.name)}</option>
-            </list>
-          </select>
-      </td>
-      <td>
-          <select name="searchorder">
-            <option value="datedesc" <if searchorder=="datedesc"> selected</if>>${lang("commentsearch.order.datedesc")}</option>
-            <option value="dateasc" <if searchorder=="dateasc"> selected</if>>${lang("commentsearch.order.dateasc")}</option>
-            <option value="articletitle" <if searchorder=="articletitle"> selected</if>>${lang("commentsearch.order.articletitle")}</option>
-          </select>
-      </td>
-      <td>
-          <input class="majorbutton" type="submit" name="search" value="${lang("commentsearch.searchbutton")}">
-      </td>
-    </tr>
-  </table>
+       <tr>
+               <td class="listrow2">
+                       <input type="text"   size="10" maxlength="20" name="searchtext" value="${searchtext}">
+               </td>
+               <td class="listrow2">
+                       <select name="searchfield">
+                               <option value="title"<if searchfield=="title"> selected</if>>${lang("commentsearch.field.title")}</option>
+                               <option value="creator"<if searchfield=="creator"> selected</if>>${lang("commentsearch.field.creator")}</option>
+                               <option value="description"<if searchfield=="description"> selected</if>>${lang("commentsearch.field.description")}</option>
+                       </select>
+               </td>
+               <td class="listrow2">
+                       <select name="searchispublished">
+                               <option value="">--</option>
+                               <option value="0" <if searchispublished=="0"> selected</if>>${lang("commentsearch.publishedstate.hidden")}</option>
+                               <option value="1" <if searchispublished=="1"> selected</if>>${lang("commentsearch.publishedstate.published")}</option>
+                       </select>
+               </td>
+               <td class="listrow2">
+                       <select name="searchstatus">
+                               <option value="">--</option>
+                               <list commentstatuses as cs>
+                                       <option value="${cs.id}" <if searchstatus==cs.id> selected</if>>${lang("commentstatus." + cs.name)}</option>
+                               </list>
+                       </select>
+               </td>
+               <td class="listrow2">
+                       <select name="searchorder">
+                               <option value="datedesc" <if searchorder=="datedesc"> selected</if>>${lang("commentsearch.order.datedesc")}</option>
+                               <option value="dateasc" <if searchorder=="dateasc"> selected</if>>${lang("commentsearch.order.dateasc")}</option>
+                               <option value="articletitle" <if searchorder=="articletitle"> selected</if>>${lang("commentsearch.order.articletitle")}</option>
+                       </select>
+               </td>
+               <td class="listrow2">
+                       <input class="majorbutton" type="submit" name="search" value="${lang("commentsearch.searchbutton")}">
+               </td>
+       </tr>
+</table>
 </form>
 
 <if comments>
- <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
-  <form method="post" action="${config.actionRoot}">
-    <input type="hidden" name="module" value="Localizer">
-    <input type="hidden" name="do" value="commentoperationbatch">
-    <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
+<if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+       <form method="post" action="${config.actionRoot}">
+               <input type="hidden" name="module" value="Localizer">
+               <input type="hidden" name="do" value="commentoperationbatch">
+               <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
+               <p class="box">
+                       <input class="majorbutton" type="submit" name="save" value="${lang("save")}">&nbsp; (${lang("commentlist.activate")})
+               </p>
+</if>    
 
-    <p>
-      <input class="majorbutton" type="submit" name="save" value="${lang("save")}">
-    </p>
- </if>    
+<table border="0" cellpadding="2" cellspacing="3">  
+       <if comments>
+               <tr>
+                       <td>
+                               <if prevurl>
+                                       <a href="${config.actionRoot}?${prevurl}">[ ${lang("list.previous")} ]</a>&nbsp;
+                               </if>
+                               <if nexturl>
+                                       <a href="${config.actionRoot}?${nexturl}">[ ${lang("list.next")} ]</a>&nbsp;
+                               </if>
+                       </td>
+               </tr>
+       </if>
 
-    <table border="0" cellpadding="2" cellspacing="1">  
-      <if comments>
-        <tr><td>
-          <if prevurl>
-            <a href="${config.actionRoot}?${prevurl}">${lang("list.previous")}</a>&nbsp;
-          </if>
-          <if nexturl>
-            <a href="${config.actionRoot}?${nexturl}">${lang("list.next")}</a>&nbsp;
-          </if>
-        </td></tr>
-      </if>
-      <tr class="darkgrey">
-        <td><p class="witesmall">${lang("comment.date")}</p></td>
-        <td><p class="witesmall">${lang("comment.title")}/ ${lang("comment.creator")}<br>
-            ${lang("comment.text")}</p></td>
-        <td>&nbsp;</td>
-      </tr>
+       <tr class="table_head">
+               <td valign="top">
+                       ${lang("comment.date")}
+               </td>
+               <td>
+                       ${lang("comment.title")}/ ${lang("comment.creator")}<br>
+                       ${lang("comment.text")}
+               </td>
+               <td>
+                       &nbsp;
+               </td>
+       </tr>
     
-        <list comments as entry>
-          <tr <if grey=="1"><assign grey="0">class="list1"<else><assign grey="1">class="list2"</if>>
-        
-                       <td>${entry.creationdate.formatted["dd.MM.yyyy HH:mm"]}<br>
-                 <if entry.is_published=="0"><span class="spezialtext">${lang("comment.hidden")}</span><else>-</if>
-                       </td>
+<list comments as entry>
+       <tr <if grey=="1"><assign grey="0">class="listrow1"<else><assign grey="1">class="listrow2"</if>>
+               <td valign="top" class="small">
+                       ${entry.creationdate.formatted["dd.MM.yyyy HH:mm"]}<br>
+                       <if entry.is_published=="0"><b>${lang("commentlist.hidden")}</b><else>-</if>
+               </td>
         
-            <td><if entry.to_content>
-                  ${lang("comment.article")}
-                  <a href="${config.actionRoot}?module=Content&do=edit&id=${entry.to_content.id}">
-                    ${utility.encodeHTML(entry.to_content.title)}
-                  </a>
-                  (${lang("articletypes."+entry.to_content.article_type.name)})
-                </if><br>
-                [<a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${entry.to_content.id}">${lang("commentlist.allcomments")}</a>]
-                <br>
-                  <a name="${entry.id}"></a>
-                    <if entry.status>${lang("commentstatus." + entry.status.name)} - </if> 
-                    <b>${entry.title}</b><br>
+               <td>
+                       
+                       <a name="${entry.id}"></a>
+                       <if entry.to_content>
+                       ${lang("comment.article")}:
+                       <a href="${config.actionRoot}?module=Content&do=edit&id=${entry.to_content.id}">
+                               ${utility.encodeHTML(entry.to_content.title)}
+                       </a>
+        (${lang("articletypes."+entry.to_content.article_type.name)})<br> \r
+        [<a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${entry.to_content.id}">${lang("commentlist.allcomments")}</a>]<br>
+      </if>\r
+                       
+                       <b>${entry.title}</b> &nbsp;
+                       <if entry.creator>
+                               ${lang("by")}: ${entry.creator}
+                       </if>
+                       <br>
+                       ${utility.encodeHTML(entry.description)}
+                       
+                       <if entry.main_url><br>URL: ${entry.main_url}</if>
+                       <br><if entry.status>${lang("commentstatus." + entry.status.name)}<else> - </if> &nbsp;
+                       <br>
+                       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
+                               <list entry.operations as op>
+                                       [ <a href="${config.actionRoot}?module=Localizer&do=commentoperation&operation=${op}&id=${entry.id}&returnurl=${utility.encodeURI(thisurl + "#" + entry.id)}">${lang("comment.operation."+op)}</a> ]
+                               </list>
+                       </if>
+                       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="1">
+                               <list entry.operations as op>
+                                       [ <input type="checkbox" name="operation" value="${entry.id};${op}">${lang("comment.operation."+op)} ]
+                               </list>
+                       </if>
+                       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="2">
+                               <select name="operation">
+                                       <option value="" selected>&nbsp;</option>
+                                       <list entry.operations as op>
+                                               <option value="${entry.id};${op}">${lang("comment.operation."+op)}</option>
+                                       </list>
+                               </select>
+                       </if>
+                       <if entry.operations>|</if>
+                       <a href="${config.actionRoot}?module=Comment&do=edit&id=${entry.id}">${lang("edit")}</a>                
+               </td>
       
-                <if entry.creator>${lang("comment.creator")}: ${entry.creator}<br></if>
-                <span>${utility.encodeHTML(entry.description)}</span>
-                <if entry.main_url><br>URL: ${entry.main_url}</if>
-                <br>
-                <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
-                                     <list entry.operations as op>
-                               [<a href="${config.actionRoot}?module=Localizer&do=commentoperation&operation=${op}&id=${entry.id}&returnurl=${utility.encodeURI(thisurl + "#" + entry.id)}">${lang("comment.operation."+op)}</a>]
-                             </list>
-                           </if>
-                <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="1">
-                                     <list entry.operations as op>
-                                   [<input type="checkbox" name="operation" value="${entry.id};${op}">${lang("comment.operation."+op)}]
-                             </list>
-                           </if>
-                <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="2">
-                     <select name="operation">
-                    <option value="" selected>&nbsp;</option>
-                                       <list entry.operations as op>
-                      <option value="${entry.id};${op}">${lang("comment.operation."+op)}</option>
-                               </list>
-                  </select>
-                           </if>
-                <if entry.operations>|</if>
-                <a href="${config.actionRoot}?module=Comment&do=edit&id=${entry.id}">${lang("edit")}</a>                
-            </td>
+               <td valign="top">
+                       &nbsp;
+                       <a class="small" href="${config.actionRoot}?module=Comment&do=delete&id=${entry.id}&searchtext=${utility.encodeHTML(searchtext)}&searchfield=${utility.encodeHTML(searchfield)}&searchispublished=${searchispublished}&searchorder=${searchorder}&offset=${offset}">[${lang("delete")}]</a>
+               </td>    
+       </tr>
+</list>
       
-            <td>
-              <span class="text">&nbsp;
-                <a href="${config.actionRoot}?module=Comment&do=delete&id=${entry.id}&searchtext=${utility.encodeHTML(searchtext)}&searchfield=${utility.encodeHTML(searchfield)}&searchispublished=${searchispublished}&searchorder=${searchorder}&offset=${offset}">${lang("delete")}</a>
-              </span>
-            </td>
-        
-               </tr>
-        </list>
-      
-        <tr class="darkgrey">
-          <td colspan="3"><span class="witesmall">${count} ${lang("records")} / ${lang("show_from_to", from, to)}</span></td>
-        </tr>
-        <tr><td>
-          <if prevurl>
-            <a href="${config.actionRoot}?${prevurl}">${lang("list.previous")}</a>&nbsp;
-          </if>
-          <if nexturl>
-            <a href="${config.actionRoot}?${nexturl}">${lang("list.next")}</a>&nbsp;
-          </if>
-        </td></tr>
-    </table>
+       <tr>
+               <td colspan="3" class="table_foot">
+                       ${count} ${lang("records")} / ${lang("show_from_to", from, to)}
+               </td>
+       </tr>
+
+       <tr>
+               <td>
+                       <if prevurl>
+                               <a href="${config.actionRoot}?${prevurl}">[ ${lang("list.previous")} ]</a>&nbsp;
+                       </if>
+                       <if nexturl>
+                               <a href="${config.actionRoot}?${nexturl}">[ ${lang("list.next")} ]</a>&nbsp;
+                       </if>
+               </td>
+       </tr>
+</table>
 
-  <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
-      <p>
-        <input class="majorbutton" type="submit" name="save" value="${lang("save")}">
-      </p>
-    </form>    
-  </if>  
+<if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+       <p class="box">
+               <input class="majorbutton" type="submit" name="save" value="${lang("save")}"> &nbsp; (${lang("commentlist.activate")})
+       </p>
+       </form> 
+</if>  
   
 <else>
-  <P align="center">${lang("no_matches_found")}</p>
+<P align="center" class="box">${lang("no_matches_found")}</p>
 </if>
 
 <include "foot.template">
index 4b4dd64..7e0539e 100755 (executable)
@@ -4,7 +4,7 @@
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
   <head>
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-  
+       <include "FUNCTIONS.template">
     <include "head.template">
     <form action="${config.actionRoot}" method="post">
 
     
       <table border="0">
         <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-               <B>${lang("commentstatus.id")}:</B></span></td>
-          <td>
+          <td align="right" class="table_left">
+               <B>${lang("commentstatus.id")}:</B></td>
+          <td class="listrow2">
             ${data.id}
           </td>
         </tr>
+        
+               <call TextInputTableRow (lang("commentstatus.name"), 40, 255, "name", data.name)>
         <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-               <B>${lang("commentstatus.name")}:</B></span></td>
-          <td>
-            <input type="text" size="40" name="name" value="${data.name}">
-          </td>
-        </tr>
-        <tr>
-          <td colspan="2" align="right">
+          <td colspan="2" align="right" class="table_foot">
             <span class="witetext">
               <if data.new>
                 <input type="submit" name="save" value="${lang("insert")}">
@@ -45,7 +40,7 @@
       </table>
 
     </form>
-
+       <p><a class="link_box" href="${config.actionRoot}?module=CommentStatus&do=list">[&lt;] ${lang("back")} </a> &nbsp;</p>
     <include "foot.template">
   </body>
 </html>
index be06706..3187c89 100755 (executable)
@@ -4,85 +4,36 @@
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
   </head>
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+       
+       <include "FUNCTIONS.template">
+  
     <include "head.template">
 
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=CommentStatus&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+               <comment>configure this template here</comment>
+               <assign contentlist = data.contentlist>
+               <assign column_nr = 3>
+               <assign data_keys = ["id","name"]>
+               <assign column_head_texts = [lang("commentstatus.id"), lang("commentstatus.name")]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "CommentStatus">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "superusermenu">
 
     <if data.contentlist>
-      <table border="0">
-        <tr class="darkgrey">
-          <td>
-            <span class="witesmall">
-              <b>${lang("commentstatus.id")}</b>
-            </span>
-          </td>
-          <td>
-            <span class="witesmall">
-                   <b>${lang("commentstatus.name")}</b>
-                 </span>
-               </td>
-          <td>
-            &nbsp;
-          </td>
-        </tr>
-        <list data.contentlist as entry>
-          <if grey=="1">
-            <assign grey="0">
-            <tr class="list1">
-          <else>
-            <assign grey="1"> 
-            <tr class="list2">
-          </if>
-            <td><span class="small">${entry.id}&nbsp;</span></td>
-            <td><span class="small">${entry.name}&nbsp;</span></td>
-            <td>
-              <span class="text">&nbsp;
-                  <a href="${config.actionRoot}?module=CommentStatus&do=delete&id=${entry.id}">${lang("delete")}</a>
-                | <a href="${config.actionRoot}?module=CommentStatus&do=edit&id=${entry.id}">${lang("edit")}</a>
-              </span>
-            </td>
-          </tr>
-        </list>
-        <tr>
-          <td colspan="2" class="darkgrey">
-            <span class="witesmall">
-              ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
-                 </span>
-               </td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>
-      <p>
-      <if (data.prev || data.next)>
-        <form method="post" action="${config.actionRoot}">
-          <input type="hidden" name="module" value="CommentStatus">
-          <input type="hidden" name="where" value="${data.where}">
-          <if data.prev>
-            <input type="hidden" name="do" value="list">
-            <input type="hidden" name="prevoffset" value="${data.prev}">
-            <input type="submit" name="prev" value="${lang("list.previous")}">
-          </if>
-          <if data.next>
-            <input type="hidden" name="do" value="list">
-            <input type="hidden" name="nextoffset" value="${data.next}">
-            <input type="submit" name="next" value="${lang("list.next")}">
-          </if>
-        </form>
-      </if>
-    <else>
-      <P align="center">${lang("no_matches_found")}</p>
+               <call AddOrBack(module_name, module_jumpback, do_jumpback)>
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>   
+               <call PrevNextPage(module_name)>          
+   <else>
+               <P align="center">${lang("no_matches_found")}</p>
     </if>
     
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=CommentStatus&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+       <call AddOrBack(module_name, module_jumpback, do_jumpback)>
 
     <include "foot.template">
+  
   </body>
 </html>
 
index ccb7e13..4d23f0f 100755 (executable)
@@ -5,18 +5,12 @@
   </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+<center>
   <include "head_nonavi.template">
-<table width="100%" border="0" align="center">
-  <tr class="darkgrey">
-    <td colspan="2"> 
-      <h2 align="center"><span class="litetitel">${lang("confirm.really_delete")}</span></h2>
-    </td>
-  </tr>
-  <tr> 
-    <td colspan="2">
       <form method="post" action="${config.actionRoot}">
-        <div align="center">
+      <table><tr><td>
+         <p class="box_head" align="center"><b>${lang("confirm.really_delete")}</b></p>
+        <p class="box" align="center">
           <input type="hidden" name="module" value="${data.module}">
           <input type="hidden" name="do" value="delete">
           <input type="hidden" name="id" value="${data.id}">
           <input type="hidden" name="query_media_folder" value="${data.query_media_folder}">
           <input type="hidden" name="offset" value="${data.offset}">
           <input type="submit" name="cancel" value="${lang("cancel")}">
-          <input type="submit" name="confirm" value="${lang("delete")}">
-        </div>
-      </form>
-    </td>
-  </tr>
-</table>
+          <input type="submit" name="confirm" value="${lang("delete")}"><br>
+                 <br>
+                 <b><span class="text_alert">${lang("confirm.text")}</span></b>
+        </p>
+               
+      </td></tr></table>
+         </form>
+</center>
 <include "foot.template">
   </body>
 </html>
index 246d561..85be6bf 100755 (executable)
 <html>
-  <head>
-    <title>${lang("content.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css"
-    <!-- this might one day need to be the lang of the article????? -->
-    <meta http-equiv="Content-Type" content="text/html; charset=${lang("htmlcharset")}">
-  </head>
+<head>
+       <title>${lang("content.htmltitle")}</title>
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css"
+</head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+<include "FUNCTIONS.template">
 <include "head.template">
 
-<form accept-charset="${lang("htmlcharset")}" method="post" action="${config.actionRoot}">
-  <input type="hidden" name="charset" value="${lang("htmlcharset")}">
-  <input type="hidden" name="module" value="Content">
-  <input type="hidden" name="id" value="${utility.encodeHTML(article.id)}">
-  <if new=="1">
-    <input type="hidden" name="do" value="insert">
-  <else>
-    <input type="hidden" name="do" value="update">
-  </if>
+<form method="post" action="${config.actionRoot}">
+       <input type="hidden" name="module" value="Content">
+       <input type="hidden" name="id" value="${utility.encodeHTML(article.id)}">
+       <if new=="1">
+               <input type="hidden" name="do" value="insert">
+       <else>
+               <input type="hidden" name="do" value="update">
+       </if>
 
-  <table border="0" width="80%" align="middle">
-    <tr>
-      <td colspan="1">&nbsp</td>
-      <td class="minorcommand" colspan="2">
-        <if new=="0">
-          <a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${article.id}">${lang("content.comments")}</a>
-        </if>
-      </td>
-      <td colspan="2" align="right" valign="top">
-        ${lang("content.published")} 
-        <input type="checkbox" name="is_published" value="1"<if article.is_published!="0" && article.is_published!=""> checked</if>>
-        <if new=="1">
-          <input type="submit" name="save" value="${lang("insert")}">
-        <else>
-          <input type="submit" name="save" value="${lang("save")}">
-        </if>
-      </td>
-    </tr>
+<table width="90%" cellspacing="3" cellpadding="2">
+       <tr>
+               <td align="left" valign="top">
+                       <if !data.new>
+                               <a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${data.id}">[ ${lang("content.comments")} ]</a>
+                       </if>
+               </td>
+               <td align="right" valign="top">
+                       ${lang("content.published")} :
+                       <input type="checkbox" name="is_published" value="1"<if article.is_published!="0" && article.is_published!=""> checked</if>>
+                       <if new=="1">
+                               <input type="submit" name="save" value="${lang("insert")}">
+                       <else>
+                               <input type="submit" name="save" value="${lang("save")}">
+                       </if>
+               </td>
+       </tr>
 
-    <tr>
-      <td align="right" class="editfieldname">
-          ${lang("content.import_date")}:
-      </td>
-      <td>
-          ${article.date}
-      </td>
-      <td colspan="3">&nbsp;</td>
-    </tr>
-    <tr>
-      <td align="right" class="editfieldname">
-         ${lang("content.lastchange_date")}:
-      </td>
-      <td>
-        ${utility.encodeHTML(article.webdb_lastchange)}<br>
-      </td>
-      <td colspan="3">&nbsp;</td>
-    </tr>
-  
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-        ${lang("content.create_date")}:
-      </td>
-      <td colspan="3">
-        ${utility.encodeHTML(article.webdb_create)}<br><br>${lang("edit")} (yyyy-mm-dd [HH:mm]):
-        <input type="text" size="10" maxlength="16" name="webdb_create" value=""><br>
-      </td>
-      <td colspan="3">&nbsp;</td>
-    </tr>
-  
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.articletype")} /  
-          ${lang("content.language")}:
-      </td>
-      <td colspan="4">
-              <select name="to_article_type">
-                <list articletypes as a>
-                  <option value="${a.id}" <if (a.id == article.to_article_type)>selected</if>>${lang("articletypes."+a.name)}</option>
-                </list>
-              </select>
-              <select name="to_language">
-                <list languages as l>
-                  <option value="${l.id}" <if (l.id == article.to_language)>selected</if>>${l.name}</option>
-                </list>
-              </select>
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-        ${lang("content.topic")}:
-      </td>
-      <td colspan="4">
-        <if config["Mir.Localizer.Admin.TopicListFlavor"]!="0">      
-          <table border=0 cellpadding="0" cellspacing="0">
-            <tr> 
-                <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
-                <list topics as t>
-                  <if col=="0">
-                    </tr><tr>
-                    <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
-                  </if>
-                  <td>
-                    <input type="checkbox" name="to_topic" value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>checked</if></list>>${t.title}
-                  </td>
-                  <assign col=utility.increment(col, "-1")>
-                </list>
-                
-                <if col!="0">
-                  <td colspan="${col}">
-                    &nbsp;
-                  </td>
-                </if>
-            </tr>
-          </table>
-        <else>
-          <select name="to_topic" size="5" multiple>
-            <list topics as t>
-              <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
-            </list>
-          </select>
-        </if>        
-      </td>
-    </tr>
+       <tr>
+               <td align="right" class="table_left">
+                       id # :
+               </td>
+               <td class="listrow2">
+                       ${article.id}
+               </td>
+       </tr>
+       
+       <tr>
+               <td align="right" class="table_left">
+                       ${lang("content.lastchange_date")}:
+               </td>
+               <td class="listrow2">
+                       ${utility.encodeHTML(article.webdb_lastchange)}<br>
+               </td>
+       </tr>
 
-    <tr>
-    <td align="right" valign="top" class="editfieldname">
-      ${lang("content.title")}:&nbsp;
-    </td>
-    <td colspan="4">
-      <input type="text" size="40" name="title" value="${utility.encodeHTML(article.title)}"><br>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.subtitle")}:&nbsp;<br> 
-      </td>
-      <td colspan="4">
-        <input type="text" size="20" name="subtitle" value="${utility.encodeHTML(article.subtitle)}">
-        <input type="text" size="20" name="edittitle" value="${utility.encodeHTML(article.edittitle)}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-        ${lang("content.location")}:
-      </td>
-      <td colspan="4" >
-        <input type="text" size="40" name="source" value="${utility.encodeHTML(article.source)}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.creator")}:
-      </td>
-      <td colspan="4">
-        <input type="text" size="40" name="creator" value="${utility.encodeHTML(article.creator)}"><br>
-      </td>
-    </tr>
-  
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.creator.email")}/${lang("content.creator.url")}:
-      </td>
-      <td colspan="4" >
-        <input type="text" size="20" name="creator_email" value="${utility.encodeHTML(article.creator_email)}">
-        <input type="text" size="20" name="creator_main_url" value="${utility.encodeHTML(article.creator_main_url)}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.creator.address")}/${lang("content.creator.telephone")}:
-      </td>
-      <td colspan="4" >
-        <input type="text" size="20" name="creator_address" value="${utility.encodeHTML(article.creator_address)}">
-        <input type="text" size="20" name="creator_phone" value="${utility.encodeHTML(article.creator_phone)}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.abstract")}:
-      </td>
-      <td colspan="4">
-        <textarea cols="70" rows="15" name="description" wrap=virtual>${utility.encodeHTML(article.description)}</textarea>
-      </td>
-    </tr>
-  
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-        ${lang("content.content")}: 
-        <br>
-        ${lang("content.html")}
-        <input type="checkbox" name="is_html" value="1"<if article.is_html=="1"> checked</if>>&nbsp;
-      </td>
-      <td colspan="4">
-        <textarea cols="70" rows="20" name="content_data" wrap=virtual>${utility.encodeHTML(article.content_data)}</textarea>
-      </td>
-    </tr>
-    <tr>
-      <td align="right" valign="top" class="editfieldname">
-          ${lang("content.comment")}:<br>
-          <i>${lang("content.internal")}</i>
-      </td>
-      <td colspan="4">
-        <textarea cols="70" rows="6" name="comment" wrap=virtual>${utility.encodeHTML(article.comment)}</textarea>
-      </td>
-    </tr>
-    <tr>
-      <td>&nbsp;</td>
-      <td>&nbsp;</td>
-      <td>&nbsp;</td>
-      <td colspan="2" align="right" valign="top">
-        <if new=="1">
-          <input type="submit" name="save" value="${lang("insert")}">
-        <else>
-          <input type="submit" name="save" value="${lang("save")}">
-        </if>
-      </td>
-    </tr>
-<if new=="0">    
-    <tr>
-      <td class="pink" colspan="5">
-        ${lang("content.family")}
-      </td>
-    </tr>
-    <tr>
-      <td align=right valign=top class="editfieldname">
-        ${lang("content.parent")}:
-      </td>
-      <td colspan="4" align="left" valign="top">
-  <if article.parent>
-        <b>${utility.encodeHTML(article.parent.title)}</b>
-        <a href="${config.actionRoot}?module=Content&do=edit&id=${article.parent.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.viewparent")}</a> |
-        <a href="${config.actionRoot}?module=Content&do=clearparent&id=${article.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.clearparent")}</a> |
-  </if>    
-        <a href="${config.actionRoot}?module=Content&do=selectparent&id=${article.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.selectparent")}</a>
-      </td>
-    </tr>
-    <tr>
-      <td align=right valign=top class="editfieldname">
-        ${lang("content.children")}:
-      </td>
-      <td colspan="4" align="left" valign="top">
-        <a href="${config.actionRoot}?module=Content&do=listchildren&article_id=${article.id}">${lang("content.viewchildren")}</a>
-      </td>
-    </tr>
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.create_date")}:
+               </td>
+               <td class="listrow2">
+                       ${utility.encodeHTML(article.webdb_create)}<br>${lang("edit")}:
+                       <input type="text" size="10" maxlength="16" name="webdb_create" value=""> &nbsp; <span class="small">(yyyy-mm-dd [HH:mm])</span>
+               </td>
+       </tr>
 
-    <tr>
-      <td class="pink" colspan="5">
-        ${lang("content.attachments")}
-      </td>
-    </tr>
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.articletype")}:
+               </td>
+               <td class="listrow2">
+                               <select name="to_article_type">
+                                       <list articletypes as a>
+                                       <option value="${a.id}" <if (a.id == article.to_article_type)>selected</if>>${lang("articletypes."+a.name)}</option>
+                                       </list>
+                               </select>
+               </td>
+       </tr>
+       
+       <tr>
+               <td align="right" class="table_left">
+                       ${lang("content.language")}
+               </td>
+               <td class="listrow2">
+                       <select name="to_language">
+                               <list languages as l>
+                               <option value="${l.id}" <if (l.id == article.to_language)>selected</if>>${l.name}</option>
+                               </list>
+                       </select>
+               </td>
+       </tr>
+       
+       
+       
+       
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.topic")}:
+               </td>
+               <td class="listrow2" >
+                       <if config["Mir.Localizer.Admin.TopicListFlavor"]!="0">      
+                       <table border=0 cellpadding="2" cellspacing="0">
+                               <tr> 
+                                       <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
+                                       <list topics as t>
+                                               <if col=="0">
+                               </tr>
+                               <tr>
+                                       <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
+                                               </if>
+                                       <td>
+                                               <input type="checkbox" name="to_topic" value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>checked</if></list>>
+                                               <span class="small"> ${t.title}</span>
+                                       </td>
+                                       <assign col=utility.increment(col, "-1")>
+                                       </list>
+                                               <if col!="0">
+                                                       <td colspan="${col}">
+                                                               &nbsp;
+                                                       </td>
+                                               </if>
+                               </tr>
+                       </table>
+                       <else>
+                       <select name="to_topic" size="5" multiple>
+                               <list topics as t>
+                                       <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
+                               </list>
+                       </select>
+                       </if>        
+               </td>
+       </tr>
+       
+       <call TextInputTableRow      (lang("content.title"), 40, 255, "title", utility.encodeHTML(article.title))>
+       <call TextInputTableRowLight (lang("content.subtitle"), 20, 20, "subtitle", utility.encodeHTML(article.subtitle))>
+    <comment>
+               <call TextInputTableRowLight ("", 20, 20, "subtitle", utility.encodeHTML(article.edittitle))>
+       </comment>
+       <call TextInputTableRowLight (lang("content.location"), 40, 40, "source", utility.encodeHTML(article.source))>
+       <call TextInputTableRow      (lang("content.creator"), 40, 40, "creator", utility.encodeHTML(article.creator))>
+       <call TextInputTableRowLight (lang("content.creator.email"), 40, 60, "creator_email", utility.encodeHTML(article.creator_email))>
+       <call TextInputTableRowLight (lang("content.creator.url"), 40, 60, "creator_main_url", utility.encodeHTML(article.creator_main_url))>
+       <call TextInputTableRowLight (lang("content.creator.address"), 20, 40, "creator_address", utility.encodeHTML(article.creator_address))>
+       <call TextInputTableRowLight (lang("content.creator.telephone"), 20, 40, "creator_phone", utility.encodeHTML(article.creator_phone))>
 
-          <list article.to_media_images as m>
-            <tr>
-              <td align=right valign=top class="editfieldname">
-                  ${lang("content.images")}:
-              </td>
-              <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Images&do=edit&id=${m["id"]}"><img src="${config.actionRoot}?module=Images&do=getIcon&id=${m["id"]}" alt="edit" border="0"></a>
-                  <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">${lang("delete")}</a>
-              </td>
-            </tr>
-          </list>
-          <tr>
-            <td align=right valign=top class="editfieldname">
-                ${lang("content.images")}:
-            </td>
-            <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Images&do=list&cid=${article.id}">${lang("content.addimage")}</a> |
-                <a href="${config.actionRoot}?module=Images&do=add&articleid=${article.id}">${lang("content.uploadimage")}</a>
-            </td>
-          </tr>
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.abstract")}:
+               </td>
+               <td class="listrow2">
+                       <textarea cols="70" rows="15" name="description" wrap=virtual>${utility.encodeHTML(article.description)}</textarea>
+               </td>
+       </tr>
 
-          <list article.to_media_audio as m>
-            <tr>
-              <td align=right valign=top class="editfieldname">
-                ${lang("content.audio")}:
-              </td>
-              <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Audio&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>
-                  <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">${lang("delete")}</a>
-              </td>
-            </tr>
-          </list>
-          <tr>
-            <td align=right valign=top class="editfieldname">
-              ${lang("content.audio")}:
-            </td>
-            <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Audio&do=list&cid=${article.id}">${lang("content.addaudio")}</a> |
-                <a href="${config.actionRoot}?module=Audio&do=add&articleid=${article.id}">${lang("content.uploadaudio")}</a>
-            </td>
-          </tr>
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.content")}: 
+                       <br>
+                       ${lang("content.html")}&nbsp;
+                       <input type="checkbox" name="is_html" value="1"<if article.is_html=="1"> checked</if>>&nbsp;&nbsp;
+               </td>
+               <td class="listrow2">
+                       <textarea cols="70" rows="20" name="content_data" wrap=virtual>${utility.encodeHTML(article.content_data)}</textarea>
+               </td>
+       </tr>
+       
+       <tr>
+               <td align="right" valign="top" class="table_left">
+                       ${lang("content.comment")}:<br>
+                       <span class="small">${lang("content.internal")}</span>
+               </td>
+               <td class="listrow2">
+                       <textarea cols="70" rows="6" name="comment" wrap=virtual>${utility.encodeHTML(article.comment)}</textarea>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2" align="right" valign="top">
+                       <if new=="1">
+                               <input type="submit" name="save" value="${lang("insert")}">
+                       <else>
+                               <input type="submit" name="save" value="${lang("save")}">
+                       </if>
+               </td>
+       </tr>
+</table>
+       
+<if new=="0">
+
+<table width="90%" cellspacing="0" cellpadding="0">
+
+<tr>
+<td align="left" valign="top">
+
+<table cellspacing="3" cellpadding="2">
+       <tr>
+               <td class="table_head" colspan="2">
+                       ${lang("content.family")}
+               </td>
+       </tr>
+               
+       <tr>
+               <td align=right valign=top class="table_left">
+                       ${lang("content.parent")}:
+               </td>
+               <td align="left" valign="top" class="listrow2">
+                       <if article.parent>
+                               <b>${utility.encodeHTML(article.parent.title)}</b><br>
+                               <a href="${config.actionRoot}?module=Content&do=edit&id=${article.parent.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.viewparent")}</a> |
+                               <a href="${config.actionRoot}?module=Content&do=clearparent&id=${article.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.clearparent")}</a> |
+                       </if>    
+                               &nbsp;<a href="${config.actionRoot}?module=Content&do=selectparent&id=${article.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.selectparent")}</a>
+               </td>
+       </tr>
+               
+       <tr>
+               <td align=right valign=top class="table_left">
+                       ${lang("content.children")}:
+               </td>
+               <td align="left" valign="top" class="listrow2">
+                       <a href="${config.actionRoot}?module=Content&do=listchildren&article_id=${article.id}">${lang("content.viewchildren")}</a>
+               </td>
+       </tr>
+</table>
+
+</td>
+<td align="right" valign="top">
+
+<table cellspacing="2" cellpadding="2">
+               <tr>
+                       <td class="table_head" colspan="2">
+                               ${lang("content.attachments")}
+                       </td>
+               </tr>
+
+               <tr>
+                       <td align=right valign=top class="table_left">
+                               ${lang("content.images")}: 
+                       </td>
+                       <td align="left" valign="top" class="listrow2">
+                               <a href="${config.actionRoot}?module=Images&do=list&cid=${article.id}">[+] ${lang("content.addimage")}</a> |
+                               <a href="${config.actionRoot}?module=Images&do=add&articleid=${article.id}">${lang("content.uploadimage")}</a>
+                       </td>
+               </tr>
+               <list article.to_media_images as m>
+                       <tr>
+                       <td align=right valign=top>
+                               <a href="${config.actionRoot}?module=Images&do=edit&id=${m["id"]}"><img src="${config.actionRoot}?module=Images&do=getIcon&id=${m["id"]}" alt="edit" border="0"></a>&nbsp;
+                       </td>
+                       <td align="left" valign="top">
+                               <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">[-] ${lang("delete")}</a>
+                       </td>
+                       </tr>
+               </list>
+               
+
+               <tr>
+                       <td align=right valign=top class="table_left">
+                       ${lang("content.audio")}:
+                       </td>
+                       <td align="left" valign="top" class="listrow2">
+                               <a href="${config.actionRoot}?module=Audio&do=list&cid=${article.id}">[+] ${lang("content.addaudio")}</a> |
+                               <a href="${config.actionRoot}?module=Audio&do=add&articleid=${article.id}">${lang("content.uploadaudio")}</a>
+                       </td>
+               </tr>
+               <list article.to_media_audio as m>
+                       <tr>
+                       <td align=right valign=top>
+                               <a href="${config.actionRoot}?module=Audio&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>&nbsp;
+                       </td>
+                       <td align="left" valign="top">
+                               <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">[-] ${lang("delete")}</a>
+                       </td>
+                       </tr>
+               </list>
+               
+
+               <tr>
+                       <td align=right valign=top class="table_left">
+                               ${lang("content.video")}:
+                       </td>
+                       <td  align="left" valign="top" class="listrow2">
+                               <a href="${config.actionRoot}?module=Video&do=list&cid=${article.id}">[+] ${lang("content.addvideo")}</a> |
+                               <a href="${config.actionRoot}?module=Video&do=add&articleid=${article.id}">${lang("content.uploadvideo")}</a>
+                       </td>
+               </tr>
+               <list article.to_media_video as m>
+                       <tr>
+                       <td align=right valign=top>
+                               <a href="${config.actionRoot}?module=Video&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>&nbsp;                            
+                       </td>
+                       <td align="left" valign="top">
+                               <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">[-] ${lang("delete")}</a>
+                       </td>
+                       </tr>
+               </list>
+               
+               <tr>
+                       <td align=right valign=top class="table_left">
+                               ${lang("content.other")}:
+                       </td>
+                       <td align="left" valign="top" class="listrow2">
+                       <a href="${config.actionRoot}?module=OtherMedia&do=list&cid=${article.id}">[+] ${lang("content.addother")}</a> |
+                       <a href="${config.actionRoot}?module=OtherMedia&do=add&articleid=${article.id}">${lang("content.uploadother")}</a>
+                       </td>
+               </tr>
+               <list article.to_media_other as m>
+                       <tr>
+                       <td align=right valign=top">
+                       <a href="${config.actionRoot}?module=Video&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>&nbsp;    
+                       </td>
+                       <td align="left" valign="top">
+                               <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">[-] ${lang("delete")}</a>
+                       </td>
+                       </tr>
+               </list>
+
+</table>
+
+</td>
+</tr>
+</table>
 
-          <list article.to_media_video as m>
-            <tr>
-              <td align=right valign=top class="editfieldname">
-                  ${lang("content.video")}:
-              </td>
-              <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Video&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>
-                  <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">${lang("delete")}</a>
-              </td>
-            </tr>
-          </list>
-          <tr>
-            <td align=right valign=top class="editfieldname">
-                ${lang("content.video")}:
-            </td>
-            <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Video&do=list&cid=${article.id}">${lang("content.addvideo")}</a> |
-                <a href="${config.actionRoot}?module=Video&do=add&articleid=${article.id}">${lang("content.uploadvideo")}</a>
-            </td>
-          </tr>
-          <list article.to_media_other as m>
-            <tr>
-              <td align=right valign=top class="editfieldname">
-                  ${lang("content.other")}:
-              </td>
-              <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Video&do=edit&id=${m["id"]}"><img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0"></a>
-                <a href="${config.actionRoot}?module=Content&do=dettach&cid=${article.id}&mid=${m["id"]}">${lang("delete")}</a>
-              </td>
-            </tr>
-          </list>
-          <tr>
-            <td align=right valign=top class="editfieldname">
-                ${lang("content.other")}:
-            </td>
-            <td colspan="4" align="left" valign="top">
-              <a href="${config.actionRoot}?module=OtherMedia&do=list&cid=${article.id}">${lang("content.addother")}</a> |
-              <a href="${config.actionRoot}?module=OtherMedia&do=add&articleid=${article.id}">${lang("content.uploadother")}</a>
-            </td>
-          </tr>
-          
 </if>          
-        </table>
-      </form>
-      
-    <include "foot.template">
-  </body>
+
+</form>
+
+       <include "foot.template">
+</body>
 </html>
index 2d54005..edfe822 100755 (executable)
 </comment>
 
 <if selectarticleurl!="">
-  <assign showsearch="1">
-  <assign showactions="0">
+       <assign showsearch="1">
+       <assign showactions="0">
 <else>
-  <assign showactions="1">
-  <assign showsearch="0">
+       <assign showactions="1">
+       <assign showsearch="0">
 </if>
 
 <html>
-  <head>
-    <title>${config["Mir.Name"]} | ${lang("contentlist.htmltitle")} </title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  </head>
-
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
-    <include "head.template">
-    
-    <if showsearch=="1">
-      <form method="POST" action="${config.actionRoot}">
-        <input type="hidden" name="module" value="Content">
-        <input type="hidden" name="do" value="search">
-        <input type="hidden" name="selectarticleurl" value="${utility.encodeHTML(selectarticleurl)}">
-         
-        <table border="0" cellpadding="2" cellspacing="1">
-          <tr class="pink">
-            <td>${lang("contentsearch.value")}</td>
-            <td>${lang("contentsearch.field")}</td>
-            <td>${lang("contentsearch.publishedstate")}</td>
-            <td>${lang("contentsearch.articletype")}</td>
-            <td>${lang("contentsearch.order")}</td>
-          </tr>
-          <tr>
-            <td><input type="text" size="10" maxlength="20" name="searchvalue" value="${searchvalue}"></td>
-            <td>
-                     <select name="searchfield">
-                  <option value="title"<if searchfield=="title"> selected</if>>${lang("contentsearch.field.title")}</option>
-                  <option value="creator"<if searchfield=="creator"> selected</if>>${lang("contentsearch.field.creator")}</option>
-                  <option value="contents"<if searchfield=="content"> selected</if>>${lang("contentsearch.field.contents")}</option>
-                </select>
-            </td>
-            <td>
-                <select name="searchispublished">
-                  <option value="">--</option>
-                  <option value="0" <if searchispublished=="0"> selected</if>>${lang("contentsearch.publishedstate.hidden")}</option>
-                  <option value="1" <if searchispublished=="1"> selected</if>>${lang("contentsearch.publishedstate.published")}</option>
-                </select>
-            </td>
-            <td>
-                <select name="searcharticletype">
-                  <option value="">--</option>
-                  <list articletypes as at>
-                    <option value="${at.id}" <if searcharticletype==at.id> selected</if>>${lang("articletypes."+at.name)}</option>
-                  </list>
-                </select>
-            </td>
-            <td>
-                <select name="searchorder">
-                  <option value="datedesc" <if searchorder=="datedesc"> selected</if>>${lang("contentsearch.order.datedesc")}</option>
-                  <option value="dateasc" <if searchorder=="dateasc"> selected</if>>${lang("contentsearch.order.dateasc")}</option>
-                  <option value="title" <if searchorder=="title"> selected</if>>${lang("contentsearch.order.title")}</option>
-                  <option value="creator" <if searchorder=="creator"> selected</if>>${lang("contentsearch.order.creator")}</option>
-                </select>
-            </td>
-            <td>
-                <input class="majorbutton" type="submit" name="search" value="${lang("contentsearch.searchbutton")}">
-            </td>
-          </tr>
-        </table>
-      </form>
-    </if>
-
-    <if articles>
-
-      <if showactions=="1">
-        <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
-          <form method="post" action="${config.actionRoot}">
-            <input type="hidden" name="module" value="Localizer">
-            <input type="hidden" name="do" value="articleoperationbatch">
-            <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
-        
-            <p>
-              <input class="majorbutton" type="submit" name="save" value="${lang("save")}">
-            </p>
-        </if>    
-      </if>
-
-      <table border="0" width="100%" cellspacing="0" cellpadding="2">
-        <tr class="darkgrey">
-          <td><span class="witesmall">
-            ${lang("content.creationdate")}<br>
-            ${lang("content.modificationdate")}<br>
-            ${lang("content.status")}
-          </span></td>
-          <td><span class="witesmall">
-            ${lang("content.type")} - ${lang("content.title")} <br>
-            ${lang("content.creator")}
-          </span></td>
-          <td width="25%"><span class="witesmall">
-            ${lang("content.comment")}
-          </span></td>
-          <td class="darkgrey">&nbsp;</td>
-        </tr>
-
-        <assign grey="0">
-
-        <list articles as entry>
-          <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"></if>>
-            <td>
-              <span class="x-small">
-                ${entry.creationdate.formatted["dd.MM.yyyy HH:mm"]}<br>
-                ${entry.changedate.formatted["dd.MM.yyyy HH:mm"]}<br>
-                <if entry.is_published!="0">F<else>-</if><if entry.is_html!="0">H<else>-</if>
-              </span>
-            </td>
-            <td>
-              <span class="small">
-                <b>
-                  <span class="x-small">
-                    ${lang("articletypes." + entry.article_type.name)} -
-                  </span>
-                  ${entry.title}
-                </b><br>
-                ${entry.creator}<br>
-                
-                <if showactions=="1">
-                  <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
-                    <list entry.operations as op>
-                      [<a href="${config.actionRoot}?module=Localizer&do=articleoperation&operation=${op}&articleid=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.operation."+op)}</a>]
-                    </list>
-                  </if>
-                  <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="1">
-                    <list entry.operations as op>
-                      [<input type="checkbox" name="operation" value="${entry.id};${op}">${lang("content.operation."+op)}]
-                    </list>
-                  </if>
-                  <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="2">
-                    <select name="operation">
-                      <option value="" selected>&nbsp;</option>
-                      <list entry.operations as op>
-                        <option value="${entry.id};${op}">${lang("content.operation."+op)}</option>
-                      </list>
-                    </select>
-                  </if>
-                  <if entry.operations>
-                    |
-                  </if>
-                  <a href="${config.actionRoot}?module=Content&do=edit&id=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("edit")}</a> |
-                  <a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("contentlist.comments")}</a> (${entry.commentcount})
-                <else>
-                  <span class="text">
-                    <a href="${config.actionRoot}?${selectarticleurl}&id=${entry.id}">${lang("contentlist.select")}</a>
-                  </span>
-                </if>
-              </span>
-            </td>
-            <td width="20%" <if grey=="1">class="list3"<else>class="list4"</if> valign="top">
-              <span class="x-small">
-                ${entry.comment}&nbsp;
-              </span>
-            </td>
-            <td>
-              <if showactions=="1">
-                <span class="text">
-                  <a href="${config.actionRoot}?module=Content&do=delete&id=${entry.id}&where=${utility.encodeURI(where)}&order=${utility.encodeURI(order)}&offset=${utility.encodeURI(offset)}">${lang("delete")}</a>
-                </span>
-              </if>
-            </td>
-          </tr>
-        </list>
-        <tr class="darkgrey">
-          <td colspan="4"><span class="witesmall">
-            ${count} ${lang("records")} / ${lang("show_from_to", from, to)}
-          </span></td>
-        </tr>
-      </table>
-      
-      <if showactions=="1">
-        <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
-            <p>
-              <input class="majorbutton" type="submit" name="save" value="${lang("save")}">
-            </p>
-          </form> 
-        </if>  
-      </if>
-      <p>
-
-      <if prevurl || nexturl>      
-        <if prevurl>
-          <a href="${config.actionRoot}?${prevurl}">${lang("list.previous")}</a>
-        </if>
-        <if nexturl>
-          <a href="${config.actionRoot}?${nexturl}">${lang("list.next")}</a>
-        </if>
-      </if>
-    
-    <else>
-      <p align="center">${lang("no_matches_found")}</p>
-    </if>
-    
-    <include "foot.template">
-  </body>
+<head>
+       <title>${config["Mir.Name"]} | ${lang("contentlist.htmltitle")} </title>
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+</head>
+
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+<include "FUNCTIONS.template">
+<include "head.template">
+
+<if showsearch=="1">
+       <call ContentSearch ("layouted")>
+</if>
+
+<if articles>
+
+<if showactions=="1">
+       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+               <form method="post" action="${config.actionRoot}">
+                       <input type="hidden" name="module" value="Localizer">
+                       <input type="hidden" name="do" value="articleoperationbatch">
+                       <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
+                       <p class="box">
+                               <input type="submit" name="save" value="${lang("save")}"> &nbsp; ( ${lang("commentlist.activate")})
+                       </p>
+       </if>    
+</if>
+
+<call PrevNext ("right")>
+
+<table border="0" width="100%" cellspacing="3" cellpadding="2">
+       <tr>
+               <td class="table_head" valign="top">
+                       <span class="small">      
+                       ${lang("content.creationdate")}<br>
+                       ${lang("content.modificationdate")}<br>
+                       ${lang("content.status")}
+                       </span>
+               </td>
+               <td class="table_head" valign="top">
+                       ${lang("content.type")} - ${lang("content.title")} <br>
+                       ${lang("content.creator")}
+               </td>
+               <td class="table_head" valign="top">
+                       ${lang("content.comment")}
+               </td>
+               <td class="table_head" valign="top">&nbsp;</td>
+       </tr>
+
+<assign grey="0">
+
+       <list articles as entry>
+               <tr <if grey=="1"><assign grey="0">class="listrow1"<else>class="listrow2"<assign grey="1"></if>>
+                       <td class="x-small">
+                                       ${entry.creationdate.formatted["dd.MM.yyyy HH:mm"]}<br>
+                                       ${entry.changedate.formatted["dd.MM.yyyy HH:mm"]}<br>
+                                       <if entry.is_published!="0">Pub.<else>-</if> <if entry.is_html!="0">HTML<else>-</if>
+                       </td>
+                       <td>
+                               <b>${entry.title}</b><br>
+                               ${lang("by")}: ${entry.creator}<br>
+                               (${lang("articletypes." + entry.article_type.name)}) 
+                               <if showactions=="1">
+                                       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
+                                               <list entry.operations as op>
+                                                       [ <a href="${config.actionRoot}?module=Localizer&do=articleoperation&operation=${op}&articleid=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("content.operation."+op)}</a> ]
+                                               </list>
+                                       </if>
+                               <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="1">
+                                       <list entry.operations as op>
+                                               [ <input type="checkbox" name="operation" value="${entry.id};${op}"> ${lang("content.operation."+op)} ]
+                                       </list>
+                               </if>
+                                       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="2">
+                                               <select name="operation">
+                                                       <option value="" selected>&nbsp;</option>
+                                                       <list entry.operations as op>
+                                                               <option value="${entry.id};${op}">${lang("content.operation."+op)}</option>
+                                                       </list>
+                                               </select>
+                                       </if>
+                                       <if entry.operations> | </if>
+                                       <a href="${config.actionRoot}?module=Content&do=edit&id=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("edit")}</a> |
+                                       <a href="${config.actionRoot}?module=Comment&do=articlecomments&articleid=${entry.id}&returnurl=${utility.encodeURI(thisurl)}">${lang("contentlist.comments")}</a> (${entry.commentcount})
+                               <else>
+                                       <span class="text">
+                                       <a href="${config.actionRoot}?${selectarticleurl}&id=${entry.id}">${lang("contentlist.select")}</a>
+                               </if>
+                       </td>
+                       <td width="25%"  <if grey=="1">class="listrow3"<else>class="listrow4"</if> valign="top">
+                               <span class="small">${entry.comment}&nbsp;</span>
+                       </td>
+                       <td valign="top" class="listcommand">
+                               <if showactions=="1">
+                                       <a href="${config.actionRoot}?module=Content&do=delete&id=${entry.id}&where=${utility.encodeURI(where)}&order=${utility.encodeURI(order)}&offset=${utility.encodeURI(offset)}">[${lang("delete")}]</a>
+                               </if>
+                       </td>
+       </tr>
+</list>
+       <tr>
+               <td colspan="4" class="table_foot">
+                       ${count} ${lang("records")} / ${lang("show_from_to", from, to)}
+               </td>
+       </tr>
+</table>
+
+<if showactions=="1">
+       <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+               <p class="box">
+                       <input class="majorbutton" type="submit" name="save" value="${lang("save")}"> &nbsp; ( ${lang("commentlist.activate")})
+               </p>
+       </form> 
+       </if>  
+</if>
+
+
+<call PrevNext ("right")>
+
+
+
+<else>
+<p align="center" class="box">${lang("no_matches_found")}</p>
+</if>
+
+<include "foot.template">
+</body>
 </html>
index 2a0395d..9c79dc2 100755 (executable)
@@ -5,33 +5,16 @@
 </head>
 <body>
 <include "head.template">
-<table width="100%" border="0" align="center">
-       <tr class="grey">
-               <td>
-                       <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
-                       </div>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>
-                       <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
-                       <p>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p align="center">
-            ${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
-                       <p>
-               </td>
-       </tr>
-</table>
+
+<table width="70%" align="center"><tr><td>
+
+<p class="box_head" align="center"><font size="+2"><b>${lang("error.title")}</b></font></p>
+<p align="center">${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}</p>
+<p align="center" class="bg_neutral"><br><font color="red">${data.date} -- ${data.errorstring}</font><br><br></p>
+<p align="center">${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}</p>
+
+</td></tr></table>
+
 <include "foot.template">
 </body>
 </html>
index 75f57a9..97cfada 100755 (executable)
@@ -8,42 +8,33 @@
 
 <include "head.template">
 
-<br>
-<b>${lang("fileedit.filename")} :</b> ${filename}
+<p>
+       <b>${lang("fileedit.filename")} :</b> ${filename}<br>
+       <b>${lang("fileedit.subdirectory")} :</b> ${subdirectory}
+</p>
 
 <br>
 
 <form action="${config.actionRoot}" method="post">
-
        <input type="hidden" name="module" value="FileEdit">
        <input type="hidden" name="filename" value="${filename}">
        <input type="hidden" name="subdirectory" value="${subdirectory}">
-        <input type="hidden" name="do" value="update">
-
-
-        <textarea cols="120" rows="40" name="text" wrap=virtual>${utility.encodeHTML(text)}</textarea>
-
-<br>
-
-
-
-        <input type="submit" name="save" value="${lang("save")}"> &nbsp;
-        <input type="reset" value="${lang("reset")}">
-
-
+       <input type="hidden" name="do" value="update">
+       <input type="submit" name="save" value="${lang("save")}"> &nbsp;
+       <input type="reset" value="${lang("reset")}">
+       <br><br>        
+       <textarea cols="120" rows="40" name="text" wrap=virtual>${utility.encodeHTML(text)}</textarea>
+       <br><br>
+       <input type="submit" name="save" value="${lang("save")}"> &nbsp;
+       <input type="reset" value="${lang("reset")}">
 </form>
 <br>
 <br>
-
-${lang("preview")}
-
-<hr size="2" width="90%" noshade>
-
+<p><b>${lang("preview")} :</b></p>
+<hr size="2" width="99%" noshade>
 ${text}
-
-<hr size="2" width="90%" noshade>
+<hr size="2" width="99%" noshade>
 <br>
-
 <include "foot.template">
 
 </body>
index 680fe46..9ca7fab 100755 (executable)
@@ -1,82 +1,86 @@
 <html>
 <head>
        <title>${config["Mir.Name"]} | ${lang("fileeditlist.htmltitle")}</title>
-        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+               <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+
 <include "head.template">
 
+<table cellpadding="16"><tr><td valign="top">
+
+
 <if dirlist || updir>
+<table border="0" cellpadding="2" cellspacing="2">
+
+       <tr>
+               <td class="table_head"><b>${lang("fileeditlist.dirname")}</b></td>
+               <td class="table_head">&nbsp;</td>
+       </tr>
+       <assign grey="0">
 
-  <table border="0" cellpadding="2" cellspacing="1">
-  
-    <tr class="dark">
-      <td><span class="witesmall"><b>${lang("fileeditlist.dirname")}</b></span></td>
-       <td>&nbsp;</td>
-    </tr>
-    
-    <assign grey="0">
-    
-    <if updir>
-          <tr class="list1">
-            <td>..&nbsp;</td>
-            <td><span class="small"><a href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(updir)}&directory=">${lang("edit")}</a></span></td>
-          </tr>
-    </if>
-  
-    <if dirlist>
-      <list dirlist as entry>
-            <if grey=="1">
-              <assign grey="0">
-              <tr class="list1">
-            <else>
-              <tr class="list2">
-              <assign grey="1"> 
-            </if>
-                <td>${entry}&nbsp;</td>
-                <td><span class="small"><a href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(subdirectory)}&directory=${utility.encodeURI(entry)}">${lang("edit")}</a></span></td>
-              </tr>
-      </list>
-    </if>
-  
-  </table>
+<if updir>
+       <tr class="list1">
+               <td>&nbsp;..&nbsp;</td>
+               <td><a class="tablecommand" href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(updir)}&directory=">${lang("edit")}</a></td>
+       </tr>
 </if>
 
-<if filelist || updir || dirlist>
-<p></p>
+<if dirlist>
+       <list dirlist as entry>
+               <if grey=="1">
+                       <assign grey="0">
+                       <tr class="listrow1">
+               <else>
+                       <tr class="listrow2">
+                       <assign grey="1"> 
+               </if>
+                               <td> ${entry}&nbsp;</td>
+                               <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(subdirectory)}&directory=${utility.encodeURI(entry)}">${lang("edit")}</a></td>
+                       </tr>
+       </list>
+       </if>
+
+</table>
 </if>
 
-<if filelist>
 
-<table border="0" cellpadding="2" cellspacing="1">
+</td>
+<td valign="top">
 
-  <tr class="dark">
-    <td><span class="witesmall"><b>${lang("fileeditlist.filename")}</b></span></td>
-       <td>&nbsp;</td>
-  </tr>
 
-  <assign grey="0">
+<if filelist || updir || dirlist>
+
+</if>
+
+<if filelist>
 
-  <list filelist as entry>
-        <if grey=="1">
-          <assign grey="0">
-          <tr class="list1">
-        <else>
-          <tr class="list2">
-          <assign grey="1"> 
-        </if>
-            <td>${entry}&nbsp;</td>
-            <td><span class="small"><a href="${config.actionRoot}?module=FileEdit&do=edit&subdirectory=${utility.encodeURI(subdirectory)}&filename=${utility.encodeURI(entry)}">${lang("edit")}</a></span></td>
-          </tr>
-  </list>
+<table border="0" cellpadding="2" cellspacing="2">
 
+       <tr>
+               <td class="table_head"><b>${lang("fileeditlist.filename")}</b></td>
+               <td class="table_head">&nbsp;</td>
+       </tr>
+<assign grey="0">
+<list filelist as entry>
+       <if grey=="1">
+               <assign grey="0"><tr class="listrow1">
+       <else><tr class="listrow2">
+               <assign grey="1">
+       </if>
+                       <td>${entry}&nbsp;</td>
+                       <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=edit&subdirectory=${utility.encodeURI(subdirectory)}&filename=${utility.encodeURI(entry)}">${lang("edit")}</a></td>
+               </tr>
+</list>
 </table>
 
-<P>
+</td></tr></table>
 
+
+<P>
 <else>
-  <P align="center">${lang("no_matches_found")}</p>
+       <P align="center" class="box">${lang("no_matches_found")}</p>
 </if>
 <include "foot.template">
 </body>
index be714bc..cc32897 100755 (executable)
@@ -1,11 +1,23 @@
-<table width="100%" cellspacing="0" cellpadding="0">
-<tr>
-       <td colspan=2><hr></td>
-</tr>
-<tr>
-       <td align="left" class="darkgrey"><span class="small">
-       <a href="#top"><span class="whitetext"><b>${lang("foot.top")}</b></span></a></span></td>
-       <td align="right"><span class="small">
-       <a href="mailto:${lang("Mir.Contact-email.address")}"><span class="spezialtext"><b>${config["Mir.Shortname"]}</b></span></a> - ${config["Mir.Version"]}</span></td>
-</tr>
+<hr>   
+<table width="99%" cellspacing="0">
+       <tbody>
+       <tr>
+               <td align="left" class="table_head">
+                       <a href="#top"><span class="table_head"> ${lang("foot.top")}</span></a>
+                       <if returnurl>
+                               <a href="${config.actionRoot}?${returnurl}"><span class="table_head"> | &nbsp;&nbsp;${lang("back")} [ &lt; ]</span></a>&nbsp;&nbsp;
+                       </if>
+               </td>
+               <td align="right" class="table_head">
+                       <a href="mailto:${config["Mir.Contact-email.address"]}"><span class="table_head">${config["Mir.Shortname"]}</span></a> - ${config["Mir.Version"]}
+               </td>
+       </tr>
+</tbody>
 </table>
+
+
+       
+       
+       
+
+
index b482efc..ea79e7c 100755 (executable)
@@ -1,22 +1,18 @@
 <a name="top"></a>
-<table width="100%" cellspacing="0" cellpadding="0">
- <tr class="dark">
-  <td colspan="2">
-   <img src="${config.docRoot}/img/logo_small.gif" border="0" align="middle">&nbsp;
-    <span class="witesmall">
-       <b>${config["Mir.Name"]}</b></span></td></tr>
-<tr>
-<if returnurl>
-<td align="left">
-<a href="${config.actionRoot}?${returnurl}"><span class="spezialtext">${lang("back")}</span></a>
-</td>
-</if>
 
-
-<td align="right"><span class="spezialtext">
-       <a href="${config.actionRoot}"><span class="spezialtext">${lang("head.start")}</span></a> |
-       <a href="${config.actionRoot}?module=logout"><span class="spezialtext">${lang("head.logout")}</span></a> |
-       <a href="${config.docRoot}/help/help.html"><span class="spezialtext">${lang("head.help")}</span></a> | ${lang("head.search")}</span></td></tr>
-<tr>  <td colspan="2">
-<hr></td></tr>
+<table class="table_head" width="100%" cellspacing="0" cellpadding="0">
+       <tr>
+               <td>
+                       <img src="${config.docRoot}/img/logo_small.gif" border="0" align="middle">&nbsp;
+                       ${config["Mir.Name"]}
+               </td>
+               <td align="right">
+                       <if returnurl>
+                               <a href="${config.actionRoot}?${returnurl}"><span class="table_head">[ &lt; ] ${lang("back")}</span></a>&nbsp;&nbsp;|
+                       </if>
+                       <a href="${config.actionRoot}"><span class="table_head">${lang("head.start")}</span></a> |
+                       <a href="${config.actionRoot}?module=logout"><span class="table_head">${lang("head.logout")}</span></a>
+               </td>
+       </tr>
 </table>
+<hr>
index 9019b5a..0217fd0 100755 (executable)
@@ -1,14 +1,18 @@
 <a name="top"></a>
 <table width="100%" cellspacing="0" cellpadding="0">
- <tr class="dark">
-  <td>
-   <img src="${config.docRoot}/img/logo_small.gif" border="0" align="middle">&nbsp;
-    <span class="witesmall">
-       <b>${config["Mir.Name"]}</b></span></td></tr>
-<if login_user><tr><td align="right"><span class="spezialtext">
-       <b>${login_user.login}</b> ${lang("head.logged_in")} /
-       <a href="${actionRoot}?module=logout">${lang("head.logout")}</a></span>
-       </td></tr>
+       <tr>
+               <td class="table_head">
+                       <img src="${config.docRoot}/img/logo_small.gif" border="0" align="middle">&nbsp;
+                       <b>${config["Mir.Name"]}</b>
+               </td>
+       </tr>
+<if login_user>
+       <tr>
+               <td align="right">
+                       <b>${login_user.login}</b> ${lang("head.logged_in")} |
+                       <a href="${actionRoot}?module=logout">${lang("head.logout")}</a>
+               </td>
+       </tr>
 </if>
-<tr><td><hr></td></tr>
+       <tr><td><hr></td></tr>
 </table>
index 26357a4..9bc6191 100755 (executable)
@@ -2,55 +2,63 @@
 <head>
        <title>${config["Mir.Name"]} | ${lang("start.content.hidden")}</title>
        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
-<table width="98%" class="pink">
-  <tr>
-    <td>
+
+<table width="50%" align="center" >
+       <tr>
+               <td class="table_head">
+                       <b>${lang("start.content.hidden")}</b>
+               </td>
+       </tr>
+       <tr>
+               <td class="listrow2">
 
 
-<form method="post" action="${config.actionRoot}">
+<form method="get" action="${config.actionRoot}">
        <input type="hidden" name="module" value="Hidden">
        <input type="hidden" name="do" value="list">
 
 
 
-     ${lang("month")}
-    <select name="month">
-    <option value="01" selected >01</option>
-    <option value="02">02</option>
-    <option value="03">03</option>
-    <option value="04">04</option>
-    <option value="05">05</option>
-    <option value="06">06</option>
-    <option value="07">07</option>
-    <option value="08">08</option>
-    <option value="09">09</option>
-    <option value="10">10</option>
-    <option value="11">11</option>
-    <option value="12">12</option>
-    </select>
-    ${lang("year")}
-    <select name="year">
-    <option value="2001">2001</option>
-    <option value="2002" selected >2002</option>
-    <option value="2002">2003</option>
-    <option value="2002">2004</option>
-    <option value="2002">2005</option>
-    </select>
-
-    &nbsp;
-
-    <input type="submit" name="search" value="${lang("commentlist.search")}">
+       ${lang("month")}
+       <select name="month">
+       <option value="01" selected >01</option>
+       <option value="02">02</option>
+       <option value="03">03</option>
+       <option value="04">04</option>
+       <option value="05">05</option>
+       <option value="06">06</option>
+       <option value="07">07</option>
+       <option value="08">08</option>
+       <option value="09">09</option>
+       <option value="10">10</option>
+       <option value="11">11</option>
+       <option value="12">12</option>
+       </select>
+       ${lang("year")}
+       <select name="year">
+       <option value="2001">2001</option>
+       <option value="2002">2002</option>
+       <option value="2003" selected >2003</option>
+       <option value="2004">2004</option>
+       <option value="2005">2005</option>
+       <option value="2006">2006</option>
+       <option value="2007">2007</option>
+       <option value="2008">2008</option>
+       </select>
+
+       &nbsp;
+
+       <input type="submit" name="search" value="${lang("commentlist.search")}">
 </form>
 
 
-    </td>
-  </tr>
+       </td>
+</tr>
 </table>
 
 
 
 <if data.contentlist>
 <table cellpadding="6" width="98%" class="litegrey">
-  <tr>
-    <td>
-     <p>${lang("start.content.hidden")} | ${lang("month")}: ${data.month} , ${lang("year")}:${data.year}</p>
-    </td>
-  </tr>
+<tr>
+       <td>
+       <p>${lang("start.content.hidden")} | ${lang("month")}: ${data.month} , ${lang("year")}:${data.year}</p>
+       </td>
+</tr>
 </table>
 
 <list data.contentlist as i>
-<p>
-${lang("content.title")}: <b>${i.title}</b><br>
-${lang("content.creator")}: ${i.creator}<br>
-${lang("message.date")}: ${i.webdb_create_formatted}<br>
-<br>
-<if i.to_media_audio >additional media, type: audio<br></if>
-<if i.to_media_video >additional media, type: video<br></if>
-<if i.to_media_other >additional media, type: other<br></if>
-<if i.to_media_images >additional media, type: image<br></if>
-</p>
-
-<p>
-${lang("content.abstract")}:<br>
-${i.description_parsed}</p>
-
-<p>
-${lang("content.content")}:<br>
-${i.content_data_parsed}
-</p>
-<p>&nbsp;</p>
-<hr size="4" width="98%" noshade>
-<p>&nbsp;</p>
-
+       <p
+               ${lang("content.title")}: <b>${i.title}</b><br>
+               ${lang("content.creator")}: ${i.creator}<br>
+               ${lang("message.date")}: ${i.webdb_create_formatted}<br>
+               <br>
+               <if i.to_media_audio >additional media, type: audio<br></if>
+               <if i.to_media_video >additional media, type: video<br></if>
+               <if i.to_media_other >additional media, type: other<br></if>
+               <if i.to_media_images >additional media, type: image<br></if>
+       </p>
+
+       <p>
+               ${lang("content.abstract")}:<br>
+               ${i.description_parsed}
+       </p>
+
+       <p>
+               ${lang("content.content")}:<br>
+               ${i.content_data_parsed}
+       </p>
+       <p>&nbsp;</p>
+       <hr size="4" width="98%" noshade>
+       <p>&nbsp;</p>
 </list>
 
-
-
 <else>
-  <tr><td align="center">${lang("no_matches_found")}</td></tr>
+       <tr><td><div class="box" align="center"><b>${lang("no_matches_found")}</b></div></td></tr>
 </if>
 
 
index 4d34c23..623e733 100755 (executable)
 <html>
-  <head>
-    <title>${config["Mir.Name"]} | ${lang("image.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  <head>
+<head>
+        <title>${config["Mir.Name"]} | ${lang("image.htmltitle")}</title>
+        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+<head>
+<SCRIPT LANGUAGE="JavaScript">
+function openWin(url) {
+   window.open(url,"vc","scrollbars=0,height=${data.img_height},width=${data.img_width}");
+}
+</SCRIPT>
 
-  <SCRIPT LANGUAGE="JavaScript">
-    function openWin(url) {
-       window.open(url,"vc","scrollbars=0,height=${data.img_height},width=${data.img_width}");
-    }
-  </SCRIPT>
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-  
-    <include "head.template">
+<include "FUNCTIONS.template">
+<include "head.template">
 
-    <if data.new>
-      <form action="${config.actionRoot}?module=Images&do=add" method="post">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
-        <table border="0">
-          <tr>
-            <td align="right" class="darkgrey">
-              <span class="witesmall">
-                <b>${lang("media.nr_of_media")}</b> <br>
-              </span>
-            </td>
-            <td>
-              <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
-            </td>
-          </tr>
-        </table>
-      </form>
-    </if>
-    <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Images&do=<if data.new>insert<else>update</if>">
-      <input type="hidden" name="where" value="${data.where}">
-      <input type="hidden" name="offset" value="${data.offset}">
-      <input type="hidden" name="order" value="${data.order}">
-      <input type="hidden" name="id" value="${data.id}">
-      
-      <if data.articleid>
-        <input type="hidden" name="articleid" value="${data.articleid}">
-      </if>
+<if data.new>
+<form action="${config.actionRoot}?module=Images&do=add" method="post">
 
-      <table border="0">
-        <if !data.new>
-        <tr>
-          <td align="right" class="darkgrey">
-          <if (data.icon_data!="" && data.icon_data!="0") && !new>
-          <span class="witesmall">
-            <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${data.id}')">
-            <img src="${config.actionRoot}?module=Images&do=getIcon&id=${data.id}" border=0></a></span></td>
-          </if>
-          <td valign="bottom"><span class="spezialtext">
-            ${lang("media.created")}: ${data.webdb_create} <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
-            <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
-            ${lang("media.format")}: ${data.media_descr} / ${data.img_width}x${data.img_height} / ${data.imgformatHashdata[to_img_format]["name"]} / ${data.imglayoutHashdata[to_img_layout]["name"]} /  ${data.imgcolorHashdata[to_img_color]["name"]}<br>
-            ${lang("media.size")}: ${data.human_readable_size}<br>
-            ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
-            ${lang("media.type")}: <b>${data.imgtypeHashdata[to_img_type]["name"]}</b><br>
-            </span>
-        </td>
-          </tr>
-        </if>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-          <B>${lang("media.mediafolder")}:</B></span></td>
-          <td>
-          <select name="to_media_folder">
-          <list extra.mediafolderPopupData as m>
-          <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
-            </list>
-            </select>
-          </td>
-        </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.description")}:</B></span></td>
-          <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
-          </tr>
-      
-        <tr>
-         <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.date")}:</B></span></td>
-          <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
-          <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
-          </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.location")}:</B></span></td>
-          <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
-          </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.creator")}:</B></span></td>
-          <td>
-          <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
-          </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.keywords")}:</B></span></td>
-          <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
-          </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.comment")}:</B></span></td>
-          <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
-          </tr>
-      
-        <tr>
-          <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.source")}:</B></span></td>
-          <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
-          </tr>
-        <if data.new>
-          <tr>
-            <td>
-              ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-            </td>
-          </tr>
-          <list data.mediafields as m>
-            <tr>
-              <td align="right" class="darkgrey">
-                <span class="witesmall">
-                  <b>${lang("media.title")}:<b>
-                </span>
-              </td>
-              <td>
-                <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
-              </td>
-            </tr>
-            <tr>
-              <td align="right" class="darkgrey"></td>
-              <td>
-                <input type="file" name="mpfile${m}"><br>
-              </td>
-            </tr>
-          </list>
-        <else>
-          <tr>
-            <td align="right" class="darkgrey"><span class="witesmall">
-              <b>${lang("media.title")}:<b>
-            </td>
-            <td>
-              <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
-            </td>
-          </tr>
-        </if>
-        <tr>
-          <td colspan="2" align="right">
-            <span class="text">
-              <if data.new>
-                <input type="submit" name="save" value="${lang("insert")}">
-              <else>
-                ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-                <input type="submit" name="save" value="${lang("save")}">
-              </if> 
-            </span>
-          </td>
-        </tr>
-      </form>
-    </table>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
+       
+       <table border="0">
+               <tr>
+                       <td align="right" class="table_left">
+                               <b>${lang("media.nr_of_media")} :</b><br>
+                       </td>
+                       <td class="listrow2">
+                               <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+                       </td>
+               </tr>
+       </table>
+</form>
+</if>
 
-    <include "foot.template">
-  </body>
+
+<form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Images&do=<if data.new>insert<else>update</if>&id=${data.id}">
+       
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
+
+       <input type="hidden" name="where" value="${data.where}">
+       <input type="hidden" name="offset" value="${data.offset}">
+       <input type="hidden" name="order" value="${data.order}">
+       <input type="hidden" name="id" value="${data.id}">
+
+       <table border="0">
+
+       <if !data.new>
+       <tr>
+       <td align="right" valign="top">
+                       <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${data.id}')">
+                       <img src="${config.actionRoot}?module=Images&do=getIcon&id=${data.id}" border=0></a>&nbsp;&nbsp;
+               </td>
+               <td valign="bottom" class="small">
+                       ${lang("media.created")}: ${data.webdb_create}
+                       <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
+                       <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
+                       ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
+                       ${lang("media.size")}: ${data.human_readable_size}<br>
+                       ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
+               </td>
+       </tr>
+       </if>
+
+       <tr>
+               <td align="right" class="table_left">
+                       <B>${lang("media.mediafolder")}:</B>
+               </td>
+               <td class="listrow2">
+                       <select name="to_media_folder">
+                       <list extra.mediafolderPopupData as m>
+                               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
+                       </list>
+               </select>
+               </td>
+       </tr>
+
+       <call TextInputTableRow (lang("media.description"), 40, 255, "description", data.description)>
+       <call TextInputTableRow (lang("media.date"), 8, 8, "date", data.date)>
+       <call TextInputTableRowLight (lang("year"), 20, 40, "year", data.year)>
+       <call TextInputTableRow (lang("media.location"), 40, 80, "place", data.place)>
+       <call TextInputTableRow (lang("media.creator"), 40, 80, "creator", data.creator)>
+       <call TextAreaTableRow (lang("media.keywords"), 40, 2, "keywords", data.keywords)>
+       <call TextAreaTableRow (lang("media.comment"), 40, 2, "comment", data.comment)>
+       <call TextInputTableRow (lang("media.source"), 40, 80, "source", data.source)>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
+       <if data.new>
+       <tr>
+               <td align="right" class="table_left">
+                       ${lang("media.is_published")} : 
+               </td>
+               <td class="listrow2" style='border: 1px solid #FF0000;'>
+                       <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>  
+               </td>
+       </tr>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
+       <list data.mediafields as m>
+       <tr>
+               <td align="right" class="table_left">
+                       <B>${lang("media.title")}:<B>
+                </td>
+               <td class="listrow2">
+                       <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
+               </td>
+       </tr>
+       <tr>
+               <td align="right">
+                       &nbsp;
+               </td>
+               <td class="listrow2">
+                       <INPUT TYPE="file" NAME="mpfile${m}"><br>
+               </td>
+       </tr>
+       </list>
+       <else>
+       <tr>
+               <td align="right" class="table_left">
+                       <B>${lang("media.title")}:<B>
+               </td>
+               <td class="listrow2">
+                       <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
+               </td>
+       </tr>
+       </if>
+
+    <td colspan="2" align="right" class="table_foot">
+       <if data.new>
+      <input type="submit" name="save" value="${lang("insert")}">
+    <else>
+     ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
+    &nbsp;&nbsp;<input type="submit" name="save" value="${lang("save")}">
+    </if> </form>
+    </td>
+</table>
+
+<p><a class="link_box" href="${config.actionRoot}?module=Images&do=list">[&lt;] ${lang("list")} </a> &nbsp;</p>
+
+<include "foot.template">
+</body>
 </html>
index 2ba619b..7359b0e 100755 (executable)
 <head>
        <title>${config["Mir.Name"]} | ${lang("imagelist.htmltitle")}</title>
         <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+<SCRIPT LANGUAGE="JavaScript">
+function openWin(url) {
+   window.open(url,"vc","scrollbars=1,height=400,width=300");
+}
+</SCRIPT>
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+
 <include "head.template">
+<include "FUNCTIONS_media.template">
+<call MediaSearch ("Images")>
 
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr>
-    <td colspan="5"><form method="post" action="${config.actionRoot}">
-       <input type="hidden" name="module" value="Images">
-       <input type="hidden" name="do" value="list">
-       <input type="hidden" name="cid" value="${data.cid}">
-       <table border="0">
-       <tr class="pink">
-               <td>${lang("medialist.search_text_in")}:</td>
-               <td>${lang("media.published")}:</td>
-               <td>${lang("media.mediafolder")}:</td>
-               <td>&nbsp;</td>
-       </tr>
-       
-       <tr>
-       <td>
-               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">
-               <select name="query_field">
-               <option value="title"<if data.query_field=="title"> selected</if>>${lang("media.title")}</option>
-               <option value="creator"<if data.query_field=="creator"> selected</if>>${lang("media.creator")}</option>
-               <option value="place"<if data.query_field=="place"> selected</if>>${lang("media.location")}</option>
-               <option value="keywords"<if data.query_field=="keywords"> selected</if>>${lang("media.keywords")}</option>
-       </select>
-       </td>
-       <td>
-               <select name="query_is_published">
-                   <option value="">${lang("dontcare")}</option>
-               <option value="0" <if data.query_is_published=="0"> selected</if>>${lang("no")}</option>
-                   <option value="1" <if data.query_is_published=="1"> selected</if>>${lang("yes")}</option>
-           </select>
-       </td>
-       <td>
-       <select name="query_media_folder">
-       <list extra.mediafolderPopupData as m>
-       <option value="${m.key}" <if m.key == data.query_media_folder>selected</if>>${m.value}</option>
-       </list>
-       </select>
-       </td>
-       <td>
-               <input type="submit" name="search" value="filter">      
-       </td>
-       </tr>   
-       </table>
-       </form>
-       </td>
-  </tr>
+<table>
+
+  <tr class="darkgrey" >
+       <td class="table_head">
+       <b>${lang("media.icon")}</b></td>
+       <td class="table_head">
+       <b>${lang("media.title")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.format")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.size")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.mediafolder")}</b></td>
+    <td class="table_head">
+       <b>${lang("media.creator")}</b></td>
+    <td class="table_head">
+       &nbsp;</td>
 
-  <tr class="darkgrey">
-       <td><span class="witesmall">
-       <b>${lang("media.icon")}</b></span></td>
-       <td><span class="witesmall">
-       <b>${lang("media.title")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.format")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.size")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.mediafolder")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.creator")}</b></span></td>
-  </tr>
-  <if data.contentlist>
-  <list data.contentlist as entry>
-  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
-  <td>
-       <if entry.icon_data!="" && entry.icon_data!="0">
-       <a href="${config.actionRoot}?module=Images&do=getMedia&id=${entry.id}" target="new">
-         <img src="${config.actionRoot}?module=Images&do=getIcon&id=${entry.id}" border=0></a></span></td>
-       </if>
-  <td>${entry.title}&nbsp;
-         <if entry.description><br>${entry.description}</if></td>
-  <td>${entry.media_descr}&nbsp;</td>
-  <td>${entry.human_readable_size}&nbsp;</td>
-  <td>${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;</td>
-  <td>${entry.creator}&nbsp;</td>
-  <td><span class="text">&nbsp;
-       <if data.cid><a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
-       <else>
-       <a href="${config.actionRoot}?module=Images&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=Images&do=edit&id=${entry.id}">${lang("edit")}</a>
-       </if>
-       </span></td>
-  </tr>
-  </list>
-  <tr>
-    <td colspan="4" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-      / ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
   </tr>
+       <if data.contentlist>
+       <list data.contentlist as entry>
+       <tr <if grey=="1"><assign grey="0">class="listrow1"<else>class="listrow2"<assign grey="1"> </if>>
+               <td>
+                       <if entry.icon_data!="" && entry.icon_data!="0">
+                               
+                               <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${entry.id}')">
+                               <img src="${config.actionRoot}?module=Images&do=getIcon&id=${entry.id}" border=0></a>
+                               
+                       </if>
+               </td>
+               <td>
+                       ${entry.title}&nbsp;
+                       <if entry.description><br>${entry.description}</if>
+               </td>
+               <td>
+                       ${entry.media_descr}&nbsp;
+               </td>
+               <td>
+                       ${entry.human_readable_size}&nbsp;
+               </td>
+               <td>
+                       ${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;
+               </td>
+               <td>
+                       ${entry.creator}&nbsp;
+               </td>
+               <td>&nbsp;
+                       <if data.cid>
+                               <a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
+                       <else>
+                               <a href="${config.actionRoot}?module=Images&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
+                       | <a href="${config.actionRoot}?module=Images&do=edit&id=${entry.id}">${lang("edit")}</a>
+                       </if>
+               </td>
+       </tr>
+       </list>
+       <tr>
+               <td colspan="7" class="table_foot">
+                       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
+               </td>
+       </tr>
+
+       <tr>
+               <td>
+                       <if data.prev>
+                               <a href="${config.actionRoot}?module=Images&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">${lang("list.previous")}</a>&nbsp;
+                       </if>
+                       <if data.next>
+                               <a href="${config.actionRoot}?module=Images&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">${lang("list.next")}</a>
+                       </if>
+               </td>
+       </tr>
 
-<tr><td>
-<if data.prev>
-       <a href="${config.actionRoot}?module=Images&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">zurueck</a>&nbsp;
-</if>
-<if data.next>
-<a href="${config.actionRoot}?module=Images&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">weiter</a>
-</if>
-</td></tr>
 <else>
-  <tr><td align="center">${lang("no_matches_found")}</td></tr>
+  <tr><td align="center" class="box" colspan="7">${lang("no_matches_found")}</td></tr>
 </if>
 </table>
+
 <include "foot.template">
 </body>
 </html>
index a224f1d..b513a25 100755 (executable)
                        <p>
                          <b>${lang("infomessage."+message, argument1, argument2)}<b>
                        <p>
+                       <p>
+                               <br>
+                               <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>&nbsp;&nbsp;&nbsp;
+                               
+                       </p>
+                       
                </td>
        </tr>
 </table>
index 1581f88..50e73bb 100755 (executable)
@@ -5,40 +5,29 @@
 <head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+<include "FUNCTIONS.template">
 <include "head.template">
+
 <form action="${config.actionRoot}" method="post">
        <input type="hidden" name="module" value="Language">
        <input type="hidden" name="id" value="${data.id}">
        <if data.new><input type="hidden" name="do" value="insert">
        <else><input type="hidden" name="do" value="update"></if>
 <table border="0">
-
-  <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("language.name")}:</B></span></td>
-    <td>
-         <input type="text" name="name" size="30" value="${data.name}">
-    </td>
-  </tr>
-
-  <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("language.code")}:</B></span></td>
-    <td>
-         <input type="text" name="code" size="2" maxlength="2" value="${data.code}">
-    </td>
-  </tr>
-
-
+               <call TextInputTableRow (lang("language.name"), 30, 255, "name", data.name)>
+               <call TextInputTableRow (lang("language.code"), 2, 2,"code", data.code)>
   <tr>
-    <td colspan="2" align="right"> <span class="witetext"><if data.new>
+    <td class="table_foot" colspan="2" align="right"> 
+       <if data.new>
       <input type="submit" name="save" value="${lang("insert")}">
     <else>
       <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
-    </td>
+    </if>
+       </td>
+       </tr>
 </table>
+</form>
+<p><a class="link_box" href="${config.actionRoot}?module=Language&do=list">[&lt;] ${lang("back")} </a> &nbsp;</p>
 <include "foot.template">
 </body>
 </html>
index 4a4f0ea..3e61489 100755 (executable)
@@ -4,56 +4,33 @@
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
   </head>
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+
+       <include "FUNCTIONS.template">
+  
     <include "head.template">
 
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Language&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+               <comment>configure this template here</comment>
+               <assign contentlist = data.contentlist>
+               <assign column_nr = 3>
+               <assign data_keys = ["name","code"]>
+               <assign column_head_texts = [lang("language.name"), lang("language.code")]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "Language">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "superusermenu">
 
     <if data.contentlist>
-      <table border="0" cellpadding="2" cellspacing="1">
-        <tr class="darkgrey">
-          <td><span class="witesmall"><b>${lang("language.name")}</b></span></td>
-          <td><span class="witesmall"><b>${lang("language.code")}</b></span></td>
-               <td>&nbsp;</td>
-        </tr>
-      
-        <list data.contentlist as entry>
-          <if grey=="1"><assign grey="0"><tr class="list1"><else><tr class="list2"><assign grey="1"></if>
-            <td>${entry.name}&nbsp;</td>
-            <td>${entry.code}&nbsp;</td>
-            <td>
-              <span class="text">&nbsp;
-                <a href="${config.actionRoot}?module=Language&do=delete&id=${entry.id}">${lang("delete")}</a> | 
-                <a href="${config.actionRoot}?module=Language&do=edit&id=${entry.id}">${lang("edit")}</a>
-              </span>
-            </td>
-          </tr>
-        </list>
-        <tr>
-          <td colspan="3" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-            / ${lang("show_from_to", data.from, data.to)}</span></td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>
-      
-      <p>
-      <if data.prev>
-         <a href="${config.actionRoot}?module=Language&do=list&where=${data.where}&prevoffset=${data.prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;
-      </if>
-      <if data.next>
-      <a href="${config.actionRoot}?module=Language&do=list&where=${data.where}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
-      </if>
-    <else>
-      <P align="center">${lang("no_matches_found")}</p>
+               <call AddOrBack(module_name, module_jumpback, do_jumpback)>
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>   
+               <call PrevNextPage(module_name)>          
+   <else>
+               <P align="center">${lang("no_matches_found")}</p>
     </if>
-
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Language&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
-
+    
+       <call AddOrBack(module_name, module_jumpback, do_jumpback)>
     <include "foot.template">
   </body>
 </html>
index bdde488..1caa012 100755 (executable)
-<html>\r
-<head>\r
-       <title>${config["Mir.Name"]} | ${lang("linkimcslist.htmltitle")}</title>\r
-        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">\r
-</head>\r
-\r
-<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">\r
-\r
-<include "head.template">\r
-\r
-<form method="post" action="${config.actionRoot}">\r
-       <input type="hidden" name="module" value="LinksImcs">\r
-       <input type="hidden" name="do" value="list">\r
-       <input type="hidden" name="cid" value="">\r
-       <table border="0">\r
-       <tr class="pink">\r
-               <td>${lang("linkimcslist.search_in")}:</td>\r
-               <td>${lang("linkimcs.parent")}:</td>\r
-               <td>${lang("linkimcs.language")}:</td>\r
-               <td>&nbsp;</td>\r
-       </tr>\r
-       \r
-       <tr>\r
-       <td>\r
-               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">\r
-               <select name="query_field">\r
-                       <option value="title"<if data.query_field == "title"> selected</if>>${lang("linkimcs.name")}\r
-                       <option value="url"<if data.query_field == "url"> selected</if>>${lang("linkimcs.url")}\r
-       </select>\r
-       </td>\r
-       <td>\r
-               <select name="to_parent_id">\r
-                       <option value=""></option>\r
-                   <list data.parentlist as parent><option value="${parent.id}"<if to_parent_id == parent.id> selected</if>>${parent.title}</option>\r
-                       </list>\r
-           </select>\r
-       </td>\r
-       <td>\r
-               <select name="to_language">\r
-                       <option value="">${lang("all")}</option>\r
-                       <list data.languagelist as language><option value="${language.id}"<if to_language == language.id> selected</if>>${language.name}</option>\r
-                       </list> \r
-               </select>\r
-       </td>\r
-       <td>\r
-               <input type="submit" name="search" value="${lang("filter")}">\r
-       </td>\r
-       </tr>   \r
-       </table>\r
-       </form>\r
-       \r
-<if data.imcslist>\r
-<table border="0">\r
-  <tr class="darkgrey">\r
-    <td><span class="witesmall">\r
-               <b>${lang("linkimcs.name")}</b></span></td>\r
-    <td><span class="witesmall">\r
-               <b>${lang("linkimcs.parent")}</b></span></td>\r
-       <td><span class="witesmall">\r
-               <b>${lang("linkimcs.url")}</b></span></td>\r
-       <td><span class="witesmall">\r
-               <b>${lang("linkimcs.sort_by")}</b></span></td>\r
-       <td><span class="witesmall">\r
-               <b>${lang("linkimcs.language")}</b></span></td>\r
-       <td><span class="witesmall">\r
-               <b>&nbsp;</b></span></td>\r
-  </tr>\r
-  <list data.imcslist as entry>\r
-  <assign parent = "">\r
-  <assign language = "">\r
-  <list data.parentlist as p>\r
-               <if entry.to_parent_id == p.id><assign parent = p.title></if>\r
-  </list>\r
-  <list data.languagelist as l>\r
-               <if entry.to_language == l.id><assign language = l.name></if>\r
-  </list>\r
-\r
-  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>\r
-       <td><span class="small">${entry.title}&nbsp;</span></td>\r
-       <td><span class="small">${parent}</span></td>\r
-       <td><span class="small">${entry.url}</span></td>\r
-       <td><span class="small">${entry.sortpriority}</span></td>\r
-       <td><span class="small">${data.language}</span></td>\r
-       <td><span class="text">&nbsp;<a href="${actionRoot}?module=LinksImcs&do=delete&id=${entry.id}">${lang("delete")}</a>\r
-       | <a href="${actionRoot}?module=LinksImcs&do=edit&id=${entry.id}">${lang("edit")}</a></span>\r
-       </td>\r
-  </tr>\r
-  </list>\r
-  <tr>\r
-  <td colspan="6" class="darkgrey"><span class="witesmall">\r
-       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}</span></td>\r
-  <td>&nbsp;</td>\r
-  </tr>\r
-</table>\r
-<P>\r
-<if data.prev>\r
-       <a href="${config.actionRoot}?module=LinksImcs&do=list&order=${data.order}&query_text=${data.query_text_encoded}&query_field=${data.query_field}&to_parent_id=${data.to_parent_id}&to_language=${data.to_language}&prevoffset=${data.prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;\r
-</if>\r
-<if data.next>\r
-<a href="${config.actionRoot}?module=LinksImcs&do=list&order=${data.order}&query_text=${data.query_text_encoded}&query_field=${data.query_field}&to_parent_id=${data.to_parent_id}&to_language=${data.to_language}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>\r
-</if>\r
-\r
-<else>\r
-  <P align="center">${lang("no_matches_found")}</p>\r
-</if>\r
-<include "foot.template">\r
-</body>\r
-</html>
\ No newline at end of file
+<html>
+<head>
+       <title>${config["Mir.Name"]} | ${lang("linkimcslist.htmltitle")}</title>
+        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+</head>
+
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+
+<include "head.template">
+
+<form method="post" action="${config.actionRoot}">
+       <input type="hidden" name="module" value="LinksImcs">
+       <input type="hidden" name="do" value="list">
+       <input type="hidden" name="cid" value="">
+       <table border="0">
+       <tr class="table_head">
+               <td>${lang("linkimcslist.search_in")}:</td>
+               <td>${lang("linkimcs.parent")}:</td>
+               <td>${lang("linkimcs.language")}:</td>
+               <td>&nbsp;</td>
+       </tr>
+       
+       <tr>
+       <td>
+               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">
+               <select name="query_field">
+                       <option value="title"<if data.query_field == "title"> selected</if>>${lang("linkimcs.name")}
+                       <option value="url"<if data.query_field == "url"> selected</if>>${lang("linkimcs.url")}
+       </select>
+       </td>
+       <td>
+               <select name="to_parent_id">
+                       <option value=""></option>
+                   <list data.parentlist as parent><option value="${parent.id}"<if to_parent_id == parent.id> selected</if>>${parent.title}</option>
+                       </list>
+           </select>
+       </td>
+       <td>
+               <select name="to_language">
+                       <option value="">${lang("all")}</option>
+                       <list data.languagelist as language><option value="${language.id}"<if to_language == language.id> selected</if>>${language.name}</option>
+                       </list> 
+               </select>
+       </td>
+       <td>
+               <input type="submit" name="search" value="${lang("filter")}">
+       </td>
+       </tr>   
+       </table>
+       </form>
+       
+<if data.imcslist>
+<table border="0">
+  <tr class="darkgrey">
+    <td><span class="witesmall">
+               <b>${lang("linkimcs.name")}</b></span></td>
+    <td><span class="witesmall">
+               <b>${lang("linkimcs.parent")}</b></span></td>
+       <td><span class="witesmall">
+               <b>${lang("linkimcs.url")}</b></span></td>
+       <td><span class="witesmall">
+               <b>${lang("linkimcs.sort_by")}</b></span></td>
+       <td><span class="witesmall">
+               <b>${lang("linkimcs.language")}</b></span></td>
+       <td><span class="witesmall">
+               <b>&nbsp;</b></span></td>
+  </tr>
+  <list data.imcslist as entry>
+  <assign parent = "">
+  <assign language = "">
+  <list data.parentlist as p>
+               <if entry.to_parent_id == p.id><assign parent = p.title></if>
+  </list>
+  <list data.languagelist as l>
+               <if entry.to_language == l.id><assign language = l.name></if>
+  </list>
+
+  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
+       <td><span class="small">${entry.title}&nbsp;</span></td>
+       <td><span class="small">${parent}</span></td>
+       <td><span class="small">${entry.url}</span></td>
+       <td><span class="small">${entry.sortpriority}</span></td>
+       <td><span class="small">${data.language}</span></td>
+       <td><span class="text">&nbsp;<a href="${actionRoot}?module=LinksImcs&do=delete&id=${entry.id}">${lang("delete")}</a>
+       | <a href="${actionRoot}?module=LinksImcs&do=edit&id=${entry.id}">${lang("edit")}</a></span>
+       </td>
+  </tr>
+  </list>
+  <tr>
+  <td colspan="6" class="darkgrey"><span class="witesmall">
+       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}</span></td>
+  <td>&nbsp;</td>
+  </tr>
+</table>
+<P>
+<if data.prev>
+       <a href="${config.actionRoot}?module=LinksImcs&do=list&order=${data.order}&query_text=${data.query_text_encoded}&query_field=${data.query_field}&to_parent_id=${data.to_parent_id}&to_language=${data.to_language}&prevoffset=${data.prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;
+</if>
+<if data.next>
+<a href="${config.actionRoot}?module=LinksImcs&do=list&order=${data.order}&query_text=${data.query_text_encoded}&query_field=${data.query_field}&to_parent_id=${data.to_parent_id}&to_language=${data.to_language}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
+</if>
+
+<else>
+  <P align="center">${lang("no_matches_found")}</p>
+</if>
+<include "foot.template">
+</body>
+</html>
index 86f8446..e5aeaa6 100755 (executable)
@@ -3,7 +3,6 @@
   <head>
     <title>${config["Mir.Name"]} | ${lang("login.htmltitle")}</title>
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-    <meta http-equiv="Content-Type" content="text/html; charset=${lang("htmlcharset")}">
     <script language="JavaScript">
       function placeFocus() {
         document.forms[0].elements[1].focus();
     </script>
   </head>
   <body onLoad="placeFocus()" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-    <include "head_nonavi.template">
-    <center>
+    
+       <include "head_nonavi.template">
+
+<center>
       <p>
-        <span class="small">
           ${lang("login.info", 
                  "<a href=\"mailto:" + config["Mir.Contact-email.address"] +
-                 "\"><span class=\"spezialtext\">" + 
+                 "\">" + 
                  config["Mir.Contact-email.name"] + 
-                 "</span></a>"
+                 "</a>"
                  )
            }
-        </span>
       </p>
-           <hr>
+           
+               <hr>
+<div style="width:300px;">
 
+       <div class="box_head"><b>${lang("login.title")}</b></div>
+       
+       <div class="box">
+               
+               
       <form method="post" action="${config.actionRoot}">
-        <input type="hidden" name="module" value="login">
-        <table border="0" cellpadding="2" cellspacing="0" class="dark">
-          <tr class="darkgrey">
-            <td colspan="2" align="center">
-              <span class="witetext">
-                <b>${lang("login.title")}</b>
-              </span>
-            </td>
-          </tr>
-          <tr>
-            <td align="right">
-              <span class="witetext">${lang("login.name")}</span>
-            </td>
-            <td>
-              <input type="text" name="login" size="15">
-            </td>
-          </tr>
-          <tr>
-            <td align="right">
-              <span class="witetext">${lang("login.password")}</span>
-            </td>
-            <td>
-              <input type="password" name="password" size="15">
-            </td>
-          </tr>
-          <tr>
-            <td align="right">
-              <span class="witetext">${lang("login.language")}</span>
-            </td>
-            <td>
-              <select name="language">
-                <list data.languages as l>
-                  <option value="${l.code}" <if l.code==data.defaultlanguage>selected</if> >${l.name}</option>
-                </list>
-              </select>
-            </td>
-          </tr>
-          <tr>
-            <td align="left">&nbsp;</td>
-            <td align="left">
-              <input type="submit" value="${lang("login.submit")}">
-            </td>
-          </tr>
-        </table>
+        
+               <input type="hidden" name="module" value="login">
+
+               <table cellpadding="4">
+               <tbody>
+                       <tr>
+                       <td align="right">${lang("login.name")}:</td>
+                       <td align="left"><input type="text" name="login" size="15"></td>
+                       </tr>
+                       <tr>
+                       <td align="right">${lang("login.password")}:</td>
+                       <td align="left"><input type="password" name="password" size="15"></td>
+                       </tr>
+                       <tr>
+                       <td align="right">${lang("login.language")}:</td>
+                       <td align="left">  
+                               <select name="language">
+                               <list data.languages as l>
+                                       <option value="${l.code}" <if l.code==data.defaultlanguage>selected</if> >${l.name}</option>
+                               </list>
+                               </select>
+                       </td>
+                       </tr>  
+               <tr>
+                       <td colspan="2" align="right">
+                               <input type="submit" value="${lang("login.submit")}">
+                       </td>
+               </tr>
+               </tbody>
+               </table>                
+
       </form>
-    </center>
+       </div>
+</div>
+<br>
+</center>
+         
          <include "foot.template">
+  
   </body>
 </html>
 
index 434bfd5..07e711e 100755 (executable)
@@ -11,31 +11,34 @@ function openWin(url) {
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+<include "FUNCTIONS.template">
 <include "head.template">
 
 <if data.new>
 <form action="${config.actionRoot}?module=OtherMedia&do=add" method="post">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
+       
        <table border="0">
-       <tr>
-       <td align="right" class="darkgrey">
-       <span class="witesmall">
-       <b>${lang("media.nr_of_media")}</b> <br>
-       </span>
-       </td>
-       <td>
-       <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
-       </td>
-       </tr>
+               <tr>
+                       <td align="right" class="table_left">
+                               <b>${lang("media.nr_of_media")} :</b><br>
+                       </td>
+                       <td class="listrow2">
+                               <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+                       </td>
+               </tr>
        </table>
 </form>
 </if>
+
+
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=OtherMedia&do=<if data.new>insert<else>update</if>&id=${data.id}">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">
@@ -45,121 +48,99 @@ function openWin(url) {
 
        <if !data.new>
        <tr>
-    <td align="right" class="darkgrey">
-               <span class="witesmall">
+       <td align="right" valign="top">
                        <a href="${config.actionRoot}?module=OtherMedia&do=getMedia&id=${data.id}">
-                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
-    <td valign="bottom"><span class="spezialtext">
-               ${lang("media.created")}: ${data.webdb_create}
-        <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
-               <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
-               ${lang("media.format")}: ${data.mimetype}<br>
-               ${lang("media.size")}: ${data.human_readable_size}<br>
-               ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
-       </td>
+                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a>&nbsp;&nbsp;
+               </td>
+               <td valign="bottom" class="small">
+                       ${lang("media.created")}: ${data.webdb_create}
+                       <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
+                       <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
+                       ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
+                       ${lang("media.size")}: ${data.human_readable_size}<br>
+                       ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
+               </td>
        </tr>
        </if>
 
        <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.mediafolder")}:</B></span></td>
-    <td>
-               <select name="to_media_folder">
-               <list extra.mediafolderPopupData as m>
-               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
-               </list>
-           </select>
-       </td>
+               <td align="right" class="table_left">
+                       <B>${lang("media.mediafolder")}:</B>
+               </td>
+               <td class="listrow2">
+                       <select name="to_media_folder">
+                       <list extra.mediafolderPopupData as m>
+                               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
+                       </list>
+               </select>
+               </td>
        </tr>
 
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.description")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.date")}:</B></span></td>
-    <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
-               <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.location")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.creator")}:</B></span></td>
-    <td>
-               <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.keywords")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.comment")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.source")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
-       </tr>
-       <tr>
+       <call TextInputTableRow (lang("media.description"), 40, 255, "description", data.description)>
+       <call TextInputTableRow (lang("media.date"), 8, 8, "date", data.date)>
+       <call TextInputTableRowLight (lang("year"), 20, 40, "year", data.year)>
+       <call TextInputTableRow (lang("media.location"), 40, 80, "place", data.place)>
+       <call TextInputTableRow (lang("media.creator"), 40, 80, "creator", data.creator)>
+       <call TextAreaTableRow (lang("media.keywords"), 40, 2, "keywords", data.keywords)>
+       <call TextAreaTableRow (lang("media.comment"), 40, 2, "comment", data.comment)>
+       <call TextInputTableRow (lang("media.source"), 40, 80, "source", data.source)>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
        <if data.new>
        <tr>
-       <td>
-               ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-       </td>
+               <td align="right" class="table_left">
+                       ${lang("media.is_published")} : 
+               </td>
+               <td class="listrow2" style='border: 1px solid #FF0000;'>
+                       <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>  
+               </td>
        </tr>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
        <list data.mediafields as m>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
-
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
-               </font> </td>
-               <td>
+                </td>
+               <td class="listrow2">
                        <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
                </td>
-               </tr>
-               <tr>
-               <td align="right" class="darkgrey"></td>
-               <td>
-                               <INPUT TYPE="file" NAME="mpfile${m}"><br>
+       </tr>
+       <tr>
+               <td align="right">
+                       &nbsp;
                </td>
-               </tr>
+               <td class="listrow2">
+                       <INPUT TYPE="file" NAME="mpfile${m}"><br>
+               </td>
+       </tr>
        </list>
        <else>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
                </td>
-               <td>
+               <td class="listrow2">
                        <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
                </td>
-               </tr>
+       </tr>
        </if>
 
-    <td colspan="2" align="right"> <span class="text">
+    <td colspan="2" align="right" class="table_foot">
        <if data.new>
       <input type="submit" name="save" value="${lang("insert")}">
     <else>
      ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
+    &nbsp;&nbsp;<input type="submit" name="save" value="${lang("save")}">
+    </if> </form>
     </td>
 </table>
+
+<p><a class="link_box" href="${config.actionRoot}?module=OtherMedia&do=list">[&lt;] ${lang("list")} </a> &nbsp;</p>
+
 <include "foot.template">
+
 </body>
 </html>
index 6d4060f..85e5145 100755 (executable)
@@ -6,47 +6,38 @@
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+<include "FUNCTIONS.template">  
 <include "head.template">
+
 <form method="post" action="${config.actionRoot}">
        <input type=hidden name=module value=Mediafolder>
        <input type="hidden" name="id" value="${data.id}">
        <if data.new> <input type="hidden" name="do" value="insert">
        <else>   <input type="hidden" name="do" value="update"></if>
 
-<table border="0">
-
-  <tr> 
-    <td align="right" class="darkgrey"><span class="witetext"><B>${lang("mediafolder.date")}:</B></span></td>
-    <td><input type="text" size="8" maxsize="8" name="date" value="${data.date}"></td>
-  </tr>
+<table border="0" cellspacing="2" cellpadding="2">
+<call TextInputTableRow (lang("mediafolder.date"), 8, 8, "date", data.date)>
+<call TextInputTableRow (lang("mediafolder.name"), 40, 80, "name", data.name)>  
+<call TextInputTableRow (lang("mediafolder.location"), 40, 80, "place", data.place)>  
+<call TextAreaTableRow (lang("mediafolder.comment"), 40, 5, "comment", data.comment)>  
+<call TextAreaTableRow (lang("mediafolder.keywords"), 40, 4, "keywords", data.keywords)>  
 
-  <tr>
-    <td align="right" class="darkgrey"><span class="witetext"><B>${lang("mediafolder.name")}:</B></span></td>
-    <td><input type="text" size="40" name="name" value="${data.name}"></td>
-  </tr>
 
   <tr>
-    <td align="right" class="darkgrey"><span class="witetext"><B>${lang("mediafolder.location")}:</B></span></td>
-    <td><input type="text" size="40" name="place" value="${data.place}"></td>
-  </tr>
-
-  <tr>
-    <td align="right" class="darkgrey"><span class="witetext"><B>${lang("mediafolder.comment")}:</B></span></td>
-    <td><textarea cols="40" rows="5" name="comment">${data.comment}</textarea></td>
-  </tr>
-
-  <tr>
-    <td align="right" class="darkgrey"><span class="witetext"><B>${lang("mediafolder.keywords")}:</B></span></td>
-    <td><textarea cols="40" rows="4" name="keywords">${data.keywords}</textarea></td>
-  </tr>
-
-  <tr>
-    <td colspan="4" align="right"> <span class="witetext">
+    <td colspan="4" align="right" class="table_foot"> 
                <if data.new> <input type="submit" name="save" value="${lang("insert")}">
        <else>   <input type="submit" name="save" value="${lang("save")}"></if>
-               </span></form></span>
+               
     </td>
+  </tr>
 </table>
+
+</form>
+    <p>      
+      <a class="link_box" href="${config.actionRoot}?module=Mediafolder&do=list">[&lt;] ${lang("list")} </a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+
 <include "foot.template">
 </body>
 </html>
index b0361c9..371fce8 100755 (executable)
 <if data.contentlist>
        <table border="0">
                <tr class="darkgrey">
-               <td><span class="witetext"><b>${lang("mediafolder.date")}</b></span></td>
-                   <td><span class="witetext"><b>${lang("mediafolder.name")}</b></span></td>
-               <td><span class="witetext"><b>${lang("mediafolder.location")}</b></span></td>
-                       <td><span class="witetext"><b>${lang("mediafolder.comment")}</b></span></td>
-                       <td><span class="witetext"><b>${lang("mediafolder.keywords")}</b></span></td>
+               <td class="table_head">${lang("mediafolder.date")}</td>
+                   <td class="table_head">${lang("mediafolder.name")}</td>
+               <td class="table_head">${lang("mediafolder.location")}</td>
+                       <td class="table_head">${lang("mediafolder.comment")}</td>
+                       <td class="table_head">${lang("mediafolder.keywords")}</td>
+                       <td class="table_head">&nbsp;</td>
                 </tr>
          <list data.contentlist as entry>
-                 <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
+                 <tr <if grey=="1"><assign grey="0">class="listrow1"<else>class="listrow2"<assign grey="1"> </if>>
                        <td>${entry.date}&nbsp;</td>
                        <td><b>${entry.name}</b>&nbsp;</td>
                        <td>${entry.place}&nbsp;</td>
                        <td>${entry.comment}&nbsp;</td>
                        <td>${entry.keywords}&nbsp;</td>
-                       <td><span class="text"><a href="${config.actionRoot}?module=Mediafolder&do=delete&id=${entry.id}">${lang("delete")}</a>
+                       <td><a href="${config.actionRoot}?module=Mediafolder&do=delete&id=${entry.id}">${lang("delete")}</a>
                        | <a href="${config.actionRoot}?module=Mediafolder&do=edit&id=${entry.id}">${lang("edit")}</a>
-                               | <a href="${config.actionRoot}?module=Images&do=list&query_media_folder=${entry.id}">${lang("list")}</a></span></td>
+                               | <a href="${config.actionRoot}?module=Images&do=list&query_media_folder=${entry.id}">${lang("list")}</a></td>
                  </tr>
          </list>
                <tr>
-       <td colspan="5" class="darkgrey"><span class="witetext">${data.count} ${lang("records")} /
-        ${lang("show_from_to", data.from, data.to)}</span></td>
+       <td colspan="6" class="table_foot">${data.count} ${lang("records")} /
+        ${lang("show_from_to", data.from, data.to)}</td>
        <td>&nbsp;</td>
                </tr>
        </table>
        <a href="${config.actionRoot}?module=Mediafolder&do=list&where=${data.where}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
        </if>
 <else>
-  <P align="center">${lang("no_matches_found")}</p>
+  <P align="center" class="box">${lang("no_matches_found")}</p>
 </if>
+
+    <p>
+      <a class="link_box" href="${config.actionRoot}?module=Mediafolder&do=add">[+] ${lang("add")}</a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+
 <include "foot.template">
 </body>
 </html>
index c23eb0a..144e31d 100755 (executable)
 <html>
 <head>
-       <title>${config["Mir.Name"]} | ${lang("other_media.htmltitle")}</title>
+       <title>${config["Mir.Name"]} | ${lang("other_medialist.htmltitle")}</title>
         <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+<include "FUNCTIONS_media.template">
+<call MediaSearch ("OtherMedia")>
+<p>&nbsp;</p>
+<call MediaList   ("OtherMedia")>
 
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr>
-    <td colspan="5"><form method="post" action="${config.actionRoot}">
-       <input type="hidden" name="module" value="OtherMedia">
-       <input type="hidden" name="do" value="list">
-       <input type="hidden" name="cid" value="${data.cid}">
-       <table border="0">
-       <tr class="pink">
-               <td>${lang("medialist.search_text_in")}:</td>
-               <td>${lang("media.published")}:</td>
-               <td>${lang("media.mediafolder")}:</td>
-               <td>&nbsp;</td>
-       </tr>
-
-       <tr>
-       <td>
-               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">
-               <select name="query_field">
-               <option value="title"<if data.query_field=="title"> selected</if>>${lang("media.title")}</option>
-               <option value="creator"<if data.query_field=="creator"> selected</if>>${lang("media.creator")}</option>
-               <option value="place"<if data.query_field=="place"> selected</if>>${lang("media.location")}</option>
-               <option value="keywords"<if data.query_field=="keywords"> selected</if>>${lang("media.keywords")}</option>
-       </select>
-       </td>
-       <td>
-               <select name="query_is_published">
-                   <option value="">${lang("dontcare")}</option>
-               <option value="0" <if data.query_is_published=="0"> selected</if>>${lang("no")}</option>
-                   <option value="1" <if data.query_is_published=="1"> selected</if>>${lang("yes")}</option>
-           </select>
-       </td>
-       <td>
-       <select name="query_media_folder">
-       <list extra.mediafolderPopupData as m>
-       <option value="${m.key}" <if m.key == data.query_media_folder>selected</if>>${m.value}</option>
-       </list>
-       </select>
-       </td>
-       <td>
-               <input type="submit" name="search" value="${lang("filter")}">
-       </td>
-       </tr>
-       </table>
-       </form>
-       </td>
-  </tr>
-
-  <tr class="darkgrey">
-       <td><span class="witesmall">
-       <b>${lang("media.icon")}</b></span></td>
-       <td><span class="witesmall">
-       <b>${lang("media.title")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.format")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.size")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.mediafolder")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.creator")}</b></span></td>
-  </tr>
-  <if data.contentlist>
-  <list data.contentlist as entry>
-  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"></if>>
-  <td>
-         <a href="${config.actionRoot}?module=OtherMedia&do=getMedia&id=${entry.id}">
-         <img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
-  <td>${entry.title}&nbsp;
-         <if entry.description><br>${entry.description}</if></td>
-  <td>${entry.media_descr}&nbsp;</td>
-  <td>${entry.human_readable_size}&nbsp;</td>
-  <td>${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;</td>
-  <td>${entry.creator}&nbsp;</td>
-  <td><span class="text">&nbsp;
-       <if data.cid><a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
-       <else>
-       <a href="${config.actionRoot}?module=OtherMedia&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=OtherMedia&do=edit&id=${entry.id}">${lang("edit")}</a>
-       </if>
-       </span></td>
-  </tr>
-  </list>
-  <tr>
-    <td colspan="4" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-      / ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
-  </tr>
-
-<tr><td>
-<if data.prev>
-       <a href="${config.actionRoot}?module=OtherMedia&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">zurueck</a>&nbsp;
-</if>
-<if data.next>
-<a href="${config.actionRoot}?module=OtherMedia&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">weiter</a>
-</if>
-</td></tr>
-<else>
-  <tr><td align="center">${lang("no_matches_found")}</td></tr>
-</if>
-</table>
 <include "foot.template">
 </body>
 </html>
index d2bd155..bf99bcd 100755 (executable)
@@ -5,54 +5,59 @@
 <head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+<include "FUNCTIONS.template">
 <include "head.template">
+
+
 <form action="${config.actionRoot}" method="post">
        <input type="hidden" name="module" value="Message">
        <input type="hidden" name="id" value="${data.id}">
-       <if data.new><input type="hidden" name="do" value="insert">
-       <else><input type="hidden" name="do" value="update"></if>
+       <if data.new>
+               <input type="hidden" name="do" value="insert">
+       <else>
+               <input type="hidden" name="do" value="update">
+       </if>
+       
 <table border="0">
+  
   <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("message.date")}:</B></span></td>
+    <td align="right" class="table_left">
+       ${lang("message.date")}:</td>
     <td>
       ${data.date}
     </td>
   </tr>
 
-  <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("message.title")}:</B></td>
-    <td>
-        <input type=text name="title" maxlength=40 value="${data.title}">
-    </td>
-  </tr>
-
-  <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("message.creator")}:</B></td>
-    <td>
-        <input type=text name="creator" maxlength=40 value="${data.creator}">
-    </td>
-  </tr>
+  
+  <call TextInputTableRow (lang("message.title"), 30, 30, "title", data.title)> 
+  <call TextInputTableRow (lang("message.creator"), 12, 30, "creator", data.creator)> 
+  <call TextAreaTableRow  (lang("message.text"), 50, 5, "description", data.description)> 
+  
 
-  <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("message.text")}:</B> ${lang("message.textinfo")}</span></td>
-    <td>
-        <textarea cols="50" rows="3" name="description" wrap=virtual>${data.description}</textarea>
-    </td>
-  </tr>
 
   <tr>
-    <td colspan="2" align="right"> <span class="witetext"><if new>
-      <input type="submit" name="save" value="${lang("insert")}">
+    <td class="table_foot">
+       ${lang("message.textinfo")}
+       </td>
+       
+       <td align="right" class="table_foot"> 
+       <if new>
+               <input type="submit" name="save" value="${lang("insert")}">
     <else>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
+               <input type="submit" name="save" value="${lang("save")}">
+    </if> 
     </td>
+  </tr>
 </table>
+
+</form>
+    <p>
+      
+      <a class="link_box" href="${config.actionRoot}?module=Message&do=list">[&lt;] ${lang("back")} </a> &nbsp;
+      <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+       </p>
+
+
 <include "foot.template">
 </body>
 </html>
index 887ed75..5314491 100755 (executable)
@@ -1,52 +1,68 @@
 <html>
 <head>
        <title>${config["Mir.Name"]} | ${lang("messagelist.htmltitle")}</title>
-        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+
+<p>
+       <a class="link_box" href="${config.actionRoot}?module=Message&do=add">[+] ${lang("add")}</a> &nbsp;
+       <a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a>
+</p>
+
 <if data.contentlist>
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr class="darkgrey">
-    <td><span class="witesmall">
-               <b>${lang("message.date")}</b></span></td>
-    <td><span class="witesmall">
-               <b>${lang("message.title")}<br>${lang("message.creator")}</b></span></td>
-    <td><span class="witesmall">
-               <b>${lang("message.text")}</b></span></td>
+
+<table border="0" cellpadding="2" cellspacing="1" width="70%">
+  <tr>
+    <td class="table_head">
+               ${lang("message.date")}</td>
+    <td class="table_head">
+               ${lang("message.title")} /<br>${lang("message.creator")}</td>
+    <td colspan="2" class="table_head">
+               ${lang("message.text")}</td>
   </tr>
 
   <list data.contentlist as entry>
   <tr
-       <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
-  <td>${entry.webdb_create}&nbsp;</td>
-  <td><b>${entry.title}</b><br>
-      <i>${entry.creator}</i></td>
-  <td class="pink">${entry.description}&nbsp;</td>
-  <td><span class="text">&nbsp;<a href="${config.actionRoot}?module=Message&do=delete&id=${entry.id}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=Message&do=edit&id=${entry.id}">${lang("edit")}</a></span></td>
+               <if grey=="1">
+                       <assign grey="0">class="listrow1"
+               <else>class="listrow2"
+                       <assign grey="1"> 
+               </if> >
+  <td class="x-small" valign="top">${entry.webdb_create}&nbsp;</td>
+  <td valign="top"><span class="small"><b>${entry.title}</b></span><br>
+     <span class="x-small">${lang("by")}: ${entry.creator}</span></td>
+  <td>${entry.description}&nbsp;</td>
+  <td valign="top">
+               <a class="listcommand" href="${config.actionRoot}?module=Message&do=delete&id=${entry.id}">[&nbsp;${lang("delete")}&nbsp;]</a><br>
+               <a class="listcommand" href="${config.actionRoot}?module=Message&do=edit&id=${entry.id}">[&nbsp;${lang("edit")}&nbsp;]</a>
+       </td>
   </tr>
   </list>
+  
   <tr>
-    <td colspan="3" class="darkgrey"><span class="witetext">${data.count} ${lang("records")} /
-        ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
+    <td colspan="4" class="table_foot">${data.count} ${lang("records")} /
+        ${lang("show_from_to", data.from, data.to)}</td>
+    
   </tr>
+
 </table>
 
       <P>
 <if data.prev>
-       <a href="${config.actionRoot}?module=Message&do=list&where=${data.where}&prevoffset=${data.prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;
+       <a class="majorcommand" href="${config.actionRoot}?module=Message&do=list&where=${data.where}&offset=${data.prev}&prev=zurück">[&nbsp;${lang("list.previous")}&nbsp;]</a>&nbsp;
 </if>
 <if data.next>
-<a href="${config.actionRoot}?module=Message&do=list&where=${data.where}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
+       <a class="majorcommand" href="${config.actionRoot}?module=Message&do=list&where=${data.where}&offset=${data.next}&next=weiter">[&nbsp;${lang("list.next")}&nbsp;]</a>
 </if>
 
 <else>
   <P align="center">${lang("no_matches_found")}</p>
 </if>
+
 <include "foot.template">
 </body>
 </html>
index f9a8637..fb94a60 100755 (executable)
 <html>
 <head>
        <title>${config["Mir.Name"]} | ${lang("producerqueue.htmltitle")}</title>
-  <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+<link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 <include "head.template">
 
-<span class="spezialtext"><b>${lang("producer.jobqueue.title")}</b></span>
-<p>
-<table border="0">
-  <tr class="darkgrey">
-    <td colspan="2"><span class="witesmall">${lang("producer.job.name")}</span></td>
-    <td><span class="witesmall">${lang("producer.job.status")}</span></td>
-    <td><span class="witesmall">${lang("producer.job.date")}</span></td>
-<comment>    
-    <td>&nbsp;</td>
-</comment>    
-  </tr>
-  
-  <if queue>
-    <assign grey="1">
-    <list queue as q>
-      <tr <if grey=="1">class="list1"<else>class="list2"</if>>
-        <td><span><b>${q.factory}</b></span></td>
-        <td><span><b>${q.verb}</b></span></td>
-        <td><span>${q.status}</span></td>
-        <td><span>${q.lastchange["HH:mm:ss"]}</span></td>
-<comment> ML: needs to be implemented       
-        <td><span><a href="${config.actionRoot}?module=Producer&do=abort">${lang("producer.job.cancel")}</a></span></td>
-</comment>        
-      </tr>
-      <if grey=="1"><assign grey="0"><else><assign grey="1"></if>
-    </list>
-  <else>
-      <tr class="list1">
-        <td colspan="5">Queue is empty</td>
-      </tr>
-  </if>
-  
+<table width="99%" cellspacing="15"><tr><td valign="top" align="left">
+
+<p class="box"><b>${lang("producer.producerlist.title")}</b></p>
+
+<table border="0" cellspacing="3" cellpadding="2">
+       <tr>
+               <td class="box_head" colspan="2"><b>${lang("producer.verb.name")}</b></td>
+               <td class="box_head" colspan="2"><b>${lang("producer.verb.description")}</b></td>
+               
+       </tr>
+
+       <assign grey="0">
+       <list producers as p>
+               <tr>
+                       <td colspan="4" class="table_head"><b>${p.name}</b></td>
+               </tr>
+
+               <list p.verbs as v>
+               <tr <if grey=="1">class="listrow2"<else>class="listrow2"</if>>
+                       <td width="25"></td>
+                       <if v.name=="all">
+                               <td class="small text_alert">${v.name} [!]</td>
+                       <else>
+                               <td class="small">${v.name}</td>
+                       </if>
+                       <td class="small">${v.description}</td>
+                       <td class="small"><a href="${config.actionRoot}?module=Producer&do=enqueue&producer=${utility.encodeURI(p.name)}&verb=${utility.encodeURI(v.name)}">${lang("producer.verb.enqueue")}</a>&nbsp;</td>
+               </tr>
+               <if grey=="1"><assign grey="0"><else><assign grey="1"></if>
+               </list>
+               
+       </list>
 </table>
-<a class="minorcommand" href="${config.actionRoot}?${thisurl}">${lang("producer.jobqueue.refresh")}</a><br><br>
-
-<br><br>
-
-<span class="spezialtext"><b>${lang("producer.producerlist.title")}</b></span>
-<p>
-<table border="0">
-  <tr class="darkgrey">
-    <td>&nbsp;</td>
-    <td><span class="witesmall">${lang("producer.verb.name")}</span></td>
-    <td><span class="witesmall">${lang("producer.verb.description")}</span></td>
-    <td><span class="witesmall">&nbsp;</span></td>
-  </tr>
-
-  <assign grey="1">
-  <list producers as p>
-    <tr <if grey=="1">class="list1"<else>class="list2"</if>>
-      <td colspan="4"><span><b>${p.name}</b></span></td>
-    </tr>
-    
-    <list p.verbs as v>
-      <tr <if grey=="1">class="list1"<else>class="list2"</if>>
-        <td width="25"></td>
-        <td><span class="small">${v.name}</span></td>
-        <td><span class="small">${v.description}</span></td>
-        <td><span class="small"><a href="${config.actionRoot}?module=Producer&do=enqueue&producer=${utility.encodeURI(p.name)}&verb=${utility.encodeURI(v.name)}">${lang("producer.verb.enqueue")}</a>&nbsp;</span></td>
-      </tr>
-    </list>
-    <if grey=="1"><assign grey="0"><else><assign grey="1"></if>
-  </list>
+
+
+</td>
+
+
+
+<td valign="top" align="right">
+
+<p class="box" align="left"><b>${lang("producer.jobqueue.title")}</b></p>
+
+<table border="0" cellspacing="3" cellpadding="2">
+       <tr >
+               <td class="bg_neutral" colspan="2"><b>${lang("producer.job.name")}</b></td>
+               <td class="bg_neutral" ><b>${lang("producer.job.status")}</b></td>
+               <td class="bg_neutral small" ><b>${lang("producer.job.date")}</b></td>
+               <comment>    
+               <td class="box_head" >&nbsp;</td>
+               </comment>    
+       </tr>
+
+       <if queue>
+               <assign grey="1">
+               <list queue as q>
+                       <tr <if grey=="1">class="listrow1"<else>class="listrow2"</if>>
+                               <td class="small">${q.factory}</td>
+                               <td class="small">(${q.verb})</td>
+                               
+                               <if q.status=="pending">
+                                       <td class="text_alert small">${q.status}</td>
+                               <else>
+                                       <td class="small">${q.status}</td>
+                               </if>
+                               
+                               <td class="small">${q.lastchange["HH:mm:ss"]}</td>
+                               <comment> ML: needs to be implemented       
+                                       <td><a href="${config.actionRoot}?module=Producer&do=abort">${lang("producer.job.cancel")}</a></td>
+                               </comment>        
+                       </tr>
+                       <if grey=="1"><assign grey="0"><else><assign grey="1"></if>
+               </list>
+       <else>
+               <tr class="list2">
+                       <td colspan="5" align="center">${lang("producer.job.empty")}</td>
+               </tr>
+       </if>
+       <tr>
+               <td colspan="5" class="table_foot">
+                       <br>
+                       <a class="link_box"  href="${config.actionRoot}?${thisurl}">${lang("producer.jobqueue.refresh")}</a>
+               </td>
+       </tr>
 </table>
 
+</td></tr></table>
+
 <include "foot.template">
 
 </body>
index 3f126d3..c5945e6 100755 (executable)
   <head>
     <title>${config["Mir.Name"]} | ${lang("start.htmltitle")}</title>
     <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css"
-    <meta http-equiv="Content-Type" content="text/html; charset=${lang("htmlcharset")}">
   </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+  <include "FUNCTIONS.template">
   <include "head.template">
-  <table border="0" width="100%">
-       <tr>
-               <td valign="top" width="40%" class="grey">
-
-
-               <span class="spezialtext">
-               <b>${lang("start.openpostings.title")}</b></span>
 
-        <p>
-               <a href="${config.actionRoot}?module=Content&do=list&to_article_type%3D1&order=webdb_create+desc">
-               <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;${lang("edit")}</a>
-
-               <p>
-                       <span class="spezialtext">
-                       <b>${lang("start.comments.title")}</b></span>
-               <p>
+<table border="0" width="100%">
+       <tr>
+               <td valign="top" width="40%">
+               <!-- ###### left column ###### -->
+               <p class="box_head"><b>${lang("start.administer.title")}</b></p>
+               <p class="box"> 
+                       
+                       <a href="${config.actionRoot}?module=Content&do=list&where=is_published%3d'1'%20and%20to_article_type%3D0&order=webdb_create%20desc">&gt; ${lang("start.allarticlesoftype", lang("articletypes.openposting"))}</a>      
+                       <br>
                        <a href="${config.actionRoot}?module=Comment&do=list">
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;${lang("edit")}</a>
-           <p>
-                       <span class="spezialtext">
-                       <b>${lang("start.breaking.title")}</b></span>
-               <p>
-      <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                         <a href="${config.actionRoot}?module=Breaking&do=list">${lang("edit")}</a>
-      <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                         <a href="${config.actionRoot}?module=Breaking&do=add">${lang("start.breaking.new")}</a>
-
-                       <table width="100%" border="0">
-               <tr><td bgcolor="white">&nbsp;</td></tr>
-               </table>
-
-           <span class="spezialtext">
-                       <b>${lang("start.content.title")}</b></span>
-
-               <p>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=add&where=aktuell">${lang("start.content.new")}</a>
-           <p>
-                       <b>${lang("start.show")}:</b><br>
-      <list data.articletypes as a>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=is_published%3d'1'%20and%20to_article_type%3D${a.id}&order=webdb_create%20desc">${lang("start.allarticlesoftype", lang("articletypes."+a.name))}</a><br>
+                               &gt; ${lang("start.content.comments")}
+                       </a>
+               </p>
+
+               <p class="box_head"><b>${lang("start.list.title")}</b></p>      
+               <p class="box">
+      <list articletypes as a>
+                       <a href="${config.actionRoot}?module=Content&do=list&where=is_published%3d'1'%20and%20to_article_type%3D${a.id}&order=webdb_create%20desc">&gt; ${lang("start.allarticlesoftype", lang("articletypes."+a.name))}</a><br>
       </list>
+                       <br>    
+                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("is_published='f'")}&order=${utility.encodeURI("webdb_create desc")}" >&gt; ${lang("start.content.not_published")}</a><br>
+                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("id in (select content_id from content_x_media, media where media.id=media_id)")}&order=${utility.encodeURI("webdb_create desc")}">&gt; ${lang("start.content.with_media")}</a><br>
+                       <a href="${config.actionRoot}?module=Content&do=list&where=&order=${utility.encodeURI("webdb_lastchange desc")}">&gt; ${lang("start.content.last_changes")}</a><br>
+                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("not (comment is null or comment like '')")}&order=${utility.encodeURI("webdb_create desc")}">&gt; ${lang("start.content.with_comments")}</a><br>
+                       <br>
+                       <a href="${config.actionRoot}?module=Content&do=list&where=&order=${utility.encodeURI("webdb_create desc")}">&gt; ${lang("start.content.all")}</a><br>
+               </p>
+
+               <p class="box_head"><b>${lang("start.extra.title")}</b></p>             
+               <p class="box"> 
+                       <a href="${config.actionRoot}?module=Hidden&do=list">&gt; ${lang("start.content.hidden")}</a><br>
+                       <a href="${config.actionRoot}?module=FileEdit&do=list">&gt; ${lang("start.fileedit.title")}</a>
+               </p>
+</td>
+
+<!-- ###### end left column ###### -->
+
+<td width="2%">&nbsp;</td>
+<!-- ###### Spacer-column ###### -->
 
-      <br>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=&order=${utility.encodeURI("webdb_create desc")}">${lang("start.content.all")}</a><br>
-
-      <br>
-           <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("is_published='f'")}&order=${utility.encodeURI("webdb_create desc")}" >${lang("start.content.not_published")}</a><br>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("id in (select content_id from content_x_media, media where media.id=media_id)")}&order=${utility.encodeURI("webdb_create desc")}">${lang("start.content.with_media")}</a><br>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=&order=${utility.encodeURI("webdb_lastchange desc")}">${lang("start.content.last_changes")}</a><br>
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-                       <a href="${config.actionRoot}?module=Content&do=list&where=${utility.encodeURI("not (comment is null or comment like '')")}&order=${utility.encodeURI("webdb_create desc")}">${lang("start.content.with_comments")}</a><br>
-
-      <br>
-      <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;
-      <a href="${config.actionRoot}?module=Hidden&do=list">${lang("start.content.hidden")}</a>
-      <br>
-      <br>
-      <span class="spezialtext"><b>
-        ${lang("start.editfiles.title")}
-      </b></span>
-      <br />
-
-                       <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp;<a href="${config.actionRoot}?module=FileEdit&do=list">${lang("start.editfiles.include")}</a>
-
-                       <br><br>
-
-     <form action="${config.actionRoot}" method="post">
-            <input type="hidden" name="module" value="Content">
-       <input type="hidden" name="do" value="search">
-       <input type="hidden" name="order" value="datedesc">
-                   ${lang("start.content.search")}: <span class="small">
-       <input type="text" name="searchvalue" size="15">
-       <select name="searchfield">
-               <option value="id">${lang("content.id")}</option>
-               <option value="title">${lang("content.title")}</option>
-        <option value="creator">${lang("content.creator")}</option>
-        <option value="source">${lang("content.location")}</option>
-                               <option value="comment">${lang("content.comment")}</option>
-        <option value="contents">${lang("content.content")}</option>
-       </select></span>
-      </form>
-
-               <table width="100%" border="0">
-               <tr><td bgcolor="white">&nbsp;</td></tr>
-               </table>
-
-               <span class="spezialtext">
-               <b>${lang("start.producers.title")}</b></span>
-    <p>
-      <a href="${config.actionRoot}?module=Producer&do=produceAllNew">${lang("start.producers.produceAllNew")}</a><br>
-      <a href="${config.actionRoot}?module=Producer&do=showProducerQueueStatus">${lang("start.producers.advanced")}</a>
-      
-        
-      <table width="100%" border="0"><tr><td bgcolor="white">&nbsp;</td></tr></table>
-
-      <a class="menucommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("start.superusermenu")}</a>
-
-    </td>
-                       <td bgcolor="white" width="5%">&nbsp;
-                       </td>
-                       
 <comment> Middle column </comment>
                        
-    <td valign="top" width="30%" class="grey">
-
-        <span class="spezialtext">
-                   <b>${lang("start.images.title")}</b>
-                 </span>
-
-      <p>
-        <a href="${config.actionRoot}?module=Images&do=list">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("edit")}</a><br>
-        <a href="${config.actionRoot}?module=Images&do=add">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("add")}</a>
-
-      <p>
-        <span class="spezialtext">
-          <b>${lang("start.audio.title")}</b>
-        </span>
-
-      <p>
-        <a href="${config.actionRoot}?module=Audio&do=list">
-            <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("edit")}
-        </a><br>
-
-        <a href="${config.actionRoot}?module=Audio&do=add">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("add")}
-        </a>
-
-      <p>
-        <span class="spezialtext">
-          <b>${lang("start.video.title")}</b>
-        </span>
-
-      <p>
-        <a href="${config.actionRoot}?module=Video&do=list">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("edit")}
-        </a><br>
-      
-        <a href="${config.actionRoot}?module=Video&do=add">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("add")}
-        </a>
-
-      <p>
-        <span class="spezialtext">
-          <b>${lang("start.other_media.title")}</b>
-        </span>
-
-      <p>
-        <a href="${config.actionRoot}?module=OtherMedia&do=list">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("edit")}
-        </a><br>
-
-        <a href="${config.actionRoot}?module=OtherMedia&do=add" >
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("add")}
-        </a>
-
-      <p>
-                         <span class="spezialtext">
-                     <b>${lang("start.mediafolder.title")}</b>
-                   </span>
-
-      <p>
-        <a href="${config.actionRoot}?module=Mediafolder&do=list">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("edit")}
-        </a><br>
-        
-        <a href="${config.actionRoot}?module=Mediafolder&do=add">
-          <img src="${config.docRoot}/img/pointgris.gif" border=0>&nbsp; ${lang("add")}
-        </a>
-    </td>
-
-    <td bgcolor="white" width="5%">&nbsp;
-    </td>
+    <td valign="top" width="30%">
+               
+               <p class="box_head"><b>${lang("start.addandedit.title")}</b></p>
+               <div class="box">
+                       <a href="${config.actionRoot}?module=Content&do=add&where=aktuell">&gt; ${lang("start.content.new")}</a>
+                       <br>
+                       
+                       <a href="${config.actionRoot}?module=Breaking&do=list">&gt; ${lang("start.breaking.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=Breaking&do=add">[+]</a>
+                       <form>
+                               <input type="hidden" name="module" value="Content">
+                               <input type="hidden" name="do" value="edit">
+                               ${lang("start.open_by_id")} : 
+                               <input type="text" name="id" value="" size="7">
+                               <input type="submit" value=" &gt; ">
+                       </form>
+                       
+                       
+               </div>
+               
+               <p class="box_head"><b>${lang("start.media.title")}</b></p>     
+               <div class="box">
+                       
+                       <a href="${config.actionRoot}?module=Images&do=list">&gt; ${lang("start.images.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=Images&do=add">[+]</a><br>
+
+                       <a href="${config.actionRoot}?module=Audio&do=list">&gt; ${lang("start.audio.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=Audio&do=add">[+]</a><br>
+
+                       
+                       <a href="${config.actionRoot}?module=Video&do=list">&gt; ${lang("start.video.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=Video&do=add">[+]</a><br>
+
+                       
+                       <a href="${config.actionRoot}?module=OtherMedia&do=list">&gt; ${lang("start.other_media.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=OtherMedia&do=add" >[+]</a><br>
+
+                       <br>
+                       <a href="${config.actionRoot}?module=Mediafolder&do=list">&gt; ${lang("start.mediafolder.title")}</a>&nbsp;
+                       <a href="${config.actionRoot}?module=Mediafolder&do=add">[+]</a><br>
+               </div>
+               
+               
+               
+               <p class="box_head"><b>${lang("start.producers.title")}</b></p>
+               <p class="box">
+                       <a href="${config.actionRoot}?module=Producer&do=produceAllNew">&gt; ${lang("start.producers.produceAllNew")}</a><br>
+                       <a href="${config.actionRoot}?module=Producer&do=showProducerQueueStatus">&gt; ${lang("start.producers.advanced")}</a>
+               </p>
+               
+               <p class="box bg_neutral">
+                       <a href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("start.superusermenu")}</a>         
+               </p>
+
+       </td>
+
+    <td width="2%">&nbsp;</td>
 
 <comment> RIGHT COLUMN </comment>
 
-                       <td valign="top" width="20%" class="pink">
+       <td valign="top" width="26%" rowspan="2">
 
        <comment>internal messageboard</comment>
 
-               <span class="spezialtext">
-               <b>${lang("start.messageboard.title")}</b>
-               <span class="small"><br><a href="${config.actionRoot}?module=Message&do=add">${lang("add")}</a>
-               <a href="${config.actionRoot}?module=Message&do=list">${lang("edit")}</a></span>
-               <if data.messages>
-                       <list data.messages as m>
-                               <p>
-                               <if m.title><b>${m.title}</b><br></if>
-                               ${m.description}<br>
-                               <span class="x-small">
-                               <if m.creator><i>von: ${m.creator}</i> / </if>${m.webdb_create}<br>
-                               </span>
-                       </list>
-               <else>
-                       <p><i>${lang("start.messageboard.no_messages")}</i>
-               </if></span>
+
+               <p class="box_head"><b>${lang("start.messageboard.title")}</b></p>
+               <div class="box_bg">
+                       <span class="small">
+                               <a href="${config.actionRoot}?module=Message&do=add">[ + ${lang("add")}]</a> 
+                               <a href="${config.actionRoot}?module=Message&do=list">[${lang("edit")}]</a>
+                       </span>
+                       <if messages>
+                               <list messages as m>
+                                       <p class="x-small">
+                                               <if m.title><b>${m.title}</b><br></if>
+                                               ${m.description}<br>
+                                               <span class="x-small">
+                                                       <if m.creator><i>by: ${m.creator}</i> / </if>${m.webdb_create}<br>
+                                               </span>
+                                       </p>
+                               </list>
+                       <else>
+                               <p><i>${lang("start.messageboard.no_messages")}</i>
+                       </if></span>
+               </div>
        </td>
 
        </tr>
-       </table>
+       
+       <comment> BOTTOM ROW FOR SEARCH </comment>
+       <tr>
+               <td colspan="3" valign="top">
+                       <p class="box_head"><b>${lang("start.search.title")}</b></p>
+                       <div class="box">
+                               <call ContentSearch ("")>
+                       </div>
+                       
+                       <!-- HELP -DEMO -->
+                       <p class="box">
+                               <b>HELP-Demo:</b><br>
+                               popup small-link: <call Help ("../help/content_datum.html", "1", "" )>&nbsp;&nbsp;  popup big-link: <call Help ("../help/content_datum.html", "1", "1" )><br><br>
+                               newwin small-link: <call Help ("../help/content_datum.html", "", "" )>&nbsp;&nbsp; newwin big-link: <call Help ("../help/content_datum.html", "", "1" )>
+                       </p>
+                       
+                       
+               </td>
+               <td>&nbsp;</td>
+       </tr>
+       
+</table>
 
        <include "foot.template">
 
index d79d891..3132f7f 100755 (executable)
@@ -1,33 +1,34 @@
 <html>
 <head>
        <title>${config["Mir.Name"]} | ${lang("superusermenu.htmltitle")}</title>
-  <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
 </head>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-<include "head.template">
-
-                       <a class="menucommand" href="${config.actionRoot}?module=Topics&do=list">${lang("superusermenu.topics")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=ArticleType&do=list">${lang("superusermenu.articletypes")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=CommentStatus&do=list">${lang("superusermenu.comment_statuses")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=Users&do=list">${lang("superusermenu.users")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=Language&do=list">${lang("superusermenu.languages")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=Abuse">${lang("superusermenu.abuse")}</a>
-
-      <p>
-                       <a class="menucommand" href="${config.actionRoot}?module=LinksImcs&do=list">${lang("superusermenu.imcs")}</a>
 
+<include "head.template">
 
+<table width="95%">
+  <tbody>
+    <tr>
+               <td width="30%">  
+               <p class="box_head"><b>${lang("superusermenu.manage")}:</b></p>
+               <p class="box">
+               &gt; <a href="${config.actionRoot}?module=Topics&do=list">${lang("superusermenu.topics")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=ArticleType&do=list">${lang("superusermenu.articletypes")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=CommentStatus&do=list">${lang("superusermenu.comment_statuses")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=Users&do=list">${lang("superusermenu.users")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=Language&do=list">${lang("superusermenu.languages")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=Abuse">${lang("superusermenu.abuse")}</a><br>
+               &gt; <a href="${config.actionRoot}?module=LinksImcs&do=list">${lang("superusermenu.imcs")}</a><br>
+               </p>
+               </td>
+      <td>&nbsp;  </td>
+      <td>&nbsp;  </td>
+    </tr>
+  </tbody>
+</table>
+<p><a class="link_box" href="${config.actionRoot}">[&lt;&lt;&lt;] ${lang("head.start")}</a></p>
 
 <include "foot.template">
 
index 760091c..4d06206 100755 (executable)
@@ -5,7 +5,9 @@
   <head>
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-    <include "head.template">
+    <include "FUNCTIONS.template">
+       
+       <include "head.template">
 
     <form action="${config.actionRoot}" method="post">
       <input type=hidden name=module value=Topics>
       </if>
 
       <table border="0">
-        <tr>
-          <td align="right" class="darkgrey">
-            <span class="witesmall">
-              <b>${lang("topic.title")}:</b>
-            </span>
-          </td>
-          <td>
-            <input type="text" size="40" name="title" value="${data.title}">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" valign="top" class="darkgrey">
-            <span class="witetext"><b>${lang("topic.description")}:</b></span>
-          </td>
-          <td>
-              <textarea cols="40" rows="3" name="description">${data.description}</textarea>
-            </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey"><span class="witetext"><B>${lang("topic.filename")}:</B></span></td>
-          <td>
-            <input type="text" size="20" name="filename" value="${data.filename}">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey"><span class="witetext"><B>${lang("topic.main_url")}
-            </B></span></td>
-          <td>
-            <input type="text" size="40" name="main_url" value="${data.main_url}">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey"><span class="witetext"><B>${lang("topic.archive_url")}:</B></span></td>
-          <td>
-            <input type="text" size="40" name="archiv_url" value="${data.archiv_url}">
-          </td>
-        </tr>
-        <tr>
-          <td colspan="2" align="right"> <span class="witetext">
+               <call TextInputTableRow (lang("topic.title"), 40, 255, "title", data.title)>
+               <call TextAreaTableRow (lang("topic.description"), 40, 3, "description", data.description)>
+               <call TextInputTableRow (lang("topic.filename"), 20, 255, "filename", data.filename)>
+               <call TextInputTableRow (lang("topic.main_url"), 40, 255, "main_url", data.main_url)>
+               <call TextInputTableRow (lang("topic.archive_url"), 40, 255, "archiv_url", data.archiv_url)>
+
+          <td class="table_foot" colspan="2" align="right"> 
           <if data.new>
             <input type="submit" name="save" value="${lang("insert")}">
           <else>
             <input type="submit" name="save" value="${lang("save")}">
-          </if> </span>
+          </if> 
           </td>
         </tr>
-      </table>
+      </table>   
     </form>
+       <p><a class="link_box" href="${config.actionRoot}?module=Topics&do=list">[&lt;] ${lang("back")} </a> &nbsp;</p>
     <include "foot.template">
   </body>
 </html>
index 4a0a44e..97bff9e 100755 (executable)
@@ -6,63 +6,36 @@
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
+
+       <include "FUNCTIONS.template">
+  
     <include "head.template">
 
-      <a class="majorcommand" href="${config.actionRoot}?module=Topics&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    
+               <comment>configure this template here</comment>
+               <assign contentlist = data.contentlist>
+               <assign column_nr = 5>
+               <assign column_head_texts = [lang("topic.title"), lang("topic.description"), lang("topic.main_url"), lang("topic.archive_url")]>
+               <assign data_keys = ["title", "description", "main_url", "archiv_url"]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "Topics">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "superusermenu">
+
     <if data.contentlist>
-      <table border="0">
-        <tr class="darkgrey">
-          <td><span class="witesmall"><b>${lang("topic.title")}</b></span></td>
-          <td><span class="witesmall"><b>${lang("topic.description")}</b></span></td>
-          <td><span class="witesmall"><b>${lang("topic.main_url")}<br>${lang("topic.archive_url")}</b></span></td>
-         <td>&nbsp;</td>
-        </tr>
-        <list data.contentlist as entry>
-          <if grey=="1"><assign grey="0"><tr class="list1"><else><tr class="list2"><assign grey="1"></if>
-            <td><span class="small">${entry.title}&nbsp;</span></td>
-            <td><span class="small">${entry.description}&nbsp;</span></td>
-            <td><span class="small">${entry.main_url}<br>${entry.archiv_url}</span></td>
-            <td><span class="text">&nbsp;
-                <a href="${config.actionRoot}?module=Topics&do=delete&id=${entry.id}">${lang("delete")}</a>
-              | <a href="${config.actionRoot}?module=Topics&do=edit&id=${entry.id}">${lang("edit")}</a>
-            </span></td>
-          </tr>
-        </list>
-        <tr>
-          <td colspan="4" class="darkgrey"><span class="witesmall">
-            ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
-          </span></td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>
-      <p>
-        <if (data.prev || data.next)>
-          <form method="post" action="${config.actionRoot}">
-            <input type="hidden" name="module" value="Topics">
-            <input type="hidden" name="where" value="${data.where}">
-            <if data.prev>
-              <input type="hidden" name="do" value="list">
-              <input type="hidden" name="prevoffset" value="${data.prev}">
-              <input type="submit" name="prev" value="${lang("list.previous")}">
-            </if>
-            <if data.next>
-              <input type="hidden" name="do" value="list">
-              <input type="hidden" name="nextoffset" value="${data.next}">
-              <input type="submit" name="next" value="${lang("list.next")}">
-            </if>
-          </form>
-        </if>
-      </p>
-    <else>
-      <p align="center">${lang("no_matches_found")}</p>
+               <call AddOrBack(module_name, module_jumpback, do_jumpback)>
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>   
+               <call PrevNextPage(module_name)>          
+   <else>
+               <P align="center">${lang("no_matches_found")}</p>
     </if>
-
-      <a class="majorcommand" href="${config.actionRoot}?module=Topics&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
+    
+       <call AddOrBack(module_name, module_jumpback, do_jumpback)>
 
     <include "foot.template">
+  
   </body>
 </html>
 
index 74e048c..984c033 100755 (executable)
@@ -1,78 +1,52 @@
 <html>
-  <head>
-    <title>${config["Mir.Name"]} | ${lang("user.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-  <head>
+<head>
+       <title>${config["Mir.Name"]} | ${lang("user.htmltitle")}</title>
+       <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+<head>
 
-  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+       
+       <include "FUNCTIONS.template">
+       <include "head.template">
 
-  <include "head.template">
+<form action="${config.actionRoot}" method="post">
+       <input type="hidden" name="module" value="Users">
+       <input type="hidden" name="id" value="${data.id}">
+       <if data.new>
+               <input type="hidden" name="do" value="insert">
+       <else>
+               <input type="hidden" name="do" value="update">
+       </if>
 
-    <form action="${config.actionRoot}" method="post">
-      <input type="hidden" name="module" value="Users">
-      <input type="hidden" name="id" value="${data.id}">
-      <if data.new>
-        <input type="hidden" name="do" value="insert">
-      <else>
-        <input type="hidden" name="do" value="update">
-      </if>
-    
-      <table border="0">
-        <tr> 
-          <td align="right" class="darkgrey">
-            <span class="witesmall">
-              <b>${lang("user.login")}:</b>
-            </span>
-          </td>
-          <td>
-            <input type="text" size="40" name="login" value="${data.login}">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey">
-            <span class="witesmall">
-              <b>${lang("user.password")}:</b>
-            </span>
-          </td>
-          <td>
-            <input type="password" size="20" name="newpassword" value="">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey">
-            <span class="witesmall">
-              <b>${lang("user.password2")}:</b>
-            </span>
-          </td>
-          <td>
-            <input type="password" size="20" name="newpassword2" value="">
-          </td>
-        </tr>
-        <tr>
-          <td align="right" class="darkgrey">
-            <span class="witesmall">
-              <b>${lang("user.admin")}:</b>
-            </span>
-          </td>
-          <td>
-            <input type="checkbox" name="is_admin" value="1"<if data.is_admin=="1"> checked</if>>
-          </td>
-        </tr>
-        <tr>
-          <td colspan="2" align="right"> 
-            <span class="witetext">
-              <if data.new>
-                <input type="submit" name="save" value="${lang("insert")}">
-              <else>
-                <input type="submit" name="save" value="${lang("save")}">
-              </if> 
-            </span>
-          </td>
-        </tr>
-      </table>
-    </form>
-    
-    <include "foot.template">
-  
-  </body>
+       <table border="0">
+               <call TextInputTableRow (lang("user.login"), 40, 40, "login", data.login)>
+               <call TextInputTableRow (lang("user.password"), 40, 40, "newpassword", "")>
+               <call TextInputTableRow (lang("user.password2"), 40, 40, "newpassword2", "")>
+               <tr>
+                       <td align="right" class="table_left">
+                               <b>${lang("user.admin")}:</b>
+                       </td>
+                       <td class="listrow2">
+                               <input type="checkbox" name="is_admin" value="1"<if data.is_admin=="1"> checked</if>>
+                       </td>
+               </tr>
+               <tr>
+               <td colspan="2" align="right" class="table_foot"> 
+                       <span class="witetext">
+                       <if data.new>
+                               <input type="submit" name="save" value="${lang("insert")}">
+                       <else>
+                               <input type="submit" name="save" value="${lang("save")}">
+                       </if> 
+                       </span>
+               </td>
+               </tr>
+       </table>
+</form>
+       
+       <p><a class="link_box" href="${config.actionRoot}?module=Users&do=list">[&lt;] ${lang("back")} </a> &nbsp;</p>
+       
+       <include "foot.template">
+
+</body>
 </html>
index 594e4dc..fc61c25 100755 (executable)
@@ -3,7 +3,7 @@
 <title>${lang("usererror.htmltitle")}</title>
 </head>
 <body>
-<include "head_nonavi.template">
+<include "templates/admin/head_nonavi.template">
 <table width="100%" border="0" align="center">
        <tr bgcolor="#006600">
                <td>
index 0298fc8..432c0ae 100755 (executable)
@@ -5,53 +5,34 @@
   </head>
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-    <include "head.template">
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Users&do=add">${lang("add")}</a> | 
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+        
+               <include "FUNCTIONS.template">
+               <include "head.template">
+               
+               <assign contentlist = data.contentlist>
+               <assign column_nr = 3>
+               
+               <assign column_head_texts = [lang("user.login"), lang("user.admin")]>           
+               <assign data_keys = ["login","is_admin"]>
+               <assign column_head_CSS = "table_head">
+               <assign listrow1CSS = "listrow1">
+               <assign listrow2CSS = "listrow2">
+               <assign footer_css = "table_foot">
+               <assign module_name = "Users">
+               <assign module_jumpback = "Admin">
+               <assign do_jumpback = "superusermenu">
+       
+
+       
+       <call AddOrBack(module_name, module_jumpback, do_jumpback)>
 
     <if data.contentlist>
-      <table border="0" cellpadding="2" cellspacing="1">
-        <tr class="darkgrey">
-          <td><span class="witesmall"><b>${lang("user.login")}</b></span></td>
-          <td><span class="witesmall"><b>${lang("user.admin")}</b></span></td>
-        </tr>
-
-        <list data.contentlist as entry>
-          <if grey=="1"><assign grey="0"><tr class="list1"><else><tr class="list2"><assign grey="1"> </if>
-            <td>${entry.login}&nbsp;</td>
-            <td>${entry.is_admin}&nbsp;</td>
-            <td><span class="text">
-                   <a href="${config.actionRoot}?module=Users&do=delete&id=${entry.id}">${lang("delete")}</a>
-                 | <a href="${config.actionRoot}?module=Users&do=edit&id=${entry.id}">${lang("edit")}</a>
-            </span></td>
-          </tr>
-        </list>
-        <tr>
-          <td colspan="3" class="darkgrey"><span class="witetext">
-            ${data.count} ${lang("records")} /  ${lang("show_from_to", data.from, data.to)}
-          </span></td>
-          <td>&nbsp;</td>
-        </tr>
-      </table>
-      <p>
-
-      <if data.prev>
-        <a href="${actionRoot}?module=Users&do=list&where=${where}&prevoffset=${prev}&prev=zur&uuml;ck">${lang("list.previous")}</a>&nbsp;
-      </if>
-      <if data.next>
-        <a href="${actionRoot}?module=Users&do=list&where=${where}&nextoffset=${next}&next=weiter">${lang("list.next")}</a>
-      </if>
-      </p>
-    <else>
-      <p align="center">${lang("no_matches_found")}</p>
+               <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>
+               <call AddOrBack(module_name, module_jumpback, do_jumpback)>
+       <else>
+      <P align="center">${lang("no_matches_found")}</p>
     </if>
-
-    <p>
-      <a class="majorcommand" href="${config.actionRoot}?module=Users&do=add">${lang("add")}</a> |
-      <a class="majorcommand" href="${config.actionRoot}?module=Admin&do=superusermenu">${lang("back")}</a>
-    </p>
+    
 
     <include "foot.template">
   </body>
index d7ff1b2..c63d920 100755 (executable)
@@ -10,32 +10,33 @@ function openWin(url) {
 </SCRIPT>
 
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
+<include "FUNCTIONS.template">
 <include "head.template">
 
 <if data.new>
 <form action="${config.actionRoot}?module=Video&do=add" method="post">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
        <table border="0">
-       <tr>
-       <td align="right" class="darkgrey">
-       <span class="witesmall">
-       <b>${lang("media.nr_of_media")}</b> <br>
-       </span>
-       </td>
-       <td>
-       <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
-       </td>
-       </tr>
+               <tr>
+                       <td align="right" class="table_left">
+                               <b>${lang("media.nr_of_media")} :</b><br>
+                       </td>
+                       <td class="listrow2">
+                               <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+                       </td>
+               </tr>
        </table>
 </form>
 </if>
+
+
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Video&do=<if data.new>insert<else>update</if>&id=${data.id}">
-        <if data.articleid>
-          <input type="hidden" name="articleid" value="${data.articleid}">
-        </if>
+       <if data.articleid>
+               <input type="hidden" name="articleid" value="${data.articleid}">
+       </if>
+       
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">
@@ -45,121 +46,99 @@ function openWin(url) {
 
        <if !data.new>
        <tr>
-    <td align="right" class="darkgrey">
-               <span class="witesmall">
+       <td align="right" valign="top">
                        <a href="${config.actionRoot}?module=Video&do=getMedia&id=${data.id}">
-                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
-    <td valign="bottom"><span class="spezialtext">
-               ${lang("media.created")}: ${data.webdb_create}
-        <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
-               <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
-               ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
-               ${lang("media.size")}: ${data.human_readable_size}<br>
-               ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
-       </td>
+                       <img src="${config.docRoot}/img/${data.big_icon}" border=0></a>&nbsp;&nbsp;
+               </td>
+               <td valign="bottom" class="small">
+                       ${lang("media.created")}: ${data.webdb_create}
+                       <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
+                       <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
+                       ${lang("media.format")}: ${data.mimetype} / ${data.media_descr}<br>
+                       ${lang("media.size")}: ${data.human_readable_size}<br>
+                       ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
+               </td>
        </tr>
        </if>
 
        <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.mediafolder")}:</B></span></td>
-    <td>
-               <select name="to_media_folder">
-               <list extra.mediafolderPopupData as m>
-               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
-               </list>
-           </select>
-       </td>
+               <td align="right" class="table_left">
+                       <B>${lang("media.mediafolder")}:</B>
+               </td>
+               <td class="listrow2">
+                       <select name="to_media_folder">
+                       <list extra.mediafolderPopupData as m>
+                               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
+                       </list>
+               </select>
+               </td>
        </tr>
 
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.description")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.date")}:</B></span></td>
-    <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
-               <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.location")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.creator")}:</B></span></td>
-    <td>
-               <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.keywords")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.comment")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.source")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
-       </tr>
-       <tr>
+       <call TextInputTableRow (lang("media.description"), 40, 255, "description", data.description)>
+       <call TextInputTableRow (lang("media.date"), 8, 8, "date", data.date)>
+       <call TextInputTableRowLight (lang("year"), 20, 40, "year", data.year)>
+       <call TextInputTableRow (lang("media.location"), 40, 80, "place", data.place)>
+       <call TextInputTableRow (lang("media.creator"), 40, 80, "creator", data.creator)>
+       <call TextAreaTableRow (lang("media.keywords"), 40, 2, "keywords", data.keywords)>
+       <call TextAreaTableRow (lang("media.comment"), 40, 2, "comment", data.comment)>
+       <call TextInputTableRow (lang("media.source"), 40, 80, "source", data.source)>
+       
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
+       
        <if data.new>
        <tr>
-       <td>
-               ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-       </td>
+               <td align="right" class="table_left">
+                       ${lang("media.is_published")} : 
+               </td>
+               <td class="listrow2" style='border: 1px solid #FF0000;'>
+                       <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>> 
+               </td>
        </tr>
+       <tr><td colspan="2" class="x-small">&nbsp;</td></tr>
+       
        <list data.mediafields as m>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
-
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
-               </font> </td>
-               <td>
+                </td>
+               <td class="listrow2">
                        <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
                </td>
-               </tr>
-               <tr>
-               <td align="right" class="darkgrey"></td>
-               <td>
-                               <INPUT TYPE="file" NAME="mpfile${m}"><br>
+       </tr>
+       <tr>
+               <td align="right">
+                       &nbsp;
                </td>
-               </tr>
+               <td class="listrow2">
+                       <INPUT TYPE="file" NAME="mpfile${m}"><br>
+               </td>
+       </tr>
        </list>
        <else>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
+       <tr>
+               <td align="right" class="table_left">
                        <B>${lang("media.title")}:<B>
                </td>
-               <td>
+               <td class="listrow2">
                        <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
                </td>
-               </tr>
+       </tr>
        </if>
 
-    <td colspan="2" align="right"> <span class="text">
+    <td colspan="2" align="right" class="table_foot">
        <if data.new>
       <input type="submit" name="save" value="${lang("insert")}">
     <else>
      ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></span>
+    &nbsp;&nbsp;<input type="submit" name="save" value="${lang("save")}">
+    </if> </form>
     </td>
 </table>
+
+<p><a class="link_box" href="${config.actionRoot}?module=Video&do=list">[&lt;] ${lang("list")} </a> &nbsp;</p>
+
 <include "foot.template">
+
 </body>
 </html>
index 0b1a74c..1577587 100755 (executable)
 <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
 <include "head.template">
+<include "FUNCTIONS_media.template">
+<call MediaSearch ("Video")>
+<p>&nbsp;</p>
+<call MediaList   ("Video")>
 
-<table border="0" cellpadding="2" cellspacing="1">
-  <tr>
-    <td colspan="5"><form method="post" action="${config.actionRoot}">
-       <input type="hidden" name="module" value="Video">
-       <input type="hidden" name="do" value="list">
-       <input type="hidden" name="cid" value="${data.cid}">
-       <table border="0">
-       <tr class="pink">
-               <td>${lang("medialist.search_text_in")}:</td>
-               <td>${lang("media.published")}:</td>
-               <td>${lang("media.mediafolder")}:</td>
-               <td>&nbsp;</td>
-       </tr>
-
-       <tr>
-       <td>
-               <input type="text" size="10" maxlength="20" name="query_text" value="${data.query_text}">
-               <select name="query_field">
-               <option value="title"<if data.query_field=="title"> selected</if>>${lang("media.title")}</option>
-               <option value="creator"<if data.query_field=="creator"> selected</if>>${lang("media.creator")}</option>
-               <option value="place"<if data.query_field=="place"> selected</if>>${lang("media.location")}</option>
-               <option value="keywords"<if data.query_field=="keywords"> selected</if>>${lang("media.keywords")}</option>
-       </select>
-       </td>
-       <td>
-               <select name="query_is_published">
-                   <option value="">${lang("dontcare")}</option>
-               <option value="0" <if data.query_is_published=="0"> selected</if>>${lang("no")}</option>
-                   <option value="1" <if data.query_is_published=="1"> selected</if>>${lang("yes")}</option>
-           </select>
-       </td>
-       <td>
-       <select name="query_media_folder">
-       <list extra.mediafolderPopupData as m>
-       <option value="${m.key}" <if m.key == data.query_media_folder>selected</if>>${m.value}</option>
-       </list>
-       </select>
-       </td>
-       <td>
-               <input type="submit" name="search" value="${lang("filter")}">
-       </td>
-       </tr>
-       </table>
-       </form>
-       </td>
-  </tr>
-
-  <tr class="darkgrey" >
-       <td><span class="witesmall">
-       <b>${lang("media.icon")}</b></span></td>
-       <td><span class="witesmall">
-       <b>${lang("media.title")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.format")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.size")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.mediafolder")}</b></span></td>
-    <td><span class="witesmall">
-       <b>${lang("media.creator")}</b></span></td>
-  </tr>
-  <if data.contentlist>
-  <list data.contentlist as entry>
-  <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list1"<assign grey="1"> </if>>
-  <td>
-         <a href="${config.actionRoot}?module=Video&do=getMedia&id=${entry.id}">
-         <img src="${config.docRoot}/img/${entry.big_icon}" border=1></a></span></td>
-  <td>${entry.title}&nbsp;
-         <if entry.description><br>${entry.description}</if></td>
-  <td>${entry.media_descr}&nbsp;</td>
-  <td>${entry.human_readable_size}&nbsp;</td>
-  <td>${data.mediafolderHashdata[entry.to_media_folder]["name"]}&nbsp;</td>
-  <td>${entry.creator}&nbsp;</td>
-  <td><span class="text">&nbsp;
-       <if data.cid><a href="${config.actionRoot}?module=Content&do=attach&mid=${entry.id}&cid=${data.cid}">${lang("attach")}</a>
-       <else>
-       <a href="${config.actionRoot}?module=Video&do=delete&id=${entry.id}&query_text=${utility.encodeHTML(data.query_text_encoded)}&query_field=${utility.encodeHTML(data.query_field)}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.offset}">${lang("delete")}</a>
-    | <a href="${config.actionRoot}?module=Video&do=edit&id=${entry.id}">${lang("edit")}</a>
-       </if>
-       </span></td>
-  </tr>
-  </list>
-  <tr>
-    <td colspan="4" class="darkgrey"><span class="witetext">${data.count} ${lang("records")}
-      / ${lang("show_from_to", data.from, data.to)}</span></td>
-    <td>&nbsp;</td>
-  </tr>
-
-<tr><td>
-<if data.prev>
-       <a href="${config.actionRoot}?module=Video&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.prev}&prev=zur&uuml;ck&cid=${data.cid}">zurueck</a>&nbsp;
-</if>
-<if data.next>
-<a href="${config.actionRoot}?module=Video&do=list&query_text=${data.query_text_encoded}&query_field=${data.query_field}&query_is_published=${data.query_is_published}&query_media_folder=${data.query_media_folder}&offset=${data.next}&next=weiter&cid=${data.cid}">weiter</a>
-</if>
-</td></tr>
-<else>
-  <tr><td align="center">${lang("no_matches_found")}</td></tr>
-</if>
-</table>
 <include "foot.template">
 </body>
 </html>
diff --git a/templates/error.template b/templates/error.template
deleted file mode 100755 (executable)
index 2a0395d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-<head>
-    <title>${config["Mir.Name"]} | ${lang("error.htmltitle")}</title>
-    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-</head>
-<body>
-<include "head.template">
-<table width="100%" border="0" align="center">
-       <tr class="grey">
-               <td>
-                       <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
-                       </div>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>
-                       <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
-                       <p>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p align="center">
-            ${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
-                       <p>
-               </td>
-       </tr>
-</table>
-<include "foot.template">
-</body>
-</html>
diff --git a/templates/usererror.template b/templates/usererror.template
deleted file mode 100755 (executable)
index fc61c25..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-<head>
-<title>${lang("usererror.htmltitle")}</title>
-</head>
-<body>
-<include "templates/admin/head_nonavi.template">
-<table width="100%" border="0" align="center">
-       <tr bgcolor="#006600">
-               <td>
-                       <div align="center"><h2><font color="Pink">${lang("usererror.title")}</font></h2>
-                       </div>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>${lang("usererror.text")}
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p>
-                       <p align="center"><font size="5" color="Red"><b> ${data.errorstring}</b></font>
-            <p>
-                       <p> 
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">${lang("usererror.what_to_do")}
-                       </a></font>
-                       <p>
-               </td>
-       </tr>
-</table>
-<include "foot.template">
-</body>
-</html>
index 28fd75a..4d5506a 100755 (executable)
 body  {
   margin: 6px; 
-  background-color: #ffffff; 
-  url(../img/bgimage.jpg) no-repeat;
+  background-color: #EEEEEE; 
 }
 
+/* ... basic font-def ... */
+
 h1, h2, h3, h4, h5, h6, p, li, dt, dd, div, td, blockquote {
   font-family: arial, helvetica, sans-serif;
 }
 
 h6, p, li, dt, dd, div, td, blockquote {
-  font-size: small;
+       font-family: arial, helvetica, sans-serif;
+  
+}
+
+/* ... boxes ... */
+
+.box_head {  
+       background-color:#006600; 
+       padding:2px;
+       margin:0px; 
+       border:2px solid #006600; 
+       color:#FFFFFF;
+}
+
+.box {  
+       background-color:#FFFFFF; 
+       padding:8px;
+       margin-top:0px;
+       margin-bottom:12px;
+       border:2px solid #006600; 
+
+}
+
+/* ... for MESSAGEBOX ... */
+
+.box_bg {  
+       background-color:#FFFFCC; 
+       padding:8px;
+       margin-top:0px;
+       margin-bottom:12px;
+       border:2px solid #006600;
+}
+
+/* ... creates indent ... */
+
+.box_invis {   
+       margin-top:4px;
+       margin-bottom:4px;
+       margin-left:12px;
+       margin-right:12px;
+       padding:4px;
 }
+
+.bg_neutral {
+       background-color:#DDDDDD; 
+}
+
+
+/* ... TABLE def ... */
+
+.table_head  {
+       color: #FFFFFF;
+       background-color: #990000;
+       font-weight: bold;
+       padding-right:8px;
+       padding-left:6px;
+}
+
+.table_left  {
+       color: #FFFFFF;
+       background-color: #006600;
+       font-size:1em;
+       font-weight: bold;
+       padding-top: 4px;
+       padding-bottom: 4px;
+       padding-right:8px;
+       padding-left:6px;
+}
+
+/* ... for unimportent fields ... */
+.table_left_light 
+ {
+       color: #FFFFFF;
+       background-color: #999999;
+       font-size:0.8em;
+       font-weight: bold;
+       padding-right:8px;
+       padding-left:6px;
+}
+
+.table_foot  {
+       color: #006600;
+       text-align:right;
+       font-weight: bold;
+       font-size:0.7em;
+       padding-right:6px;
+       padding-left:6px;
+       border-top:3px solid #990000;
        
-a:link                 {color: #cc0033;text-decoration:none;}
-a:visited                  {color: #660033;text-decoration:none;}
-a:hover                            {color: #ff3333;text-decoration:none;}
-
-.dark                  {background-color: #990000; color: #ffffff; text-decoration:none;}
-.middle         {background-color: #cc0033; color: #ffffff; text-decoration:none;}
-.pink           {background-color: #FF9966; color: #ffffff; text-decoration:none;}
-.darkgrey            {background-color: #999966; color: #000000; text-decoration:none;}
-.grey                  {background-color: #dddddd; color: #000000; text-decoration:none;}
-.litegrey            {background-color: #eeeeee; color: #990000; text-decoration:none;}
-.wite           {background-color: #ffffff; color: #990000; text-decoration:none;}
-.list1          {background-color: #FFFFCC; color: #000000; text-decoration:none;}
-.list2          {background-color: #FFCC99; color: #000000; text-decoration:none;}
-.list3          {background-color: #FFFF99; color: #000000; text-decoration:none;}
-.list4          {background-color: #CCCC99; color: #000000; text-decoration:none;}
-
-.pagetitle         {font-size: x-large; color: #cc0033; font-weight: bold;}
-.litetitel      {font-size: large;   color: #ffffff; font-weight: bold;}
-.darktitel      {font-size: large;   color: #cc0033; font-weight: bold;}
-.spezialtext    {font-size: small;   color: #CC0000;}
-.text           {font-size: small;}
-.small         {font-size: x-small;}
-.x-small             {font-size: xx-small;}
-
-.witetext            {font-size: large; color: #ffffff; text-decoration:none;}
-.witesmall         {font-size: small; color: #ffffff; text-decoration:none;}
-.witex-small     {font-size: x-small; color: #ffffff; text-decoration:none;}
+}
 
-.lynx            { display:none; }
 
-.editfieldname {
-  font-size: normal; 
-  color: #000000; 
-  font-weight: bold;
-  text-decoration:none;
-  background-color: #CCCCCC; 
+/* ... for striped Tables ... */
+.listrow1  {
+       color: #000000;
+       background-color: #FFFFFF;
+}
+.listrow2  {
+       color: #000000;
+       background-color: #FFFFCC;
+}
+.listrow3  {
+       color: #000000;
+       background-color: #FAFAC8;
+}
+.listrow4  {
+       color: #000000;
+       background-color: #F5F5F5;      
 }
 
-.menucommand {
-  font-family: arial, helvetica, sans-serif;
-  font-size: normal; 
-  font-weight: bold;
-  color: #CC0000;
+
+/* ... LINKS ... */
+a:link         {
+       color: #990000;
+       text-decoration:none;
 }
-   
-.majorcommand {
-  font-family: arial, helvetica, sans-serif;
-  font-size: normal; 
-  font-weight: bold;
-  color: #CC0000;
+a:visited      {
+       color: #990000;
+       text-decoration:none;
+}
+a:hover                {
+       color: #FFFFFF;
+       text-decoration:none;
+       background-color:#990000;
+}
+
+.link_box {  
+       background-color:#DDDDDD; 
+       font-size:0.9em;
+       padding:2px;
+       padding-left:8px;
+       padding-right:8px;
+       border:1px solid #990000; 
+}
+
+.link_help {  
+       background-color:#DDDDDD; 
+       font-size:0.9em;
+       padding:2px;
+       padding-left:8px;
+       padding-right:8px;
+       border:1px solid #003399;
+       color: #003399;
 }
-  
-.minorcommand {
-  font-family: arial, helvetica, sans-serif;
-  font-size: normal; 
-  font-weight: bold;
-  color: #CC0000;
-}  
 
-.majorbutton {
-  background-color: #CC0000;
-  color: #ffffff;
-  font-weight: bold;
+.link_help_small {  
+       background-color:#EEEEEE;
+       font-size:0.7em;
+       color: #003399;
 }
+
+
+/* ... for important text ... */
+.text_alert {
+       color: #CC0000;
+
+}
+
+
+.majorcommand {
+       font-weight: bold;
+} 
+
+.listcommand {
+       font-size: 0.7em;
+}  
+
+.small {font-size: 0.8em;}
+.x-small       {font-size: 0.7em;}
+
+.lynx            { display:none; }
+