From: mh Date: Tue, 5 Mar 2002 17:39:49 +0000 (+0000) Subject: first cut of merge of STABLE-pre1_0 into HEAD. I won't even guarantee that it X-Git-Tag: prexmlproducerconfig~295 X-Git-Url: http://erislabs.net/gitweb/?p=mir.git;a=commitdiff_plain;h=c6a2204d8d75293256fd17c07e54971d7672359a first cut of merge of STABLE-pre1_0 into HEAD. I won't even guarantee that it compiles.. but I actually think it is good. --- diff --git a/build.post-dist b/build.post-dist deleted file mode 100755 index b276eac9..00000000 --- a/build.post-dist +++ /dev/null @@ -1,10 +0,0 @@ -# -# -# This scpript can be copied to build.post and is automatically -# executed after execution of build.sh -# For expamples rsyncing the web-app to another server -# - - - - diff --git a/build.sh-dist b/build.sh-dist index 93bc2aca..097c5798 100755 --- a/build.sh-dist +++ b/build.sh-dist @@ -10,7 +10,7 @@ LOCALCLASSPATH=`echo /usr/share/java/*.jar | tr ' ' ':'` LIB_HOME=lib TOMCAT_HOME=/usr/share/tomcat -CP=$LIB_HOME/servlet.jar +CP=$LIB_HOME/servlet-2.2.jar CP=$CP:$ANT_HOME/ant.jar:$ANT_HOME/xerces.jar CP=$CP:$LOCALCLASSPATH CP=$CP:$TOMCAT_HOME/lib/tomcat.jar @@ -25,6 +25,10 @@ CP=$CP:$LIB_HOME/jai_core.jar CP=$CP:$JAVA_HOME/lib/tools.jar CP=$CP:$JAVA_HOME/lib/rt.jar CP=$CP:$LIB_HOME/strutsmesg.jar +CP=$CP:$LIB_HOME/poolman.jar +CP=$CP:$LIB_HOME/log4j.jar +CP=$CP:$LIB_HOME/jdbc-se2.0.jar +CP=$CP:$LIB_HOME/postgresql.jar # The path to ANT #ANT_HOME=/usr/share/ant/lib # use own ant @@ -35,12 +39,5 @@ ANT_HOME=LIB_HOME # use mir-ant $JAVA_HOME/bin/java -classpath $CP:$CLASSPATH org.apache.tools.ant.Main \ -Dtomcat.home=$TOMCAT_HOME "$@" - -# -# execute postbuild script if present - -if [ -f ./build.post ]; then - echo "Executing build.post" - sh build.post -fi - +# Set permissions correctly +./perms.sh-dist diff --git a/build.xml b/build.xml index 83bbe4c7..11c97f75 100755 --- a/build.xml +++ b/build.xml @@ -38,7 +38,6 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Now you should call perms.sh(-dist) in order to set + the permissions of your installed files to a meaningful + value. + Have fun with Mir! + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dbscripts/conversion/mir_oid.pl b/dbscripts/conversion/mir_oid.pl new file mode 100755 index 00000000..6fa27a3e --- /dev/null +++ b/dbscripts/conversion/mir_oid.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w +use Pg; + +#if (!defined($ARGV[0])) { +# print "Usage: $0 name_of_filelist_file\n"; +# exit 1; +#} + +#$dump="$ARGV[0]"; + +my $conn = Pg::connectdb("dbname=indy3 user=postgres +host=localhost"); +( PGRES_CONNECTION_OK eq $conn->status ) + and print "Pg::connectdb ........... ok\n" + or die "Pg::connectdb ........... not ok: ", $conn->errorMessage; + + + #open(DUMP,"$dump") || die "can't open dump file $dump"; + + #$basedir="/cdrom"; + +Pg::doQuery($conn, "select content_data from content", \@ary); + +for $i ( 0 .. $#ary ) { + for $j ( 0 .. $#{$ary[$i]} ) { + print "$ary[$i][$j]\t"; + } + print "\n"; +} + +#while() { +# chomp; +# next if (/^$/ || /^\s*$/); +# +# # exception liste einlesen... +# +# +# # hier insert: +# +# $conn->exec("BEGIN"); +# $oid= $conn->lo_import("$filename"); +# print $conn->errorMessage."\n"; +# print "trying to insert icon\n"; +# $ioid= $conn->lo_import("/tmp/iconblob.jpg"); +# print $conn->errorMessage."\n"; +# $sql="INSERT INTO images +#(title,date,place,author,to_img_layout,to_img_type,is_classified,to_media_f +#older,to_img_color,comment,webdb_create,img_width,img_height,image_data,ico +#n_data) ". +# "VALUES ('".$titel."','20010108','".$ort. +# "','Hoch die Kampf +#dem','".$layout."','1','0','2','2','".$comment."',now(),'".$img_width."','" +#.$img_height. +# "','".$oid."','".$ioid."')"; +# print $sql."\n"; +# $conn->exec( $sql ); +# print $conn->errorMessage."\n"; +# $conn->exec("END"); +# +# +# +#} +## end of while +# + + + diff --git a/dbscripts/create_pg.sql b/dbscripts/create_pg.sql index c8936554..997dfcd3 100755 --- a/dbscripts/create_pg.sql +++ b/dbscripts/create_pg.sql @@ -3,7 +3,7 @@ -- \connect - postgres -- --- TOC Entry ID 2 (OID 28714) +-- TOC Entry ID 2 (OID 19796) -- -- Name: media_id_seq Type: SEQUENCE Owner: postgres -- @@ -11,7 +11,7 @@ CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 3 (OID 28733) +-- TOC Entry ID 3 (OID 19815) -- -- Name: media_folder_id_seq Type: SEQUENCE Owner: postgres -- @@ -19,7 +19,7 @@ CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue CREATE SEQUENCE "media_folder_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 5 (OID 28771) +-- TOC Entry ID 4 (OID 19834) -- -- Name: feature_id_seq Type: SEQUENCE Owner: postgres -- @@ -27,7 +27,7 @@ CREATE SEQUENCE "media_folder_id_seq" start 1 increment 1 maxvalue 2147483647 mi CREATE SEQUENCE "feature_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 6 (OID 28790) +-- TOC Entry ID 5 (OID 19853) -- -- Name: topic_id_seq Type: SEQUENCE Owner: postgres -- @@ -35,7 +35,7 @@ CREATE SEQUENCE "feature_id_seq" start 1 increment 1 maxvalue 2147483647 minvalu CREATE SEQUENCE "topic_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 7 (OID 28809) +-- TOC Entry ID 6 (OID 19872) -- -- Name: webdb_users_id_seq Type: SEQUENCE Owner: postgres -- @@ -43,7 +43,7 @@ CREATE SEQUENCE "topic_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue CREATE SEQUENCE "webdb_users_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 8 (OID 28828) +-- TOC Entry ID 7 (OID 19891) -- -- Name: comment_id_seq Type: SEQUENCE Owner: postgres -- @@ -51,7 +51,7 @@ CREATE SEQUENCE "webdb_users_id_seq" start 1 increment 1 maxvalue 2147483647 min CREATE SEQUENCE "comment_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 9 (OID 28847) +-- TOC Entry ID 8 (OID 19910) -- -- Name: breaking_id_seq Type: SEQUENCE Owner: postgres -- @@ -59,7 +59,7 @@ CREATE SEQUENCE "comment_id_seq" start 1 increment 1 maxvalue 2147483647 minvalu CREATE SEQUENCE "breaking_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 10 (OID 28866) +-- TOC Entry ID 9 (OID 19929) -- -- Name: messages_id_seq Type: SEQUENCE Owner: postgres -- @@ -67,7 +67,7 @@ CREATE SEQUENCE "breaking_id_seq" start 1 increment 1 maxvalue 2147483647 minval CREATE SEQUENCE "messages_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 10 (OID 28866) +-- TOC Entry ID 10 (OID 19948) -- -- Name: media_type_id_seq Type: SEQUENCE Owner: postgres -- @@ -75,7 +75,7 @@ CREATE SEQUENCE "messages_id_seq" start 1 increment 1 maxvalue 2147483647 minval CREATE SEQUENCE "media_type_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 12 (OID 28885) +-- TOC Entry ID 12 (OID 19967) -- -- Name: media_folder Type: TABLE Owner: postgres -- @@ -92,13 +92,13 @@ CREATE TABLE "media_folder" ( ); -- --- TOC Entry ID 13 (OID 28918) +-- TOC Entry ID 13 (OID 20000) -- -- Name: media_type Type: TABLE Owner: postgres -- CREATE TABLE "media_type" ( - "id" integer DEFAULT nextval('media_type_id_seq'::text) NOT NULL, + "id" integer DEFAULT nextval('media_type_id_seq'::text) NOT NULL, "name" character varying(80) NOT NULL, "mime_type" character varying(40) NOT NULL, "classname" character varying(80) NOT NULL, @@ -107,7 +107,7 @@ CREATE TABLE "media_type" ( ); -- --- TOC Entry ID 14 (OID 28932) +-- TOC Entry ID 14 (OID 20016) -- -- Name: img_format Type: TABLE Owner: postgres -- @@ -121,7 +121,7 @@ CREATE TABLE "img_format" ( ); -- --- TOC Entry ID 15 (OID 28946) +-- TOC Entry ID 15 (OID 20030) -- -- Name: img_layout Type: TABLE Owner: postgres -- @@ -132,7 +132,7 @@ CREATE TABLE "img_layout" ( ); -- --- TOC Entry ID 16 (OID 28957) +-- TOC Entry ID 16 (OID 20041) -- -- Name: img_type Type: TABLE Owner: postgres -- @@ -143,7 +143,7 @@ CREATE TABLE "img_type" ( ); -- --- TOC Entry ID 17 (OID 28968) +-- TOC Entry ID 17 (OID 20052) -- -- Name: img_color Type: TABLE Owner: postgres -- @@ -154,7 +154,7 @@ CREATE TABLE "img_color" ( ); -- --- TOC Entry ID 18 (OID 28979) +-- TOC Entry ID 18 (OID 20063) -- -- Name: language Type: TABLE Owner: postgres -- @@ -167,7 +167,7 @@ CREATE TABLE "language" ( ); -- --- TOC Entry ID 19 (OID 28994) +-- TOC Entry ID 19 (OID 20078) -- -- Name: rights Type: TABLE Owner: postgres -- @@ -180,7 +180,7 @@ CREATE TABLE "rights" ( ); -- --- TOC Entry ID 21 (OID 29043) +-- TOC Entry ID 20 (OID 20108) -- -- Name: feature Type: TABLE Owner: postgres -- @@ -196,7 +196,7 @@ CREATE TABLE "feature" ( ); -- --- TOC Entry ID 22 (OID 29078) +-- TOC Entry ID 21 (OID 20143) -- -- Name: webdb_users Type: TABLE Owner: postgres -- @@ -210,7 +210,7 @@ CREATE TABLE "webdb_users" ( ); -- --- TOC Entry ID 23 (OID 29096) +-- TOC Entry ID 22 (OID 20161) -- -- Name: content_x_topic Type: TABLE Owner: postgres -- @@ -221,7 +221,7 @@ CREATE TABLE "content_x_topic" ( ); -- --- TOC Entry ID 24 (OID 29107) +-- TOC Entry ID 23 (OID 20172) -- -- Name: article_type Type: TABLE Owner: postgres -- @@ -232,7 +232,7 @@ CREATE TABLE "article_type" ( ); -- --- TOC Entry ID 25 (OID 29118) +-- TOC Entry ID 24 (OID 20183) -- -- Name: topic Type: TABLE Owner: postgres -- @@ -249,7 +249,7 @@ CREATE TABLE "topic" ( ); -- --- TOC Entry ID 26 (OID 29154) +-- TOC Entry ID 25 (OID 20219) -- -- Name: comment Type: TABLE Owner: postgres -- @@ -268,14 +268,12 @@ CREATE TABLE "comment" ( "to_language" integer DEFAULT '0' NOT NULL, "to_media" integer NOT NULL, "to_comment_status" smallint, - "checksum" integer, + "checksum" integer, Constraint "comment_pkey" Primary Key ("id") ); -CREATE INDEX comment_checksum_index ON comment (checksum); - -- --- TOC Entry ID 27 (OID 29196) +-- TOC Entry ID 26 (OID 20266) -- -- Name: media Type: TABLE Owner: postgres -- @@ -286,7 +284,6 @@ CREATE TABLE "media" ( "subtitle" character varying(30), "edittitle" character varying(30), "date" character(8) NOT NULL, - "place" character varying(80), "creator" character varying(80), "creator_main_url" character varying(255), "creator_email" character varying(80), @@ -313,13 +310,7 @@ CREATE TABLE "media" ( ); -- --- TOC Entry ID 28 (OID 29257) --- --- Name: images Type: TABLE Owner: postgres --- - --- --- TOC Entry ID 32 (OID 29446) +-- TOC Entry ID 27 (OID 20326) -- -- Name: uploaded_media Type: TABLE Owner: postgres -- @@ -327,14 +318,19 @@ CREATE TABLE "media" ( CREATE TABLE "uploaded_media" ( "icon_is_produced" boolean DEFAULT '0' NOT NULL, "icon_path" character varying(255), - "size" integer -) INHERITS ("media"); + "size" integer +) +INHERITS ("media"); + +-- +-- TOC Entry ID 28 (OID 20392) +-- +-- Name: images Type: TABLE Owner: postgres +-- CREATE TABLE "images" ( "image_data" oid, "icon_data" oid, - "icon_is_produced" boolean DEFAULT '0' NOT NULL, - "icon_path" character varying(255), "year" character varying(40), "img_width" smallint, "img_height" smallint, @@ -345,10 +341,10 @@ CREATE TABLE "images" ( "icon_width" smallint, "icon_height" smallint ) -INHERITS ("media"); +INHERITS ("uploaded_media"); -- --- TOC Entry ID 29 (OID 29338) +-- TOC Entry ID 29 (OID 20474) -- -- Name: content Type: TABLE Owner: postgres -- @@ -358,18 +354,14 @@ CREATE TABLE "content" ( "link_url" character varying(255), "is_html" boolean DEFAULT '0' NOT NULL, "is_stored" boolean DEFAULT '0' NOT NULL, - "is_mail_sent" boolean DEFAULT '1' NOT NULL, - "is_digest_sent" boolean DEFAULT '1' NOT NULL, "to_article_type" smallint DEFAULT '0' NOT NULL, "to_content" integer, "checksum" integer ) INHERITS ("media"); -CREATE INDEX content_checksum_index ON content (checksum); - -- --- TOC Entry ID 30 (OID 29418) +-- TOC Entry ID 30 (OID 20549) -- -- Name: breaking Type: TABLE Owner: postgres -- @@ -381,7 +373,7 @@ CREATE TABLE "breaking" ( ); -- --- TOC Entry ID 31 (OID 29431) +-- TOC Entry ID 31 (OID 20562) -- -- Name: messages Type: TABLE Owner: postgres -- @@ -395,7 +387,7 @@ CREATE TABLE "messages" ( ); -- --- TOC Entry ID 33 (OID 30026) +-- TOC Entry ID 32 (OID 20577) -- -- Name: comment_status Type: TABLE Owner: postgres -- @@ -406,7 +398,7 @@ CREATE TABLE "comment_status" ( ); -- --- TOC Entry ID 34 (OID 30064) +-- TOC Entry ID 33 (OID 20588) -- -- Name: content_x_media Type: TABLE Owner: postgres -- @@ -417,7 +409,7 @@ CREATE TABLE "content_x_media" ( ); -- --- TOC Entry ID 11 (OID 32812) +-- TOC Entry ID 11 (OID 20599) -- -- Name: links_imcs_id_seq Type: SEQUENCE Owner: postgres -- @@ -425,7 +417,7 @@ CREATE TABLE "content_x_media" ( CREATE SEQUENCE "links_imcs_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- --- TOC Entry ID 35 (OID 32831) +-- TOC Entry ID 34 (OID 20618) -- -- Name: links_imcs Type: TABLE Owner: postgres -- @@ -441,7 +433,41 @@ CREATE TABLE "links_imcs" ( ); -- --- TOC Entry ID 40 (OID 29078) +-- TOC Entry ID 35 (OID 37215) +-- +-- Name: audio Type: TABLE Owner: postgres +-- + +CREATE TABLE "audio" ( + "audio_data" oid, + "kbits" smallint +) +INHERITS ("uploaded_media"); + +-- +-- TOC Entry ID 36 (OID 37284) +-- +-- Name: video Type: TABLE Owner: postgres +-- + +CREATE TABLE "video" ( + "video_data" oid +) +INHERITS ("uploaded_media"); + +-- +-- TOC Entry ID 37 (OID 45396) +-- +-- Name: other_media Type: TABLE Owner: postgres +-- + +CREATE TABLE "other_media" ( + +) +INHERITS ("uploaded_media"); + +-- +-- TOC Entry ID 40 (OID 20143) -- -- Name: "idx_webdb_user_log_pas_is_admin" Type: INDEX Owner: postgres -- @@ -449,7 +475,7 @@ CREATE TABLE "links_imcs" ( CREATE INDEX "idx_webdb_user_log_pas_is_admin" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops", "is_admin" "bool_ops" ); -- --- TOC Entry ID 44 (OID 29078) +-- TOC Entry ID 41 (OID 20143) -- -- Name: "idx_webdb_user_log_pas" Type: INDEX Owner: postgres -- @@ -457,7 +483,7 @@ CREATE INDEX "idx_webdb_user_log_pas_is_admin" on "webdb_users" using btree ( " CREATE INDEX "idx_webdb_user_log_pas" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops" ); -- --- TOC Entry ID 43 (OID 29096) +-- TOC Entry ID 42 (OID 20161) -- -- Name: "idx_content" Type: INDEX Owner: postgres -- @@ -465,7 +491,7 @@ CREATE INDEX "idx_webdb_user_log_pas" on "webdb_users" using btree ( "login" "v CREATE UNIQUE INDEX "idx_content" on "content_x_topic" using btree ( "content_id" "int4_ops", "topic_id" "int4_ops" ); -- --- TOC Entry ID 45 (OID 29096) +-- TOC Entry ID 43 (OID 20161) -- -- Name: "idx_topic" Type: INDEX Owner: postgres -- @@ -473,7 +499,7 @@ CREATE UNIQUE INDEX "idx_content" on "content_x_topic" using btree ( "content_id CREATE UNIQUE INDEX "idx_topic" on "content_x_topic" using btree ( "topic_id" "int4_ops", "content_id" "int4_ops" ); -- --- TOC Entry ID 46 (OID 29118) +-- TOC Entry ID 44 (OID 20183) -- -- Name: "idx_topic_title" Type: INDEX Owner: postgres -- @@ -481,7 +507,7 @@ CREATE UNIQUE INDEX "idx_topic" on "content_x_topic" using btree ( "topic_id" "i CREATE INDEX "idx_topic_title" on "topic" using btree ( "title" "varchar_ops" ); -- --- TOC Entry ID 51 (OID 29118) +-- TOC Entry ID 45 (OID 20183) -- -- Name: "idx_topic_id" Type: INDEX Owner: postgres -- @@ -489,7 +515,15 @@ CREATE INDEX "idx_topic_title" on "topic" using btree ( "title" "varchar_ops" ) CREATE UNIQUE INDEX "idx_topic_id" on "topic" using btree ( "id" "int4_ops" ); -- --- TOC Entry ID 36 (OID 29154) +-- TOC Entry ID 38 (OID 20219) +-- +-- Name: "comment_checksum_index" Type: INDEX Owner: postgres +-- + +CREATE INDEX "comment_checksum_index" on "comment" using btree ( "checksum" "int4_ops" ); + +-- +-- TOC Entry ID 46 (OID 20219) -- -- Name: "idx_comment_to_media" Type: INDEX Owner: postgres -- @@ -497,7 +531,25 @@ CREATE UNIQUE INDEX "idx_topic_id" on "topic" using btree ( "id" "int4_ops" ); CREATE INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "int4_ops" ); -- --- TOC Entry ID 47 (OID 29257) + +-- +-- TOC Entry ID 59 (OID 20326) +-- +-- Name: "idx_uploaded_media_id" Type: INDEX Owner: postgres +-- + +CREATE UNIQUE INDEX "idx_uploaded_media_id" on "uploaded_media" using btree ( "id" "int4_ops" ); + +-- +-- TOC Entry ID 60 (OID 20326) +-- +-- Name: "idx_uploaded_media_is_published" Type: INDEX Owner: postgres +-- + +CREATE UNIQUE INDEX "idx_uploaded_media_is_published" on "uploaded_media" using btree ( "id" "int4_ops", "is_published" "bool_ops" ); + +-- +-- TOC Entry ID 47 (OID 20392) -- -- Name: "idx_images_is_published__icon_i" Type: INDEX Owner: postgres -- @@ -505,7 +557,7 @@ CREATE INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "int4 CREATE INDEX "idx_images_is_published__icon_i" on "images" using btree ( "is_published" "bool_ops", "icon_is_produced" "bool_ops" ); -- --- TOC Entry ID 49 (OID 29257) +-- TOC Entry ID 48 (OID 20392) -- -- Name: "idx_images_id" Type: INDEX Owner: postgres -- @@ -513,7 +565,15 @@ CREATE INDEX "idx_images_is_published__icon_i" on "images" using btree ( "is_pu CREATE UNIQUE INDEX "idx_images_id" on "images" using btree ( "id" "int4_ops" ); -- --- TOC Entry ID 37 (OID 29338) +-- TOC Entry ID 39 (OID 20474) +-- +-- Name: "content_checksum_index" Type: INDEX Owner: postgres +-- + +CREATE INDEX "content_checksum_index" on "content" using btree ( "checksum" "int4_ops" ); + +-- +-- TOC Entry ID 49 (OID 20474) -- -- Name: "idx_content_to_article_type" Type: INDEX Owner: postgres -- @@ -521,7 +581,7 @@ CREATE UNIQUE INDEX "idx_images_id" on "images" using btree ( "id" "int4_ops" ); CREATE INDEX "idx_content_to_article_type" on "content" using btree ( "to_article_type" "int2_ops" ); -- --- TOC Entry ID 38 (OID 29338) +-- TOC Entry ID 50 (OID 20474) -- -- Name: "idx_content_is_produced" Type: INDEX Owner: postgres -- @@ -529,7 +589,7 @@ CREATE INDEX "idx_content_to_article_type" on "content" using btree ( "to_artic CREATE INDEX "idx_content_is_produced" on "content" using btree ( "is_produced" "bool_ops" ); -- --- TOC Entry ID 39 (OID 29338) +-- TOC Entry ID 51 (OID 20474) -- -- Name: "idx_content_is_published__to_ar" Type: INDEX Owner: postgres -- @@ -537,7 +597,7 @@ CREATE INDEX "idx_content_is_produced" on "content" using btree ( "is_produced" CREATE INDEX "idx_content_is_published__to_ar" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops" ); -- --- TOC Entry ID 41 (OID 29338) +-- TOC Entry ID 52 (OID 20474) -- -- Name: "idx_content_is_stored" Type: INDEX Owner: postgres -- @@ -545,7 +605,7 @@ CREATE INDEX "idx_content_is_published__to_ar" on "content" using btree ( "is_p CREATE INDEX "idx_content_is_stored" on "content" using btree ( "is_stored" "bool_ops" ); -- --- TOC Entry ID 42 (OID 29338) +-- TOC Entry ID 53 (OID 20474) -- -- Name: "idx_content_is_published__id" Type: INDEX Owner: postgres -- @@ -553,7 +613,7 @@ CREATE INDEX "idx_content_is_stored" on "content" using btree ( "is_stored" "bo CREATE INDEX "idx_content_is_published__id" on "content" using btree ( "is_published" "bool_ops", "id" "int4_ops" ); -- --- TOC Entry ID 48 (OID 29338) +-- TOC Entry ID 54 (OID 20474) -- -- Name: "idx_content_is_pub__to_art__to_" Type: INDEX Owner: postgres -- @@ -561,7 +621,7 @@ CREATE INDEX "idx_content_is_published__id" on "content" using btree ( "is_publ CREATE INDEX "idx_content_is_pub__to_art__to_" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops", "id" "int4_ops" ); -- --- TOC Entry ID 50 (OID 29338) +-- TOC Entry ID 55 (OID 20474) -- -- Name: "idx_content_id" Type: INDEX Owner: postgres -- @@ -569,7 +629,7 @@ CREATE INDEX "idx_content_is_pub__to_art__to_" on "content" using btree ( "is_p CREATE UNIQUE INDEX "idx_content_id" on "content" using btree ( "id" "int4_ops" ); -- --- TOC Entry ID 52 (OID 30064) +-- TOC Entry ID 56 (OID 20588) -- -- Name: "idx_content_media" Type: INDEX Owner: postgres -- @@ -577,10 +637,60 @@ CREATE UNIQUE INDEX "idx_content_id" on "content" using btree ( "id" "int4_ops" CREATE UNIQUE INDEX "idx_content_media" on "content_x_media" using btree ( "content_id" "int4_ops", "media_id" "int4_ops" ); -- --- TOC Entry ID 53 (OID 30064) +-- TOC Entry ID 57 (OID 20588) -- -- Name: "idx_media_content" Type: INDEX Owner: postgres -- CREATE UNIQUE INDEX "idx_media_content" on "content_x_media" using btree ( "media_id" "int4_ops", "content_id" "int4_ops" ); +-- +-- TOC Entry ID 62 (OID 37215) +-- +-- Name: "idx_audio_is_published_produced" Type: INDEX Owner: postgres +-- + +CREATE INDEX "idx_audio_is_published_produced" on "audio" using btree ( "is_published" "bool_ops", "is_produced" "bool_ops" ); + +-- +-- TOC Entry ID 64 (OID 37215) +-- +-- Name: "idx_audio_id" Type: INDEX Owner: postgres +-- + +CREATE UNIQUE INDEX "idx_audio_id" on "audio" using btree ( "id" "int4_ops" ); + +-- +-- TOC Entry ID 65 (OID 37215) +-- +-- Name: "idx_video_id" Type: INDEX Owner: postgres +-- + +CREATE UNIQUE INDEX "idx_video_id" on "audio" using btree ( "id" "int4_ops" ); + +-- +-- TOC Entry ID 63 (OID 37284) +-- +-- Name: "idx_video_is_published_produced" Type: INDEX Owner: postgres +-- + +CREATE INDEX "idx_video_is_published_produced" on "video" using btree ( "is_published" "bool_ops", "is_produced" "bool_ops" ); + + +-- +-- TOC Entry ID 37 (OID 520246) +-- +-- Name: "idx_content_is_published" Type: INDEX Owner: postgres +-- + +CREATE INDEX "idx_content_is_published" on "content" using btree ( "is_published" "bool_ops" ); + +-- +-- TOC Entry ID 47 (OID 465036) +-- +-- Name: "idx_comment_tomedia_ispublished" Type: INDEX Owner: postgres +-- + +CREATE INDEX "idx_comment_tomedia_ispublished" on "comment" using btree ( "to_media" "int4_ops", "is_published" "bool_ops" ); + + diff --git a/dbscripts/create_views.sql b/dbscripts/create_views.sql deleted file mode 100755 index 2d70c9b7..00000000 --- a/dbscripts/create_views.sql +++ /dev/null @@ -1,14 +0,0 @@ --- --- create_views.sql --- - - --- TESTING: --- --- creating list views in database to speed up selection of lists. --- - - -CREATE VIEW v_content_list AS - SELECT id, title, subtitle, date, place, creator, description, comment, is_published, - is_produced, to_feature, webdb_create, webdb_lastchange FROM content; \ No newline at end of file diff --git a/dbscripts/populate_mediatyp.sql b/dbscripts/populate_mediatyp.sql index fe5a71d5..1bdd7e05 100755 --- a/dbscripts/populate_mediatyp.sql +++ b/dbscripts/populate_mediatyp.sql @@ -2,7 +2,7 @@ -- Selected TOC Entries: -- -- --- Data for TOC Entry ID 2 (OID 88609) +-- Data for TOC Entry ID 2 (OID 46975) -- -- Name: media_type Type: TABLE DATA Owner: postgres -- @@ -12,27 +12,25 @@ -- Disable triggers UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" = 'media_type'; -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (2,'unknown','application/octet-stream','Generic','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (3,'jpg','image/gif','ImagesGif','Images',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (4,'mp3','audio/mp3','Mp3','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (5,'jpg','image/jpeg','ImagesJpeg','Images',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (6,'pdf','application/pdf','Generic','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (7,'mpg','video/mpeg','Video','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (8,'mov','video/quicktime','Video','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (9,'avi','video/x-msvideo','Video','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (10,'ra','audio/vnd.rn-realaudio','RealAudio','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (11,'rm','video/vnd.rn-realvideo','RealVideo','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (12,'ra','audio/x-pn-realaudio','RealAudio','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (13,'mp3','audio/x-mp3','Mp3','UploadedMedia',NULL); -INSERT INTO "media_type" ("id","name","mime_type","classname","tablename","dcname") VALUES (14,'mp3','audio/x-mpeg','Mp3','UploadedMedia',NULL); - - +INSERT INTO "media_type" VALUES (4,'mp3','audio/mp3','Mp3','Audio',NULL); +INSERT INTO "media_type" VALUES (13,'mp3','audio/x-mp3','Mp3','Audio',NULL); +INSERT INTO "media_type" VALUES (14,'mp3','audio/x-mpeg','Mp3','Audio',NULL); +INSERT INTO "media_type" VALUES (10,'ra','audio/vnd.rn-realaudio','RealAudio','Audio',NULL); +INSERT INTO "media_type" VALUES (12,'ra','audio/x-pn-realaudio','RealAudio','Audio',NULL); +INSERT INTO "media_type" VALUES (11,'rm','video/vnd.rn-realvideo','RealVideo','Audio',NULL); +INSERT INTO "media_type" VALUES (8,'mov','video/quicktime','Video','Video',NULL); +INSERT INTO "media_type" VALUES (7,'mpg','video/mpeg','Video','Video',NULL); +INSERT INTO "media_type" VALUES (9,'avi','video/x-msvideo','Video','Video',NULL); +INSERT INTO "media_type" VALUES (2,'unknown','application/octet-stream','Generic','Other',NULL); +INSERT INTO "media_type" VALUES (6,'pdf','application/pdf','Generic','Other',NULL); +INSERT INTO "media_type" VALUES (15,'png','image/*','Images','Images',NULL); +INSERT INTO "media_type" VALUES (3,'jpg','- deprecated -','Images','Images',NULL); +INSERT INTO "media_type" VALUES (5,'jpg','- deprecated -','Images','Images',NULL); -- Enable triggers - UPDATE pg_class SET reltriggers = (SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) WHERE relname = 'media_type'; -- --- TOC Entry ID 1 (OID 88557) +-- TOC Entry ID 1 (OID 46923) -- -- Name: media_type_id_seq Type: SEQUENCE SET Owner: -- diff --git a/doc/INSTALL.mir b/doc/INSTALL.mir index 4e255adc..06f1a0b4 100755 --- a/doc/INSTALL.mir +++ b/doc/INSTALL.mir @@ -28,10 +28,6 @@ CVS CHECKOUT: now customize config.properties for your needs. - modify etc/web.xml to change the xml-config - parameter to point to where your server.xml file is - (in ../Mir i.e /path/to/Mir/server.xml) - 3. configure the build.sh file with java_home cp build.sh-dist build.sh @@ -41,7 +37,9 @@ now customize config.properties for your needs. 4. copy the mir/templates-dist-directory to mir/templates -5. compile +5. compile (do this as root so the permissions script is able to set +the permissions and owners correctly). + sh build.sh @@ -74,13 +72,14 @@ as user postgres: cat dbscripts/help*.sql | psql -Upostgres dbname cat dbscripts/populate*.sql | psql -Upostgres dbname + 10. Add the dupe prevention trigger to the database: cd dbscripts/dupetrigger There, read INSTALL and follow the instructions. -11. Set permissions +11. Set permissions -- IMPORTANT! READ THIS! We provide a script that sets all files' and direcories' permissions to a quite reasonable state. The most important thing you have to do after the invokation of this script is to ensure that the log files -- @@ -139,25 +138,10 @@ You should make sure that no copy of config.properties (neither in mir nor in Mir/src nor in Mir/WEB-INF/classes) is world-readable. Else you wouldn't have to install a password, anyway. -If you can't access PostgreSQL after this for any reason, try to change -"password" in /etc/postgresql/pg_hba.conf into "trust". This should disable +If you can't access PostgreSQL after this for any reason, try and change +"password" in /etc/postgresql/pg_hba.conf to "trust". This should disable any authentication method and make the database accessible again. -15. configure apache's mod_mime to recognize .m3u and .pls files: - -The web server (of the media host) must recognize the .m3u and .pls file -extensions and send the proper "audio/x-mpegurl" and "audio/x-scpls" mime-types -respectively. If the web server is apache, it's easy, just add: - * -audio/x-mpegurl m3u -audio/x-scpl pls - * -to the file pointed to by the "TypesConfig" command in your apache config file. -Or add and equivalent AddType command to your httpd.conf. Of course this -assumes that the mod_mime is loaded. - * -If the web server is not apache, then your on your own. - that's it :) now the admin-application is accesable via: @@ -169,3 +153,14 @@ and the openposting-servlet via http://host/OpenMir standard login is redaktion/indymedia + + + +TROUBLESHOOTING + +You can give these a try if anything goes wrong: + ++ Restart Tomcat. Especially after compiling the sources Tomcat has to be + restarted. + ++ Check file permissions and ownership. Try and run perms.sh. \ No newline at end of file diff --git a/doc/INSTALL.postgresql b/doc/INSTALL.postgresql index bedb96e8..061d471f 100755 --- a/doc/INSTALL.postgresql +++ b/doc/INSTALL.postgresql @@ -61,7 +61,7 @@ change to the start-scripts folder in the contrib-part. edit the start-script in /etc/init.d/postgresql, and make sure postgresql is started with the "-i" option. to enable this insert - "-o '-i'" after 'start', which should look like: + '-o "-i"' after 'start', which should look like: start) $ECHO_N "Starting PostgreSQL: "$ECHO_C diff --git a/doc/MAINTENANCE b/doc/MAINTENANCE index 0b1d2d35..907411a1 100755 --- a/doc/MAINTENANCE +++ b/doc/MAINTENANCE @@ -6,3 +6,12 @@ this generates a dir with all blobs and a sql-file with all data. To restore the database: psql < .sql pgdump_lo -i -d -s /dumpdir/dir + +Every once in a while (or make a script) postgresql database should +be "cleaned". See postgresql docs for commands VACUUM and VACUUM ANALYZE + +Every once in a while (or make a script) postgresql database should +be "cleaned". See postgresql docs for commands VACUUM and VACUUM ANALYZE + +We also have misc. perl scripts to merge Large Objects from other DB's. +these can be used as a basis to write your own custom scripts. diff --git a/doc/TODO.txt b/doc/TODO.txt index 8bd1fac2..1bc5261c 100755 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -1,62 +1,94 @@ -[Updated 26.10.2001. -mh] +[Updated 28.02.2002. -mh] + +General/Forever valid: + +a) watch performance.. mimimize SQL +b) try to use more freemarker feature like transformations when possible +instead of putting it in Java code. i.e make it more localizable. Version 1.0: Bugfixes/Improvements: a) installation-procedure -- config.porperties has to be cleaned and has to be better documentated. (half done, mh) --> config.properties is being replaced with new config system. -- build.sh should be more intelligent. -- templates-directory should be splittet in two directories: "internal"- (openmir and mir -templates) and "external"-templates (producer-templates) +- templates-directory should be splittet in two directories: "internal"- (openmir and mir templates) and "external"-templates (producer-templates) +- build.sh should be more intelligent. (underway, convert to build.xml, mj) b) code-cleaning - the variable-names for the freemarker should be better: the same name for the same thing c) We have to make sure that all errors are handled intelligently. e.g. if an -article is corrupt, do we just ignore it, etc.. -d) Admin interface needs to be made aware of media handlers (mj) -e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (mh) - -c) documentation +article is corrupt, do we just ignore it, etc.. (done, mh) +d) Admin interface needs to be made aware of media handlers (mh, tob) +e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (done, mh) (in 1.1 to be done via transactions) +f) documentation - it lacks a documentation for creating the producer-templates -d) new layout Mir/OpenMir (gilad) -e) translating the templates/code-comments to english -f) mission-statement and licensing -g) there are no memory-leaks +g) new layout Mir/OpenMir (underway, indy de team??) +h) translating the templates/code-comments to english (underway, mir-coders) +i) mission-statement and licensing +j) there are no memory-leaks (3/4 confirmed) +k) tomcat 4.x (needs testing) +l) poolman (done, idfx) +m) re-tweak media infrastructure (underway, -mh) + - wildcard support for content-type mappings (done) + - handle all image types and transparency (done) + - convert other media types for DB storage for consistency (started, mh) + - handle generic media + - better extension handling + - handle external meta links + - rework creation of audio (video too?) meta-data + - make getUrl() return a list of SimpleHashes + - use added flexibility in templates + - add miless code for better secondary content-type guessing. i.e read the + bytes +n) CVS id, author stamps +o) make Entity implement freemarke TemplateModel (done, rk) +p) don't use deprecated methods. specifically the SimpleList stuff New Features: a) Multifile-Upload in OpenMir and Mir (done, idfx) -b) Video and audio-upload in OpenMir and Mir: How will this files be stored, what has to -be done in the producer-code? (done, mh) +b) Video and audio-upload in OpenMir and Mir: How will this files be stored, what has to be done in the producer-code? (done, mh) c) Coverage: Alternative start-page for e.g. a event like genua. every article that has something to do with this event can be seen on this page. (nn) -d) Multilanguage-Support (Step 1): Producing html-pages with navigation for every -language. Topics and coverage-titles have to be saved in the db in every language that is -needed. (idfx) A -d.1) Templates should be made common for all languages. (kellan) e) It should be possible to choose between direct and indirect open posting. (09/14/2001, done, idfx). -f) Editing producer-templates in the mir-servlet. (idfx) g) "Upcoming Events"-include-file (ha) -e) indymedia-links (fh) +h) indymedia-links (fh) +i) objectStore (underway, -rk) Version 1.1: +Vital: +a) Multilanguage-Support (Step 1): Producing html-pages with navigation for every +language. Topics and coverage-titles have to be saved in the db in every language that is +needed. (idfx) +a.1) Templates should be made common for all languages. (kellan, br1) New Features: a) Multilanguage-Support (Step 2): Separate OpenMir-servlet to publish a tranlation of an article. If a article has translations, only the translated versions are produced in the language the translated article is. +b) single template for all languages. i.e use gettext like system for templates. +(underway, kellan, br1) b) P2P-Data-Transfer/Content-Syndication: Implementing RDF/RSS-Support or a own indymedia-protocoll. c) dynamically creating "internal"-templates for new languages. d) email-article-to-a-friend-servlet e) semidynamic create-pdf-from-article-servlet: every requested pdf should be cached +f) servletapi-2.3: Filters for file upload (also in cos.jar) +g) servletapi-2.3: use web.xml for simpler/better error handling. +h) servletapi-2.3: set character encoding properly based on what the template +says +i) servletapi-2.3: servletapi-2.3 requires tomcat-4.x, so require it +j) use some JMF (Java Media Framework at sun.com) features for nifty media +tricks +k) better transaction support in the DB/Persistance layer for more efficient +use of DB. +l) - config.porperties has to be cleaned and has to be better documentated. (half done, mh) --> config.properties is being replaced with new config system. +m) Editing producer-templates in the mir-servlet. (idfx) Version 2: Database-Layer -a) Container Managed Persistance (EJB) +a) Container Managed Persistance (EJB) or Castor? +b) MySQL compatibility? Testing: -- tomcat 4.0 (kellan) - resin (idfx) -- poolman instead of dbconnectionbroker diff --git a/etc/web.xml b/etc/web.xml index f5f55a23..2e6565d4 100755 --- a/etc/web.xml +++ b/etc/web.xml @@ -17,10 +17,6 @@ Config config - - xml-config - /home/heckmann/mir/Mir/server.xml - @@ -36,10 +32,6 @@ Config config - - xml-config - /home/heckmann/mir/Mir/server.xml - diff --git a/lib/dbconbroker.jar b/lib/dbconbroker.jar deleted file mode 100755 index cb926c7a..00000000 Binary files a/lib/dbconbroker.jar and /dev/null differ diff --git a/lib/jdbc-se2.0.jar b/lib/jdbc-se2.0.jar new file mode 100755 index 00000000..7b6e322b Binary files /dev/null and b/lib/jdbc-se2.0.jar differ diff --git a/lib/log4j.jar b/lib/log4j.jar new file mode 100755 index 00000000..dc2d758a Binary files /dev/null and b/lib/log4j.jar differ diff --git a/lib/poolman.jar b/lib/poolman.jar new file mode 100755 index 00000000..d3de5b5b Binary files /dev/null and b/lib/poolman.jar differ diff --git a/lib/postgresql.jar b/lib/postgresql.jar index d9076054..23684836 100755 Binary files a/lib/postgresql.jar and b/lib/postgresql.jar differ diff --git a/perms.sh-dist b/perms.sh-dist index fb619fff..e3737267 100755 --- a/perms.sh-dist +++ b/perms.sh-dist @@ -45,3 +45,5 @@ chgrp $GROUP $INSTDIR -R > /dev/null 2>&1 grant 775 664 $INSTDIR > /dev/null 2>&1 grant 750 640 $INSTDIR/WEB-INF/classes/config.properties grant 740 640 $INSTDIR/src/config.properties + +echo "Permissions set." \ No newline at end of file diff --git a/scripts/autotar/README b/scripts/autotar/README new file mode 100755 index 00000000..3bb415b0 --- /dev/null +++ b/scripts/autotar/README @@ -0,0 +1,3 @@ +Sample scrips for autmatic tarball generation for mir.indymedia.org. +Not ready yet. + diff --git a/scripts/autotar/preinstall.sh b/scripts/autotar/preinstall.sh new file mode 100755 index 00000000..e1245ea8 --- /dev/null +++ b/scripts/autotar/preinstall.sh @@ -0,0 +1,18 @@ +mkdir mir +mkdir mirstable +mkdir tarballs + +# +# stable part + +cd mirstable +cvs co -r STABLE-pre1_0 co +cd .. + +# +# unstable part + +cd mir +cvs co mir +cd .. + diff --git a/scripts/autotar/updatetarballs.sh b/scripts/autotar/updatetarballs.sh new file mode 100755 index 00000000..243dda5e --- /dev/null +++ b/scripts/autotar/updatetarballs.sh @@ -0,0 +1,31 @@ +# +# this script makes four tarballs: +# +# 1. STABLE-pre1_0: with and without libs +# 2. current with and without libs + +MIR_TARHOME=/home/rk/autotar/tarballs +MIR_HOME=/home/rk/autotar/mir +MIR_STABLEHOME=/home/rk/autotar/mirstable + + + +echo "[updating cvs stable in $MIR_STABLEHOME]" +cd $MIR_STABLEHOME/mir +cvs -q update -dP +cd .. +echo "[tar stable in $MIR_TARHOME] .." +tar cfz $MIR_TARHOME/mir_stable.tar.gz --exclude "mir/lib" --exclude "CVS" mir +echo "[tar stable+libs in $MIR_TARHOME] .." +tar cfz $MIR_TARHOME/mir_stable+libs.tar.gz --exclude "CVS" mir + +echo "[updating cvs current in $MIR_HOME]" +cd $MIR_HOME/mir +cvs -q update -dP +cd .. + +echo "[tar current in $MIR_TARHOME] .." +tar cfz $MIR_TARHOME/mir.tar.gz --exclude "mir/lib" --exclude "CVS" mir +echo "[tar current+libs in $MIR_TARHOME] .." +tar cfz $MIR_TARHOME/mir+libs.tar.gz --exclude "CVS" mir + diff --git a/source/Mir.java b/source/Mir.java index 23b58527..123f32a6 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -4,12 +4,14 @@ import java.net.*; import java.lang.reflect.*; import javax.servlet.*; import javax.servlet.http.*; +import javax.servlet.UnavailableException; import java.sql.*; import freemarker.template.*; import mir.misc.*; import mir.servlet.*; +import mir.storage.StorageObjectException; import mircoders.servlet.*; import mircoders.module.*; @@ -24,14 +26,13 @@ import mircoders.storage.*; */ -public class Mir extends AbstractServlet -{ +public class Mir extends AbstractServlet { - private static ModuleUsers usersModule=null; - private static ModuleMessage messageModule=null; - private static boolean confed=false; - public HttpSession session; + private static ModuleUsers usersModule=null; + private static ModuleMessage messageModule=null; + private final static HashMap servletModuleInstanceHash = new HashMap(); + public HttpSession session; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -39,17 +40,15 @@ public class Mir extends AbstractServlet } public void doPost(HttpServletRequest req, HttpServletResponse res) - throws ServletException, IOException { + throws ServletException, IOException, UnavailableException { - long startTime = (new java.util.Date()).getTime(); - Class theServletModule; - ServletModule smod; + long startTime = System.currentTimeMillis(); long sessionConnectTime=0; String http=""; // get the configration - if (!confed){ - confed = getConfig(req); + if(getServletContext().getAttribute("mir.confed") == null) { + getConfig(req); } MirConfig.setServletName(getServletName()); @@ -63,6 +62,9 @@ public class Mir extends AbstractServlet setLanguage(session,getAcceptLanguage(req)); } + /** @todo for cleanup and readability this should be moved to + * method loginIfNecessary() */ + // Authentifizierung if (moduleName!=null && moduleName.equals("login")) { String user=req.getParameter("login"); @@ -148,34 +150,65 @@ public class Mir extends AbstractServlet _sendStartPage(res,req, res.getWriter(),userEntity); return; } + // end of auth - //From now on regular dispatching... + // From now on regular dispatching... try { - try { - theServletModule = Class.forName("mircoders.servlet.ServletModule" + moduleName); - } catch (ClassNotFoundException e) { - // searching servletmodule in mir.servlet-classes - theServletModule = Class.forName("mir.servlet.ServletModule" + moduleName); - } - //Instantiate the ServletModule - Method m = theServletModule.getMethod("getInstance",null); - smod = (ServletModule)m.invoke(null,null); + // get servletmodule by parameter and continue with dispacher + ServletModule smod = getServletModuleForName(moduleName); ServletModuleDispatch.dispatch(smod,req,res); } - catch (NoSuchMethodException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " getInstance() not found."); } - catch (InvocationTargetException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " target not found."); } - catch (ClassNotFoundException e) { handleError(res, res.getWriter(), "ServletModule" + moduleName + " not found."); } - catch (IllegalArgumentException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " not found."); } - catch (ServletModuleException e){ handleError(res,res.getWriter(), "ServletException in Module ServletModule" + moduleName + " -- " + e.toString()); } - catch (IllegalAccessException e){ - handleError(res,res.getWriter(), "No access to class ServletModule" + moduleName + " -- " + e.toString()); } + catch (ServletModuleException e) { + handleError(res, res.getWriter(), "ServletException in Module " + moduleName + " -- " + e.toString()); + } + catch (ServletModuleUserException e) { + handleUserError(res,res.getWriter(), "User error" + e.toString()); + } // timing... - sessionConnectTime = new java.util.Date().getTime() - startTime; + sessionConnectTime = System.currentTimeMillis() - startTime; theLog.printInfo("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms"); } + + /** + * Private method getServletModuleForName returns ServletModule + * from Cache + * + * @return ServletModule + * + */ + private static ServletModule getServletModuleForName(String moduleName) + throws ServletModuleException { + + // 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 ServletModuleException("*** error resolving classname for " + + moduleName +" -- "+ e.toString()); + } + } + else return (ServletModule)servletModuleInstanceHash.get(moduleName); + } + + private void handleError(HttpServletResponse res, PrintWriter out, String errorString) { + try { theLog.printError(errorString); SimpleHash modelRoot = new SimpleHash(); @@ -189,6 +222,21 @@ public class Mir extends AbstractServlet } } + private void handleUserError(HttpServletResponse res,PrintWriter out, String errorString) { + + try { + theLog.printError(errorString); + SimpleHash modelRoot = new SimpleHash(); + modelRoot.put("errorstring", new SimpleScalar(errorString)); + modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); + HTMLTemplateProcessor.process(res,MirConfig.getProp("Mir.UserErrorTemplate"),modelRoot,out); + out.close(); + } + catch (Exception e) { + System.err.println("Fehler in UserErrorTemplate"); + } + + } /** * evaluate login for user / password */ @@ -196,8 +244,11 @@ public class Mir extends AbstractServlet try { if (usersModule == null) usersModule = new ModuleUsers(DatabaseUsers.getInstance()); return usersModule.getUserForLogin(user, password); + } catch(Exception e) { + theLog.printDebugInfo(e.toString()); + e.printStackTrace(); + return null; } - catch(Exception e) { theLog.printDebugInfo(e.toString()); return null; } } // Redirect-methods @@ -225,9 +276,9 @@ public class Mir extends AbstractServlet // merge with logged in user and messages SimpleHash mergeData = new SimpleHash(); mergeData.put("session",sessionUrl); - mergeData.put("login_user", HTMLTemplateProcessor.makeSimpleHash(userEntity)); + mergeData.put("login_user", userEntity); if (messageModule == null) messageModule = new ModuleMessage(DatabaseMessages.getInstance()); - mergeData.put("messages", HTMLTemplateProcessor.makeSimpleList(messageModule.getByWhereClause(null, "webdb_create desc",0,10))); + mergeData.put("messages", messageModule.getByWhereClause(null, "webdb_create desc",0,10)); HTMLTemplateProcessor.process(res,getLanguage(req,session)+"/"+startTemplate, mergeData,out); } catch(Exception e) { diff --git a/source/OpenMir.java b/source/OpenMir.java index 7ade219a..96820b2d 100755 --- a/source/OpenMir.java +++ b/source/OpenMir.java @@ -9,7 +9,6 @@ import java.sql.*; import freemarker.template.*; import mir.misc.*; -import mir.xml.XmlConfigurator; import mir.servlet.*; import mircoders.servlet.*; @@ -27,7 +26,7 @@ import mircoders.storage.*; public class OpenMir extends AbstractServlet { - private static boolean confed=false; + //private static boolean confed=false; private static String lang; public HttpSession session; @@ -36,32 +35,6 @@ public class OpenMir extends AbstractServlet { doPost(req,res); } - public void init() throws ServletException { - try { - XmlConfigurator xmlXonfigurator = XmlConfigurator.getInstance(); - xmlXonfigurator.addRequiredTag("/mir/class:mir.storage.DatabaseConfig/property:username"); - xmlXonfigurator.addRequiredTag("/mir/class:mir.storage.DatabaseConfig/property:password"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:password"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:username"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:host"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:adaptor"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:limit"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolMax"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolMin"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolResetTime"); - xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolLog"); - xmlXonfigurator.configure(new File(getInitParameter("xml-config"))); - System.err.println("INIT"); - /*try { - MirXmlParser xmlParser = new MirXmlParser(); - xmlParser.parse("/home/heckmann/server.xml");*/ - } catch (Exception e) { - e.printStackTrace(); - throw new UnavailableException ("Error loading Config file: "+e.toString(), 0); - } - System.err.println("DONE INIT"); - } - public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -69,10 +42,11 @@ public class OpenMir extends AbstractServlet { long sessionConnectTime=0; - if (!confed){ - confed = getConfig(req); - } + // get the configration + if(getServletContext().getAttribute("mir.confed") == null) { + getConfig(req); + } session = req.getSession(); if(session.getAttribute("Language")==null){ @@ -83,6 +57,9 @@ public class OpenMir extends AbstractServlet { try { ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res); } + catch (ServletModuleUserException e) { + handleUserError(res,res.getWriter(), e.getMsg()); + } catch (ServletModuleException e){ e.printStackTrace(); handleError(res,res.getWriter(), "OpenIndy :: ServletException in Module ServletModule -- " + e.toString()); @@ -92,6 +69,22 @@ public class OpenMir extends AbstractServlet { theLog.printInfo("EXECTIME (ServletModuleOpenIndy): " + sessionConnectTime + " ms"); } + private void handleUserError(HttpServletResponse res,PrintWriter out, String errorString) { + + try { + theLog.printError(errorString); + SimpleHash modelRoot = new SimpleHash(); + modelRoot.put("errorstring", new SimpleScalar(errorString)); + modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); + HTMLTemplateProcessor.process(res,MirConfig.getProp("Mir.UserErrorTemplate"),modelRoot,out); + out.close(); + } + catch (Exception e) { + System.err.println("Fehler in UserErrorTemplate"); + } + + } + private void handleError(HttpServletResponse res,PrintWriter out, String errorString) { try { diff --git a/source/config.properties-dist b/source/config.properties-dist index 3abbe2a5..5e2ab939 100755 --- a/source/config.properties-dist +++ b/source/config.properties-dist @@ -97,7 +97,7 @@ Producer.RealMedia.Host=rtsp://some.media.server/somedir/ # image specific storage directories # absolute directory, where the images are saved -Producer.Image.Path=/pub/Dokumente/Indymedia/de-tech/Mir/produced/images +Producer.Image.Path=/pub/Dokumente/Indymedia/de-tech/Mir/produced/images/ # media specific storage directories # absolute directory, where the media files are saved @@ -146,6 +146,7 @@ Database.Limit=20 Database.Username=postgres Database.Password= Database.Host=localhost +Database.Name=Mir # # this sets the adaptor to be used @@ -187,6 +188,7 @@ Entity.Logfile=log/dbentity.log Mir.Logfile=log/mir.log Mir.ErrorTemplate=fehler.template +Mir.UserErrorTemplate=usererror.template ServletModule.Schwerpunkt.ConfirmTemplate=confirm.template ServletModule.Schwerpunkt.ObjektTemplate=schwerpunkt.template @@ -292,7 +294,7 @@ Producer.Logfile=log/producer.log Producer.Navigation.Template=producer/navigation.template Producer.Content.Template=producer/content.template -Producer.Content.Batchsize=20 +Producer.Content.Batchsize=10 Producer.Startseite.Template=producer/startseite.template Producer.Startseite.Entries=7 @@ -319,8 +321,8 @@ Producer.StartPage.Template=producer/startpage.template Producer.StartPage.Items=10 Producer.StartPage.Newswire=30 -Producer.Wap.Template=producer/wap.template -Producer.Wap.Items=10 + +# todo: do we need those? Xsl.Content=producer/content.xsl Xsl.Fo.Content=producer/frontpage_fo.xsl diff --git a/source/mir/entity/Entity.java b/source/mir/entity/Entity.java index c6790d72..6dd39ac8 100755 --- a/source/mir/entity/Entity.java +++ b/source/mir/entity/Entity.java @@ -1,6 +1,6 @@ /** * Base class the entities are derived from. Provides base functionality of - * an entity

+ * an entity. Entities are used to represent rows of a database table.

*/ @@ -33,9 +33,12 @@ public class Entity implements TemplateHashModel, TemplateModelRoot protected static Logfile theLog; protected ArrayList streamedInput=null; private static int instances = 0; + static { + theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Entity.Logfile")); + } public Entity() { - theLog = Logfile.getInstance(this.getClass().getName()); + this.changed = false; instances++; Integer i = new Integer(instances); @@ -43,7 +46,8 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Konstruktor + * Constructor + * @param StorageObject The StorageObject of the Entity. */ public Entity (StorageObject StorageObject) { this(); @@ -51,33 +55,36 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /* - * Setzt das StorageObject der Entity. + * Sets the StorageObject of the Entity. */ public void setStorage (StorageObject storage) { this.theStorageObject = storage; } /** - * Setzt die Werte der Entity - * @param theStringValues + * Sets the values of the Entity. + * @param theStringValues HashMap containing the new values of the Entity */ public void setValues(HashMap theStringValues) { /** @todo should be synchronized */ - theValuesHash = new HashMap(); - String aKey; - Set set = theStringValues.keySet(); - Iterator it = set.iterator(); - int size = set.size(); - for (int i = 0; i < size; i++) { - aKey = (String)it.next(); - theValuesHash.put(aKey, (String)theStringValues.get(aKey)); + if (theStringValues!=null) { + theValuesHash = new HashMap(); + String aKey; + Set set = theStringValues.keySet(); + Iterator it = set.iterator(); + int size = set.size(); + for (int i = 0; i < size; i++) { + aKey = (String)it.next(); + theValuesHash.put(aKey, (String)theStringValues.get(aKey)); + } } + else theLog.printWarning("Entity.setValues called with null HashMap"); } /** - * Liefert boolschen Wert, ob sich der Inhalt der Entity geändert hat. + * Returns whether the content of the Entity has changed. * @return true wenn ja, sonst false */ public boolean changed () { @@ -85,7 +92,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Liefert den Primärschluessel der Entity zurueck + * Returns the primary key of the Entity. * @return String Id */ public String getId () { @@ -93,7 +100,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Setzt den Primaerschluessel der Entity + * Defines the primary key of the Entity * @param id */ public void setId (String id) { @@ -101,9 +108,9 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Liefert den Wert für einen Feldnamen zurueck - * @param theFieldString - * @return Wert für Feld + * 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; @@ -134,8 +141,8 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Fügt Entity via StorageObject in Datenbank ein. - * @return Primary Key der Entity + * Insers Entity into the database via StorageObject + * @return Primary Key of the Entity * @exception StorageObjectException */ public String insert () throws StorageObjectException { @@ -148,7 +155,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Aktualisiert Aenderungen an der Entity in der Datenbank + * Saves changes of this Entity to the database * @exception StorageObjectException */ public void update () throws StorageObjectException { @@ -156,33 +163,33 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Setzt den Wert fuer ein Feld - * @param theProp - * @param theValue + * 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 StorageObjectException { this.changed = true; if (isField(theProp)) theValuesHash.put(theProp, theValue); - else + else { theLog.printWarning("Property not found: " + theProp+theValue); + } } /** - * Gibt die Feldnamen der Entity als ArrayList zurueck - * @return ArrayList mit Feldnamen - * @exception StorageObjectException wird geworfen, wenn kein Zugriff auf die Datenbank - * möglich. + * Returns the field names of the Entity as ArrayListe. + * @return ArrayList with field names + * @exception StorageObjectException is throuwn if database access was impossible */ public ArrayList getFields () throws StorageObjectException { return theStorageObject.getFields(); } /** - * Liefert ein int[] mit den Typen der Felder zurueck - * @return int[] mit den Feldtypen + * Returns an int[] with the types of the fields + * @return int[] that contains the types of the fields * @exception StorageObjectException */ public int[] getTypes () throws StorageObjectException { @@ -190,8 +197,8 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Liefert ArrayListe mit Feldnamen zurueck. - * @return Liste mit Feldnamen + * Returns an ArrayList with field names + * @return List with field names * @exception StorageObjectException */ public ArrayList getLabels () throws StorageObjectException { @@ -199,19 +206,25 @@ public class Entity implements TemplateHashModel, TemplateModelRoot } /** - * Liefert eine Hashmap mit allen Werten der Entity zurueck - * @return HashMap mit Feldname/Wert + * Returns a Hashmap with all values of the Entity. + * @return HashMap with field name as key and the corresponding values * * @deprecated This method is deprecated and will be deleted in the next release. - * AbstractEntity interfaces freemarker.template.TemplateHashModel now and can + * Entity interfaces freemarker.template.TemplateHashModel now and can * be used in the same way as SimpleHash. */ public HashMap getValues() { + theLog.printWarning("## 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.) @@ -222,32 +235,40 @@ public class Entity implements TemplateHashModel, TemplateModelRoot return streamedInput; } - /* Fragt ab, ob fieldName einem Feld entspricht + /** Returns whether fieldName is a valid field name of this Entity. * @param fieldName - * @return true, wennn ja, sonst false + * @return true in case fieldName is a field name, else false. * @exception StorageObjectException */ public boolean isField (String fieldName) throws StorageObjectException { return theStorageObject.getFields().contains(fieldName); } - /** Liefert Anzahl der Instanzen zurück - * @return int + /** Returns the number of instances of this Entity + * @return int The number of instances */ public int getInstances() { return instances; } + + protected void throwStorageObjectException (Exception e, String wo) throws StorageObjectException { + theLog.printError( e.toString() + " Funktion: "+ wo); + throw new StorageObjectException("Storage Object Exception in entity" +e.toString()); + } + /** - * Gibt eine Instanz frei + * Frees an instance */ - public void finalize () { + /*public void finalize () { instances--; + Integer i = new Integer(instances); + System.err.println("Removing abstract entity instance: "+i.toString()); try { super.finalize(); } catch (Throwable t) { System.err.println(t.toString()); } - } + }*/ // Now implements freemarkers TemplateHashModel @@ -257,25 +278,25 @@ public class Entity implements TemplateHashModel, TemplateModelRoot public boolean isEmpty() throws TemplateModelException { - if (theValuesHash==null || theValuesHash.isEmpty()) - return true; - return false; + return (theValuesHash==null || theValuesHash.isEmpty()) ? true : false; } public TemplateModel get(java.lang.String key) throws TemplateModelException { - theLog.printDebugInfo("trying to get: " + key); return new SimpleScalar(getValue(key)); } public void put(java.lang.String key, TemplateModel model) { - // empty for testing + // 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. + theLog.printWarning("### put is called on entity! - the values will be lost!"); } public void remove(java.lang.String key) { - // empty for testing + // do we need this? } diff --git a/source/mir/entity/EntityList.java b/source/mir/entity/EntityList.java index 303917d1..bf41e8ff 100755 --- a/source/mir/entity/EntityList.java +++ b/source/mir/entity/EntityList.java @@ -1,5 +1,7 @@ /* - * put your module comment here + * The former (German) documentation of this classe + * stated that this class is an abstract one. There is, + * however, not a single abstract method in this class. */ @@ -7,55 +9,63 @@ package mir.entity; import java.lang.*; import java.util.*; + +import freemarker.template.*; + import mir.misc.*; /** * - * abstrakte Containerklasse für Listen von Entities. + * Container class for lists of Entities. * * @author * @version 27.6.1999 */ -public class EntityList { - private static Logfile theLog; - private ArrayList theEntityArrayList; - private String whereClause; - private String orderClause; - private int count; - private int offset; - private int offsetnext = -1; - private int offsetprev = -1; +public class EntityList implements TemplateListModel { + + private static Logfile theLog; + private ArrayList theEntityArrayList; + private String whereClause; + private String orderClause; + private int count; + private int offset; + private int offsetnext = -1; + private int offsetprev = -1; + private int freemarkerListPointer=-1; + + + static { + theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Entity.Logfile")); + } /** - * Konstruktor für leere Liste von Entities + * Constructor. Creates an empty EntityList */ public EntityList(){ this.theEntityArrayList = new ArrayList(); - if (theLog == null) - this.theLog = Logfile.getInstance(this.getClass().getName()); } + /** - * Setzt die WhereClause, mit der die Entitis dieser Liste geholt wurden. - * @param wc + * Sets the WHERE clause that fetched the Entities of this EntityList from the database. + * @param wc The string that contains the WHERE clause */ public void setWhere(String wc) { this.whereClause = wc; } /** - * Liefert die WhereClause zurueck, mit der die Entities geholt wurden. - * @return whereClause + * Returns the WHERE clause that returned this EntityList from the database + * @return whereClause The WHERE clause */ public String getWhere() { return whereClause; } + /** - * Setzt das Sortierkriterium fest, mit der die Entities in die Liste - * gestellt wurden. - * + * Sets the sorting criterium of this EntityList * @param oc */ public void setOrder(String oc) { @@ -63,39 +73,39 @@ public class EntityList { } /** - * Liefert das Sortierkriterium der Liste zurueck. - * @return orderClause + * Returns the sorting criterium. + * @return orderClause The sort order */ public String getOrder() { return orderClause; } /** - * Setzt die Anzahl der Datensätze fest, die WhereClause erfüllen. - * @param i + * Sets the number of rows that match the WHERE clause + * @param i The number of rows that match the WHERE clause */ public void setCount(int i) { this.count = i; } /** - * Liefert Anzahle der Datensätze, die WhereClause erfüllen. - * @return + * Returns the number of rows that match the WHERE clause + * @return The number of rows ... */ public int getCount() { return count; } /** - * Setzt den Offset fest. - * @param i + * Sets the offset + * @param i The offset */ public void setOffset(int i) { offset = i; } /** - * Liefert den Offset zurueck + * Returns the offset * @return offset */ public int getOffset() { @@ -103,55 +113,55 @@ public class EntityList { } /** - * Setzt den offset für das naechste Batch von Entities fest. - * @param i + * Sets the offset of the next batch of Entities. + * @param i The next offset */ public void setNextBatch(int i) { offsetnext = i; } /** - * Liefert den offset für das naechste Batch von Entities - * @return offset für naechstes Batch + * Returns the offset of the next batch of Entities. + * @return offset of the next batch */ public int getNextBatch() { return offsetnext; } /** - * Fragt ab, ob es noch nachfolgendes Batch innerhalb der WhereClause gibt - * @return + * Returns whether there is a next batch within the WHERE clause + * @return true if yes, false if no. */ public boolean hasNextBatch() { return (offsetnext >= 0); } /** - * Setzt offset des vorhergehenden Batches fest. - * @param i + * Sets the offset of the previous batch. + * @param i the previous offset */ public void setPrevBatch(int i) { offsetprev = i; } /** - * Liefert offset des vorhergehenden Batches zurueck. - * @return offset des vorhergehenden Batches. + * Returns the offset of the previous batch. + * @return offset of the previous batch */ public int getPrevBatch() { return offsetprev; } /** - * Fragt ab, ob es ein vorhergehendes Batch gibt - * @return true wenn ja, sont false + * Returns whether there is a previous batch. + * @return true if yes, false if no */ public boolean hasPrevBatch() { return (offsetprev >= 0); } /** - * Liefert den Startindex des Batches zurueck. + * Returns the start index of the batch. * @return */ public int getFrom() { @@ -159,41 +169,84 @@ public class EntityList { } /** - * Liefert den Endindex des Batches zurueck. + * Returns the end index of the batch. * @return */ public int getTo() { - if (hasNextBatch()) - return offsetnext; - else - return count; - } - - /** - * Fügt eine Entity in die Liste ein - * @param anEntity - */ - public void add (Entity anEntity) { - if (anEntity!=null) - theEntityArrayList.add(anEntity); - else - theLog.printWarning("add (EntityList) mit leerer Entity"); - } - - /** - * @return Anzahl der Entities in der Liste - */ - public int size() { - return theEntityArrayList.size(); - } - - - - - - - public Entity elementAt(int i) { - return (Entity)theEntityArrayList.get(i); - } + if (hasNextBatch()) + return offsetnext; + else + return count; + } + + /** + * Inserts an Entity into the EntityList. + * @param anEntity The entity to be inserted. + */ + + public void add (Entity anEntity) { + if (anEntity!=null) + theEntityArrayList.add(anEntity); + else + theLog.printWarning("EntityList: add called with empty Entity"); + } + + + /** + * @return The number of Entities in the EntityList. + */ + + public int size() { + return theEntityArrayList.size(); + } + + + /** + * Returns the element at position i in the EntityList as Entity + * @param i the position of the element in question + * @return The element at position i. + */ + + public Entity elementAt(int i) { + /** @todo check if i is in list.size() */ + return (Entity)theEntityArrayList.get(i); + } + + + // The following methods have to be implemented + // for this class to be an implementation of the + // TemplateListModel of the Freemarker packages + + public TemplateModel get(int i) { return elementAt(i); } + public boolean isRewound() { return (freemarkerListPointer==-1) ? true : false; } + public void rewind() { freemarkerListPointer=-1; } + + public TemplateModel next() { + if (hasNext()) { + freemarkerListPointer++;return get(freemarkerListPointer); } + else return null; + } + + + /** + * Returns whether there is a next element + * @return true if there is a next element, else false + */ + + public boolean hasNext() { + return theEntityArrayList.size()>0 && freemarkerListPointer+2<=theEntityArrayList.size(); + } + + + /** + * Returns whether EntityList is empty or not + * @return true in case of empty list, false otherwise + */ + + public boolean isEmpty() { + if (theEntityArrayList!=null) + return theEntityArrayList.size()<1 ; + else return false; + } } diff --git a/source/mir/entity/EntityRelation.java b/source/mir/entity/EntityRelation.java index fa7e0652..586d0f40 100755 --- a/source/mir/entity/EntityRelation.java +++ b/source/mir/entity/EntityRelation.java @@ -45,20 +45,6 @@ public class EntityRelation { } /** - * @return Liefert ein freemarker.template.SimpleHash mit den verknuepften - * Entities, wenn es sich um eine TO_ONE Beziehung handelt, ansonsten - * null. - */ - - public Entity getOneAsSimpleHash(Entity entity) throws StorageObjectException { - if (type==TO_ONE) { - Entity returnEntity = (Entity)getOne(entity); - if (returnEntity!=null) return returnEntity; - } - return null; - } - - /** * @return Liefert eine freemarker.template.SimpleList mit den verknuepften * Entities, wenn es sich um eine TO_MANY Liste handelt, ansonsten * null. @@ -98,54 +84,7 @@ public class EntityRelation { } /** - * @return Liefert eine freemarker.template.SimpleList mit den verknuepften - * Entities, wenn es sich um eine TO_MANY Liste handelt, ansonsten - * null. - */ - - public SimpleList getManyAsSimpleList(Entity entity) - throws StorageObjectException { - - if (type==TO_MANY) { - EntityList returnList = getMany(entity); - if (returnList!=null) return HTMLTemplateProcessor.makeSimpleList(returnList); - } - return null; - } - - /** - * @return Liefert eine freemarker.template.SimpleList mit den verknuepften - * Entities, wenn es sich um eine TO_MANY Liste handelt, ansonsten - * null. - */ - - public SimpleList getManyAsSimpleList(Entity entity, String order) - throws StorageObjectException { - - if (type==TO_MANY) { - EntityList returnList = getMany(entity, order); - if (returnList!=null) return HTMLTemplateProcessor.makeSimpleList(returnList); - } - return null; - } - - /** - * @return Liefert eine freemarker.template.SimpleList mit den verknuepften - * Entities, wenn es sich um eine TO_MANY Liste handelt, ansonsten - * null. - */ - - public SimpleList getManyAsSimpleList(Entity entity, String order, String whereClause) - throws StorageObjectException { - - if (type==TO_MANY) { - EntityList returnList = getMany(entity, order, whereClause); - if (returnList!=null) return HTMLTemplateProcessor.makeSimpleList(returnList); - } - return null; - } - /** - * @return Liefert den Referenznamen der abhaengigen Tabelle + * @return The reference name of the related table. */ public String getName() { diff --git a/source/mir/entity/GenericEntity.java b/source/mir/entity/GenericEntity.java index a52015bc..d183407d 100755 --- a/source/mir/entity/GenericEntity.java +++ b/source/mir/entity/GenericEntity.java @@ -4,15 +4,15 @@ package mir.entity; /** - * Standard-Entity-Container. Wenn keine Zusatzfunktionalitaeten für die Kapselung einer - * Datenbankzeile nötig sind, d.h. zu einem Database-Objekt keine eigene Entity-Klasse - * implementiert wird, so wird dieser Standard-Container verwendet. + * Standard Entity container. + * If no additional functionality is neccessary for the encapsulation + * of a database row, i.e. no separate Entity class is implemented + * for a database object, this standard container is used. * * @author /rk * @version 1.2 */ -public class GenericEntity extends Entity - {} +public class GenericEntity extends Entity {} diff --git a/source/mir/media/MediaHandlerAudio.java b/source/mir/media/MediaHandlerAudio.java deleted file mode 100755 index 4be2dd51..00000000 --- a/source/mir/media/MediaHandlerAudio.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - -/** - * Handles audio media, like mp3 and maybe it could also handle some other. - * It is MediaHandlerGeneric with different icons. - * - * @see mir.media.MediaHandlerGeneric - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - -public class MediaHandlerAudio extends MediaHandlerGeneric implements MirMedia -{ - - private static String tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio"); - private static String bigIcon = MirConfig.getProp("Producer.Icon.BigAudio"); - - public String getTinyIcon() - { - return tinyIcon; - } - - public String getBigIcon() - { - return bigIcon; - } - - public String getIconAlt() - { - return "Audio"; - } - - public boolean isAudio() - { - return true; - } -} diff --git a/source/mir/media/MediaHandlerGeneric.java b/source/mir/media/MediaHandlerGeneric.java deleted file mode 100755 index 5cad4434..00000000 --- a/source/mir/media/MediaHandlerGeneric.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - -/** - * This is the Generic MediaHandler. It stores the media data on - * the filesystem and keeps basic metadata (size, type...) in the - * DB. Usually only representation needs to be overridden. - * See the MediaHandlerAudio class to see an example of how one - * could override it. - *

- * Most media handlers should override this class. - *

- * In theory, it could be used to handle miscellaneous media that - * we don't have entered in the media_type table, (like RTF documents, - * PS, PDF, etc..) - *

- * Of course it implements the MirMedia interface. - * - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - -public class MediaHandlerGeneric implements MirMedia -{ - - protected String imageHost = MirConfig.getProp("Producer.Image.Host"); - protected String imageRoot = MirConfig.getProp("Producer.ImageRoot"); - protected Logfile theLog = Logfile.getInstance(this.getClass().getName()); - public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) { - String ext = mediaTypeEnt.getValue("name"); - String dir = MirConfig.getProp("Producer.Media.Path"); - String mediaHost = MirConfig.getProp("Producer.Media.Host"); - String mediaFname = ent.getId()+"."+ext; - String date = ent.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - Integer size = new Integer(uploadedData.length); - if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) { - //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) { - //were done with the data, dereference. - uploadedData=null; - - try { - ent.setValueForProperty("is_produced", "1"); - ent.setValueForProperty("icon_is_produced", "1"); - ent.setValueForProperty("publish_path",datePath+"/"+mediaFname); - //ent.setValueForProperty("publish_path", mediaFname); - ent.setValueForProperty("publish_server", mediaHost); - ent.setValueForProperty("size", size.toString()); - ent.update(); - } catch (StorageObjectException e) { - theLog.printError("StorageObjectException: "+e.toString()); - return false; - } - } else { - theLog.printError("could not write FILE!"); - return false; - } - - return true; - } - - //a class that will probably never get used.. - private byte[] getFile (String fileName) { - long size = FileUtil.getSize(fileName); - if (size < 0) return null; - - byte[] container = new byte[(int)size]; - - if(!FileUtil.read(fileName, container)) - return null; - - return container; - } - - public byte[] get (Entity ent, Entity mediaTypeEnt) { - return null; - } - - public byte[] getIcon (Entity ent) { - String name = "/path/to/some/generic/icon"; - return getFile(name); - } - - public String getStoragePath() - { - return MirConfig.getProp("Producer.Media.Path"); - } - - public String getIconStoragePath() - { - return MirConfig.getProp("Producer.Image.IconPath"); - } - - public String getPublishHost() - { - return MirConfig.getProp("Producer.Media.Host"); - } - - public String getTinyIcon() - { - return MirConfig.getProp("Producer.Icon.TinyText"); - } - - public String getBigIcon() - { - return MirConfig.getProp("Producer.Icon.BigText"); - } - - public String getIconAlt() - { - return "Generic media"; - } - - public String getURL(Entity ent, Entity mediaTypeEnt) - { - String stringSize = ent.getValue("size"); - if (stringSize == null) - return null; - int size = Integer.parseInt(stringSize, 10)/1024; - String title = ent.getValue("title")+ - " - "+mediaTypeEnt.getValue("name")+" "+ - size+" KB"; - return StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+ - ent.getValue("publish_path"), title, imageRoot, getBigIcon()); - } - - public String getListView(Entity ent, Entity mediaTypeEnt) - { - //String title = ent.getValue("title")+ - // " - "+mediaTypeEnt.getValue("name")+" "+ - // ent.getValue("size")+" Bytes"; - return StringUtil.createIMGLinks(imageHost+ - getBigIcon(), null, null, null); - } - - public boolean isVideo() - { - return false; - } - - public boolean isAudio() - { - return false; - } - - public boolean isImage() - { - return false; - } - -} - - - diff --git a/source/mir/media/MediaHandlerImages.java b/source/mir/media/MediaHandlerImages.java deleted file mode 100755 index 3a4365e7..00000000 --- a/source/mir/media/MediaHandlerImages.java +++ /dev/null @@ -1,162 +0,0 @@ - -package mir.media; - -import java.lang.*; -import java.io.*; -import java.util.*; -import java.lang.reflect.*; - -import mir.misc.*; -import mir.entity.*; - -/** - * This class handles saving, fetching creating representations - * for all images. The image content is stored in the DB. The content is - * written out to a file at the ProducerImages level. - * Remember that Handlers for specific image types, Gif, Jpeg, etc.. - * should override it. - * It implements the MirMedia interface. - *

- * ok. this is a big hack, it's cause putting the image in the DB - * and fetching it from the DB needs low level db connections for - * some reason. Does anyone know how to get around this? - * -mh 25.09.2001 - * - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - - -public class MediaHandlerImages -{ - protected final String WEBDB_JPG="0"; - protected final String WEBDB_GIF="1"; - - protected String imageType="0"; - private Logfile theLog = Logfile.getInstance(this.getClass().getName()); - - public byte[] get(Entity ent, Entity mediaTypeEnt) - { - byte[] image_data = null; - - try { - Method method = ent.getClass().getMethod("getImage",null); - image_data = (byte[])method.invoke(ent, null); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("get: invocation target illegal: "+e.toString()); - } - - - return image_data; - } - - protected boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt) - { - try { - Class[] params = {byte[].class, String.class}; - theLog.printDebugInfo("NAME: "+ent.getClass().getName()+" "+ - mediaTypeEnt.getClass().getName()+" "+uploadData.length+" "+ - imageType); - Method method = ent.getClass().getMethod("setImage",params); - method.invoke(ent, new Object[] {uploadData, imageType}); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - return false; - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - return false; - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("set: invocation target illegal: "+e.toString()); - return false; - } - //deref. -mh - uploadData=null; - - return true; - } - - public byte[] getIcon(Entity ent) - { - byte[] icon_data = null; - - try { - Method method = ent.getClass().getMethod("getIcon",null); - icon_data = (byte[])method.invoke(ent, null); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("getIcon: invocation target illegal: "+e.toString()); - } - - return icon_data; - } - - public String getURL(Entity ent, Entity mediaTypeEnt) - { - String title = ent.getValue("title"); - return StringUtil.createIMGLinks(ent.getValue("publish_server")+ - ent.getValue("publish_path"), title, ent.getValue("img_height"), - ent.getValue("img_width")); - } - - public String getListView(Entity ent, Entity mediaTypeEnt) - { - //String title = ent.getValue("title"); - return StringUtil.createIMGLinks( MirConfig.getProp("Producer.ProductionHost")+ - ent.getValue("icon_path"), null, ent.getValue("icon_height"), - ent.getValue("icon_width")); - } - - public String getStoragePath() - { - return MirConfig.getProp("Producer.Image.Path"); - } - - public String getIconStoragePath() - { - return MirConfig.getProp("Producer.Image.IconPath"); - } - - public String getPublishHost() - { - return MirConfig.getProp("Producer.Image.Host"); - } - - public String getTinyIcon () - { - return MirConfig.getProp("Producer.Icon.TinyImage"); - } - - public String getBigIcon () - { - return MirConfig.getProp("Producer.Icon.BigImage"); - } - - public String getIconAlt () - { - return "Image"; - } - - public boolean isVideo () - { - return false; - } - - public boolean isAudio () - { - return false; - } - - public boolean isImage () - { - return true; - } - -} diff --git a/source/mir/media/MediaHandlerImagesGif.java b/source/mir/media/MediaHandlerImagesGif.java deleted file mode 100755 index 0b22412e..00000000 --- a/source/mir/media/MediaHandlerImagesGif.java +++ /dev/null @@ -1,30 +0,0 @@ - -package mir.media; - -import java.lang.*; -import java.io.*; -import java.util.*; -import java.sql.*; - -import mir.entity.*; - -/** - * This class handles saving, fetching creating representations - * for gif images. it overrides MediaHandlerImages. - * - * @see mir.media.MediaHandlerImages - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - - -public class MediaHandlerImagesGif extends MediaHandlerImages implements MirMedia -{ - - public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt) - { - imageType = WEBDB_GIF; - return super.set(uploadData, ent, mediaTypeEnt); - } -} diff --git a/source/mir/media/MediaHandlerImagesJpeg.java b/source/mir/media/MediaHandlerImagesJpeg.java deleted file mode 100755 index ff01abc6..00000000 --- a/source/mir/media/MediaHandlerImagesJpeg.java +++ /dev/null @@ -1,29 +0,0 @@ - -package mir.media; - -import java.lang.*; -import java.io.*; -import java.util.*; -import java.sql.*; - -import mir.entity.*; - -/** - * This class handles saving, fetching creating representations - * for jpeg images. it overrides MediaHandlerImages. - * - * @see mir.media.MediaHandlerImages - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - - -public class MediaHandlerImagesJpeg extends MediaHandlerImages implements MirMedia -{ - public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt) - { - imageType = WEBDB_JPG; - return super.set(uploadData, ent, mediaTypeEnt); - } -} diff --git a/source/mir/media/MediaHandlerMp3.java b/source/mir/media/MediaHandlerMp3.java deleted file mode 100755 index 747ef37d..00000000 --- a/source/mir/media/MediaHandlerMp3.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - -/** - * Please note: this media handler produces - * 3 media files, the raw .mp3, a .m3u which is - * contains the URL for the mp3 and a .pls which - * contains the URL to the mp3 in shoutcast playlist - * format. What's important is that the web server (of - * the media host) must recognize the .m3u and .pls file - * extensions and send the proper "audio/x-mpegurl" - * and "audio/x-scpls" mime-types respectively. - * If the web server is apache, it's easy, just - * add: - * - * audio/x-mpegurl m3u - * audio/x-scpl pls - * - * to the file pointed to by the "TypesConfig" - * command in your apache config file. Or add - * and equivalent AddType command to your httpd.conf. - * Of course this assumes that the mod_mime is loaded. - * - * If the web server is not apache, then your on your own. - * - * @see mir.media.MirMedia - * @author mh - * @version 01.12.2001 - */ - -public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia -{ - - public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) { - String ext = mediaTypeEnt.getValue("name"); - String dir = MirConfig.getProp("Producer.Media.Path"); - String mediaHost = MirConfig.getProp("Producer.Media.Host"); - String date = ent.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - String baseName = ent.getId(); - String mediaFname = baseName+"."+ext; - String mp3Pointer = mediaHost+datePath+mediaFname; - String mpegURLFile = baseName+".m3u"; - String playlistFile = baseName+".pls"; - Integer size = new Integer(uploadedData.length); - if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) { - //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) { - //were done with the data, dereference. - uploadedData=null; - - try { - //write the "meta" files - //first the .m3u since it only contains one line - FileUtil.write(dir+"/"+datePath+"/"+mpegURLFile,mp3Pointer.getBytes()); - //now the .pls file - FileUtil.write(dir+"/"+datePath+"/"+playlistFile,mp3Pointer.getBytes()); - ent.setValueForProperty("is_produced", "1"); - ent.setValueForProperty("icon_is_produced", "1"); - ent.setValueForProperty("publish_path",datePath+"/"+mediaFname); - //ent.setValueForProperty("publish_path", mediaFname); - ent.setValueForProperty("publish_server", mediaHost); - ent.setValueForProperty("size", size.toString()); - ent.update(); - } catch (StorageObjectException e) { - theLog.printError("StorageObjectException: "+e.toString()); - return false; - } - } else { - theLog.printError("could not write FILE!"); - return false; - } - - return true; - } - - public String getURL(Entity ent, Entity mediaTypeEnt) - { - String stringSize = ent.getValue("size"); - if (stringSize == null) - return null; - int size = Integer.parseInt(stringSize, 10)/1024; - String rawTitle = ent.getValue("title")+ - " - "+mediaTypeEnt.getValue("name")+" "+ - size+" KB "+"download"; - String m3uTitle = ent.getValue("title")+ - " - "+mediaTypeEnt.getValue("name")+" "+ - "streaming URL"; - String plsTitle = ent.getValue("title")+ - " - "+mediaTypeEnt.getValue("name")+" "+ - "playlist URL"; - - String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"), ".mp3$",""); - - String m3uURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+basePath+".m3u", m3uTitle, imageRoot, getBigIcon()); - String plsURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+basePath+".pls", plsTitle, imageRoot, getBigIcon()); - String rawURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+ent.getValue("publish_path"), rawTitle, imageRoot, getBigIcon()); - - return m3uURL+"\n

"+plsURL+"\n

"+rawURL; - - } - -} - - - diff --git a/source/mir/media/MediaHandlerRealAudio.java b/source/mir/media/MediaHandlerRealAudio.java deleted file mode 100755 index 5a1c7c1c..00000000 --- a/source/mir/media/MediaHandlerRealAudio.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - - -/** - * Handles real audio. like MediaHandlerAudio, except it manages the ram file, too. - * - * @see mir.media.MediaHandlerGeneric - * @see mir.media.MirMedia - * @author john - * @version 11.10.2001 - */ - - -public class MediaHandlerRealAudio extends MediaHandlerAudio implements MirMedia -{ - - public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) { - String ext = mediaTypeEnt.getValue("name"); - String dir = MirConfig.getProp("Producer.Media.Path"); - String rtspDir = MirConfig.getProp("Producer.RealMedia.Path"); - String mediaHost = MirConfig.getProp("Producer.Media.Host"); - String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host"); - - String date = ent.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - String mediaFname = ent.getId()+"."+ext; - String realMediaPointer = rtspMediaHost+datePath+mediaFname; - String realMediaFile = ent.getId()+".ram"; - Integer size = new Integer(uploadedData.length); - if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) { - //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) { - //were done with the data, dereference. - uploadedData=null; - - try { - //write a ram file - FileUtil.write(dir+"/"+datePath+"/"+realMediaFile,realMediaPointer.getBytes()); - ent.setValueForProperty("is_produced", "1"); - ent.setValueForProperty("icon_is_produced", "1"); - ent.setValueForProperty("publish_path",datePath+"/"+realMediaFile); - //ent.setValueForProperty("publish_path", realMediaFile); - ent.setValueForProperty("publish_server", mediaHost); - ent.setValueForProperty("size", size.toString()); - ent.update(); - } catch (StorageObjectException e) { - theLog.printError("StorageObjectException: "+e.toString()); - return false; - } - } else { - theLog.printError("could not write FILE!"); - return false; - } - - return true; - } - -} - - - diff --git a/source/mir/media/MediaHandlerRealVideo.java b/source/mir/media/MediaHandlerRealVideo.java deleted file mode 100755 index 83d693cd..00000000 --- a/source/mir/media/MediaHandlerRealVideo.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - - -/** - * Handles real video. like MediaHandlerAudio, except it manages the ram file, too. - * - * @see mir.media.MediaHandlerGeneric - * @see mir.media.MirMedia - * @author john - * @version 11.10.2001 - */ - - -public class MediaHandlerRealVideo extends MediaHandlerGeneric implements MirMedia -{ - - private String imageHost = MirConfig.getProp("Producer.Image.Host"); - private static String imageRoot = MirConfig.getProp("Producer.ImageRoot"); - private Logfile theLog = Logfile.getInstance(this.getClass().getName()); - public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) { - String ext = mediaTypeEnt.getValue("name"); - String dir = MirConfig.getProp("Producer.Media.Path"); - String rtspDir = MirConfig.getProp("Producer.RealMedia.Path"); - String mediaHost = MirConfig.getProp("Producer.Media.Host"); - String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host"); - - String mediaFname = ent.getId()+"."+ext; - String RealMediaPointer = rtspMediaHost+mediaFname; - String RealMediaFile = ent.getId()+".ram"; - String date = ent.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - Integer size = new Integer(uploadedData.length); - if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) { - //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) { - //were done with the data, dereference. - uploadedData=null; - - try { -//write an rm file -FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes()); - - ent.setValueForProperty("is_produced", "1"); - ent.setValueForProperty("icon_is_produced", "1"); - ent.setValueForProperty("publish_path",datePath+"/"+mediaFname); - //ent.setValueForProperty("publish_path", RealMediaFile); - ent.setValueForProperty("publish_server", mediaHost); - ent.setValueForProperty("size", size.toString()); - ent.update(); - } catch (StorageObjectException e) { - theLog.printError("StorageObjectException: "+e.toString()); - return false; - } - } else { - theLog.printError("could not write FILE!"); - return false; - } - - return true; - } - - - - - - public String getPublishHost() - { - return MirConfig.getProp("Producer.Media.Host"); - } - - - - public String getURL(Entity ent, Entity mediaTypeEnt) - { - int size = Integer.parseInt(ent.getValue("size"), 10)/1024; - String title = ent.getValue("title")+ - " - "+mediaTypeEnt.getValue("name")+" "+ - size+" KB"; - return StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+ - ent.getValue("publish_path"), title, imageRoot, getBigIcon()); - } - - - private static String tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo"); - private static String bigIcon = MirConfig.getProp("Producer.Icon.BigVideo"); - - public String getTinyIcon() - { - return tinyIcon; - } - - public String getBigIcon() - { - return bigIcon; - } - - public String getIconAlt() - { - return "Video"; - } - - public boolean isVideo() - { - return true; - } - -} - - - diff --git a/source/mir/media/MediaHandlerVideo.java b/source/mir/media/MediaHandlerVideo.java deleted file mode 100755 index d7a7e030..00000000 --- a/source/mir/media/MediaHandlerVideo.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * put your module comment here - */ - - -package mir.media; - -import java.util.*; - -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - - -/** - * 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 - * @version 11.10.2001 - */ - -public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia -{ - - private static String tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo"); - private static String bigIcon = MirConfig.getProp("Producer.Icon.BigVideo"); - - public String getTinyIcon() - { - return tinyIcon; - } - - public String getBigIcon() - { - return bigIcon; - } - - public String getIconAlt() - { - return "Video"; - } - - public boolean isVideo() - { - return true; - } -} diff --git a/source/mir/media/MediaHelper.java b/source/mir/media/MediaHelper.java new file mode 100755 index 00000000..ba33cbf0 --- /dev/null +++ b/source/mir/media/MediaHelper.java @@ -0,0 +1,53 @@ +package mir.media; + +import java.lang.reflect.*; +import java.lang.*; + +import mir.entity.Entity; +import mir.storage.Database; + + +/** + * helper class to resolve media handlers using reflection + * + * @author mh + * @version 2002 + */ + +public final class MediaHelper { + + static String _classPrefix = "mircoders.media.MediaHandler"; + + public static MirMedia getHandler( Entity mediaType ) + throws MirMediaException { + + MirMedia mediaHandler; + String handlerName = mediaType.getValue("classname"); + try { + Class handlerClass = Class.forName(_classPrefix+handlerName); + return mediaHandler = (MirMedia)handlerClass.newInstance(); + } catch (Exception e) { + throw new MirMediaException ("getHandler -- error in reflection " + +e.toString()); + } + } + + public static Database getStorage(Entity mediaType, String classPrefix) + throws MirMediaException { + + Database mediaStorage; + String storageName = mediaType.getValue("tablename"); + try { + Class storageClass = Class.forName(classPrefix+storageName); + Method m = storageClass.getMethod("getInstance", null); + return mediaStorage = (Database)m.invoke(null, null); + } catch (Exception e) { + throw new MirMediaException ("getStorage -- error in reflection " + +e.toString()); + } + } + +} + + + diff --git a/source/mir/media/MirMedia.java b/source/mir/media/MirMedia.java index 2a3a9b66..3597a1fc 100755 --- a/source/mir/media/MirMedia.java +++ b/source/mir/media/MirMedia.java @@ -72,7 +72,7 @@ public interface MirMedia{ * @return boolean, success/fail * @see mir.entity.Entity */ - public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ); + public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) throws MirMediaException; /** * Get's the media data from storage and returns it as a byte array @@ -84,7 +84,8 @@ public interface MirMedia{ * @return byte[] * @see mir.entity.Entity */ - public abstract byte[] get (Entity ent, Entity mediaTypeEnt); + public abstract byte[] get (Entity ent, Entity mediaTypeEnt) + throws MirMediaException; /** * Pretty much like get() above. But get's the specific Icon @@ -93,7 +94,7 @@ public interface MirMedia{ * @return byte[] * @see mir.entity.Entity */ - public abstract byte[] getIcon (Entity ent); + public abstract byte[] getIcon (Entity ent) throws MirMediaException; /** * gets the final content representation for the media @@ -108,7 +109,8 @@ public interface MirMedia{ * @see mir.entity.Entity * @see mir.misc.StringUtil */ - public abstract String getURL (Entity ent, Entity mediaTypeEnt); + public abstract String getURL (Entity ent, Entity mediaTypeEnt) + throws MirMediaException; /** * gets the summary representation for the media @@ -123,7 +125,8 @@ public interface MirMedia{ * @see mir.entity.Entity * @see mir.misc.StringUtil */ - public abstract String getListView (Entity ent, Entity mediaTypeEnt); + public abstract String getListView (Entity ent, Entity mediaTypeEnt) + throws MirMediaException; /** * Returns the absolute filesystem path to where the media @@ -133,7 +136,7 @@ public interface MirMedia{ * @return String, the path. * @see mir.misc.MirConfig */ - public abstract String getStoragePath (); + public abstract String getStoragePath () throws MirMediaException; /** * Returns the *relative* filesystem path to where the media @@ -145,7 +148,7 @@ public interface MirMedia{ * @return String, the path. * @see mir.misc.MirConfig */ - public abstract String getIconStoragePath (); + public abstract String getIconStoragePath () throws MirMediaException; /** * Returns the base URL to that the media is accessible from @@ -153,12 +156,12 @@ public interface MirMedia{ * This is used in the Metadata stored in the DB and later on * ,the templates use it. * It is usually defined - * in the configuration wich is accessible through the MirConfig + * in the configuration witch is accessible through the MirConfig * class. * @return String, the base URL to the host. * @see mir.misc.MirConfig */ - public abstract String getPublishHost (); + public abstract String getPublishHost () throws MirMediaException; /** * Returns the file name of the Icon representing the media type. diff --git a/source/mir/media/MirMediaException.java b/source/mir/media/MirMediaException.java new file mode 100755 index 00000000..e87ff7df --- /dev/null +++ b/source/mir/media/MirMediaException.java @@ -0,0 +1,26 @@ +package mir.media; + +import java.lang.*; + +/* + * MirMediaException - + * + * @version 29.1.2002 + * @author mh + * + */ + +public final class MirMediaException extends Exception +{ + String msg; + + public MirMediaException(String msg) { + super(msg); + this.msg = msg; + } + + public String getMsg() { + return msg; + } +} + diff --git a/source/mir/misc/FileUtil.java b/source/mir/misc/FileUtil.java index 5a68e319..f9b3e7e2 100755 --- a/source/mir/misc/FileUtil.java +++ b/source/mir/misc/FileUtil.java @@ -30,7 +30,6 @@ public final class FileUtil { static { System.setProperty("content.types.user.table", MirConfig.getProp("Home")+"content-types.properties"); - System.err.println("DDD: "+MirConfig.getProp("Home")+"content-types.properties"); fileNameMap = sun.net.www.MimeTable.loadTable(); producerStorageRoot = MirConfig.getProp("Producer.StorageRoot"); } @@ -41,7 +40,8 @@ public final class FileUtil { private FileUtil () { } - public static boolean write(String filename, byte[] in) { + public static boolean write(String filename, byte[] in) + throws IOException { boolean retVal = false; @@ -57,12 +57,15 @@ public final class FileUtil { outStream.write(in); outStream.close(); retVal = true; - } catch(IOException exception) {} + } catch(IOException e) { + throw new IOException(e.toString()); + } } return retVal; } - public static boolean read(String filename, byte out[]) { + public static boolean read(String filename, byte out[]) + throws IOException { File f = null; f = new File(filename); @@ -75,8 +78,8 @@ public final class FileUtil { inStream = new FileInputStream(f); inStream.read(out); inStream.close(); - } catch(IOException exception) { - return false; + } catch(IOException e) { + throw new IOException(e.toString()); } } else { return false; @@ -117,9 +120,8 @@ public final class FileUtil { public static String guessContentTypeFromName(String fname) { String contentType = null; - System.err.println("NAME: "+fname); contentType = getFileNameMap().getContentTypeFor(fname); - System.err.println("TYPE: "+contentType); + return contentType; } diff --git a/source/mir/misc/HTMLTemplateProcessor.java b/source/mir/misc/HTMLTemplateProcessor.java index 1e47adc7..1abaae5d 100755 --- a/source/mir/misc/HTMLTemplateProcessor.java +++ b/source/mir/misc/HTMLTemplateProcessor.java @@ -38,23 +38,21 @@ public final class HTMLTemplateProcessor { // init static { - + /** @todo either in the above block or here :) //rk */ templateDir = MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir"); templateCache = new FileTemplateCache(templateDir); templateCache.setLoadingPolicy(templateCache.LOAD_ON_DEMAND); - // gone in freemarker 1.71 + // gone in freemarker 1.7.1 // templateCache.startAutoUpdate(); - + theLog = Logfile.getInstance(MirConfig.getPropWithHome("HTMLTemplateProcessor.Logfile")); docRoot = MirConfig.getProp("RootUri"); - theLog=Logfile.getInstance("HTMLTemplateProcessor"); - //the quick hack is back in effect as it was more broken than ever before // -mh // sorry: nadir back in town, i have to debug the mirbase.jar in the // nadir evironment. from my point of coding, this needs an urgent // fixxx. // yeah, from my point too - tob. - //actionRoot = docRoot + "/servlet/" + MirConfig.getProp("ServletName"); + //actionRoot = docRoot + "/servlet/" + MirConfig.getProp("ServletName"); //actionRoot = docRoot + "/servlet/NadirAktuell"; actionRoot = docRoot + "/servlet/Mir"; @@ -71,7 +69,7 @@ public final class HTMLTemplateProcessor { /** * empty private constructor, to avoid instantiation */ - private HTMLTemplateProcessor () {} + private HTMLTemplateProcessor () { } // process-methods to merge different datastructures @@ -200,6 +198,10 @@ public final class HTMLTemplateProcessor { session=res.encodeURL(""); } + /** @todo why do we double those? should be cleaned up and + * statically initialized, we do not need to assemble a config + * hash everytime we give out a page, only exception is + * date "now" // rk */ // put standard configuration into tempalteRootmodel SimpleHash configHash = new SimpleHash(); configHash.put("docroot", new SimpleScalar(producerDocRoot)); @@ -217,6 +219,8 @@ public final class HTMLTemplateProcessor { tmr.put("videoHost", new SimpleScalar(videoHost)); tmr.put("audioHost", new SimpleScalar(audioHost)); tmr.put("imageHost", new SimpleScalar(imageHost)); + // this conform to updated freemarker syntax + tmr.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() ); tmr.put("config", configHash); tmpl.process(tmr, out); @@ -228,9 +232,12 @@ public final class HTMLTemplateProcessor { * Converts Entity-List to SimpleList of SimpleHashes. * @param aList ist eine Liste von Entity * @return eine freemarker.template.SimpleList von SimpleHashes. + * + * @deprecated EntityLists comply with TemplateListModel now. */ public static SimpleList makeSimpleList(EntityList aList) throws StorageObjectException { + theLog.printWarning("## using deprecated makeSimpleList(entityList) - a waste of resources"); SimpleList simpleList = new SimpleList(); if (aList != null) { for(int i=0;i/ - * getrennt ist. - * - * @param webdbDate - * @return String mit /yyyy/mm/dd - */ - public static final String webdbDate2path (String webdbDate) { - StringBuffer path = new StringBuffer(); - path.append("/").append(webdbDate.substring(0, 4)); - path.append("/").append(webdbDate.substring(4, 6)); - path.append("/"); - //who did this? - //path.append("/").append(webdbDate.substring(6, 8)); - return path.toString(); - } - - /** - * wandelt Calendar in dd.mm.yyyy um - * - * @param theDate - * @return String mit dd.mm.yyyy - */ - public static final String webdbDate2readableDate (String webdbDate) { - String date = ""; - date += webdbDate.substring(6, 8); - date += "." + webdbDate.substring(4, 6); - date += "." + webdbDate.substring(0, 4); - return date; - } - - - /** - * converts string from format: yyyy-mm-dd__hh:mm:ss.d - * to dd.mm.yyyy hh:mm - */ - public static String dateToReadableDate(String date) { - StringBuffer returnDate = new StringBuffer(); - if (date!=null) { - - returnDate.append(date.substring(8,10)).append('.'); - returnDate.append(date.substring(5,7)).append('.'); - returnDate.append(date.substring(0,4)).append(' '); - returnDate.append(date.substring(11,16)); - } - return returnDate.toString(); - } - - - /** - * schließt einen String in Anführungsszeichen ein, falls er Leerzeichen o.ä. enthält - * - * @return gequoteter String - */ - public static String quoteIfNecessary(String s) { - for (int i = 0; i < s.length(); i++) - if (!(Character.isLetterOrDigit(s.charAt(i)) || s.charAt(i) == '.')) - return quote(s, '"'); - return s; - } - - /** - * schließt s in ' ein und setzt Backslashes vor - * "gefährliche" Zeichen innerhalb des Strings - * Quotes special SQL-characters in s - * - * @return geqoteter String - */ - public static String quote(String s) - { - //String s2 = quote(s, '\''); - - //Quickhack - //Because of '?-Bug in Postgresql-JDBC-Driver - StringBuffer temp = new StringBuffer(); - for(int i=0;is in ' ein und setzt Backslashes vor - * "gefährliche" Zeichen innerhalb des Strings - * - * @param s String, der gequoted werden soll - * @param quoteChar zu quotendes Zeichen - * @return gequoteter String - */ - public static String quote(String s, char quoteChar) - { - StringBuffer buf = new StringBuffer(s.length()); - int pos = 0; - while (pos < s.length()) { - int i = s.indexOf(quoteChar, pos); - if (i < 0) i = s.length(); - buf.append(s.substring(pos, i)); - pos = i; - if (pos < s.length()) { - buf.append('\\'); - buf.append(quoteChar); - pos++; - } - } - return buf.toString(); - } - - /** - * replaces dangerous characters in s - * - */ - - public static String unquote(String s) - { - char quoteChar='\''; - StringBuffer buf = new StringBuffer(s.length()); - int pos = 0; - String searchString = "\\"+quoteChar; - while (pos < s.length()) { - int i = s.indexOf(searchString, pos); - if (i < 0) i = s.length(); - buf.append(s.substring(pos, i)); - pos = i+1; - } - return buf.toString(); - } - - /** - * Wandelet String in byte[] um. - * @param s - * @return byte[] des String - */ - - public static byte[] stringToBytes(String s) { - String crlf = System.getProperty("line.separator"); - if (!crlf.equals("\n")) - s = replace(s, "\n", crlf); - // byte[] buf = new byte[s.length()]; - byte[] buf = s.getBytes(); - return buf; - } - - /** - * Ersetzt in String s das pattern durch substitute - * @param s - * @param pattern - * @param substitute - * @return String mit den Ersetzungen - */ - public static String replace(String s, String pattern, String substitute) { - int i = 0, pLen = pattern.length(), sLen = substitute.length(); - StringBuffer buf = new StringBuffer(s.length()); - while (true) { - int j = s.indexOf(pattern, i); - if (j < 0) { - buf.append(s.substring(i)); - break; - } else { - buf.append(s.substring(i, j)); - buf.append(substitute); - i = j+pLen; - } - } - return buf.toString(); - } - - /** - * Ersetzt in String s das Regexp pattern durch substitute - * @param s - * @param pattern - * @param substitute - * @return String mit den Ersetzungen - */ - public static String regexpReplace(String haystack, String pattern, String substitute) { - try { - RE regex = new RE(pattern); - return regex.substituteAll(haystack,substitute); - } catch(REException ex){ - return null; - } - } - - - - - /** - * Fügt einen Separator an den Pfad an - * @param path - * @return Pfad mit Separator am Ende - */ - public static final String addSeparator (String path) { - return path.length() == 0 || path.endsWith(File.separator) ? path : path - + File.separatorChar; - } - - /** - * Fügt ein / ans ende des Strings and - * @param path - * @return Pfad mit / am Ende - */ - public static final String addSlash (String path) { - return path.length() == 0 || path.endsWith("/") ? path : path + '/'; - } - - /** - * Löscht / am Ende des Strings, falls vorhanden - * @param path - * @return String ohne / am Ende - */ - public static final String removeSlash (String path) { - return path.length() > 1 && path.endsWith("/") ? path.substring(0, path.length() - - 1) : path; - } - - /** - * Checks to see if the path is absolute by looking for a leading file - * separater - * @todo deal with windows drive letters. - * @param path - * @return - */ - public static boolean isAbsolutePath (String path) { - return path.startsWith(File.separator); - } - - /** - * Löscht Slash am Anfang des Strings - * @param path - * @return - */ - public static String removeFirstSlash (String path) { - return path.startsWith("/") ? path.substring(1) : path; - } - - /** - * formatiert eine Zahl (0-99) zweistellig (z.B. 5 -> 05) - * @return zwistellige Zahl - */ - public static String pad2 (int number) { - return number < 10 ? "0" + number : String.valueOf(number); - } - - /** - * formatiert eine Zahl (0-999) dreistellig (z.B. 7 -> 007) - * - * @return 3-stellige Zahl - */ - public static String pad3 (int number) { - return number < 10 ? "00" + number : number < 100 ? "0" + number : String.valueOf(number); - } - - /** - * Konvertiert Unix-Linefeeds in Win-Linefeeds - * @param s - * @return Konvertierter String - */ - public static String unixLineFeedsToWin(String s) { - int i = -1; - while (true) { - i = s.indexOf('\n', i+1); - if (i < 0) break; - if ((i == 0 || s.charAt(i-1) != '\r') && - (i == s.length()-1 || s.charAt(i+1) != '\r')) { - s = s.substring(0, i)+'\r'+s.substring(i); - i++; - } - } - return s; - } - - - /** - * verwandelt einen String in eine gültige Url, konvertiert Sonderzeichen - * und Spaces werden zu Underscores - * - * @return gültige Url - */ - public static String convert2url(String s) { - s = toLowerCase(s); - StringBuffer buf = new StringBuffer(); - for(int i = 0; i < s.length(); i++ ) { - switch( s.charAt( i ) ) { - case 'ö': - buf.append( "oe" ); break; - case 'ä': - buf.append( "ae" ); break; - case 'ü': - buf.append( "ue" ); break; - case 'ã': - buf.append( "a" ); break; - case '´': - case '.': - buf.append( "_" ); break; - case ' ': - if( buf.charAt( buf.length() - 1 ) != '_' ) { - buf.append( "_" ); - } - break; - default: - buf.append( s.charAt( i ) ); - } - } - return buf.toString(); - } - - /** - * wandelt Sonderzeichen in Quotes um - * - * @return Kovertierter String - */ - public static String encodeHtml(String s) { - StringBuffer buf = new StringBuffer(); - for(int i=0;i < s.length(); i++ ) { - - /** @todo looks inefficient */ - if (s.charAt(i)=='&') { - // convert html to xml-parsable representation - if( s.indexOf( "ö", i ) == i ) { - buf.append( "ö" ); i += 5; - continue; - } - if( s.indexOf( "ä", i ) == i ) { - buf.append( "ä" ); i += 5; - continue; - } - if( s.indexOf( "ü", i ) == i ) { - buf.append( "ü" ); i += 5; - continue; - } - if( s.indexOf( "Ö", i ) == i ) { - buf.append( "Ö" ); i += 5; - continue; - } - if( s.indexOf( "Ä", i ) == i ) { - buf.append( "Ä" ); i += 5; - continue; - } - if( s.indexOf( "Ü", i ) == i ) { - buf.append( "Ü" ); i += 5; - continue; - } - if( s.indexOf( "ß", i ) == i ) { - buf.append( "ß" ); i += 6; - continue; - } - - /** @todo should only escape outside of tags */ - - if( s.indexOf( """, i ) == i ) { - buf.append( "ß" ); i += 5; - continue; - } - if( s.indexOf( "–", i ) == i ) { - buf.append( "–" ); i += 6; - continue; - } - if( s.indexOf( "—", i ) == i ) { - buf.append( "—" ); i += 6; - continue; - } - if( s.indexOf( "“", i ) == i ) { - buf.append( "“" ); i += 6; - continue; - } - if( s.indexOf( "”", i ) == i ) { - buf.append( "”" ); i += 6; - continue; - } - if( s.indexOf( "„", i ) == i ) { - buf.append( "„" ); i += 6; - continue; - } - - //looks pretty stupid - if( s.indexOf( "<", i ) == i ) { - buf.append( "<" ); i += 3; - continue; - } - if( s.indexOf( ">", i ) == i ) { - buf.append( ">" ); i += 3; - continue; - } - if( s.indexOf( "´", i ) == i ) { - buf.append( "´" ); i += 6; - continue; - } - if( s.indexOf( " ", i ) == i ) { - buf.append( " " ); i += 5; - continue; - } - //has to be the last - if( s.indexOf( "&", i ) == i ) { - buf.append( "&" ); i += 0; - continue; - } - } - // convert umlauts an other special charakters - switch( s.charAt(i) ) { - case 'ö': buf.append( "ö" ); break; - case 'ä': buf.append( "ä" ); break; - case 'ü': buf.append( "ü" ); break; - case 'Ö': buf.append( "Ö" ); break; - case 'Ä': buf.append( "Ä" ); break; - case 'Ü': buf.append( "Ü" ); break; - case 'ß': buf.append( "ß" ); break; - case 'é': buf.append( "é" ); break; - case 'è': buf.append( "è" ); break; - case 'á': buf.append( "á" ); break; - case 'à': buf.append( "à" ); break; - case 'â': buf.append( "â" ); break; - case 'ã': buf.append( "ã" ); break; - case '¬': buf.append( "¬" ); break; - case '¹': buf.append( "¹" ); break; - case '²': buf.append( "²" ); break; - case '³': buf.append( "³" ); break; - case '¼': buf.append( "¼" ); break; - case '½': buf.append( "½" ); break; - case '¾': buf.append( "¾" ); break; - case '¶': buf.append( "¶" ); break; - case 'æ': buf.append( "æ" ); break; - case 'ð': buf.append( "ð" ); break; - case '|': buf.append( "¦" ); break; - case '·': buf.append( "·" ); break; - case '°': buf.append( "°" ); break; - case '§': buf.append( "§" ); break; - case 'ø': buf.append( "ø" ); break; - case 'ç': buf.append( "ç" ); break; - case '¤': buf.append( "¤" ); break; - case 'ª': buf.append( "ª" ); break; - case 'Ç': buf.append( "Ç" ); break; - case 'Ã': buf.append( "Ã" ); break; - case 'Â': buf.append( "Â" ); break; - case 'Æ': buf.append( "Æ" ); break; - case '©': buf.append( "©" ); break; - case '®': buf.append( "®" ); break; - case '¥': buf.append( "¥" ); break; - case 'Þ': buf.append( "þ" ); break; - case '¯': buf.append( "¯" ); break; - case 'Ð': buf.append( "Ð" ); break; - case 'º': buf.append( "º" ); break; - case '¡': buf.append( "¡" ); break; - case '£': buf.append( "£" ); break; - case '±': buf.append( "±" ); break; - case '¿': buf.append( "¿" ); break; - case 'Ø': buf.append( "Ø" ); break; - case 'Á': buf.append( "À" ); break; - case 'À': buf.append( "Á" ); break; - case 'É': buf.append( "È" ); break; - case 'È': buf.append( "É" ); break; - case 'ù': buf.append( "ú" ); break; - case 'ñ': buf.append( "ñ" ); break; - case 'Ñ': buf.append( "Ñ" ); break; - case 'µ': buf.append( "µ" ); break; - case 'Í': buf.append( "Ì" ); break; - case 'Ì': buf.append( "Í" ); break; - case 'í': buf.append( "ì" ); break; - case 'ì': buf.append( "í" ); break; - case 'î': buf.append( "î" ); break; - case 'Î': buf.append( "Î" ); break; - case 'ó': buf.append( "ó" ); break; - case 'Ó': buf.append( "Ò" ); break; - case 'ò': buf.append( "Î" ); break; - case 'Ò': buf.append( "Ó" ); break; - case 'ô': buf.append( "ô" ); break; - case 'Ô': buf.append( "Ô" ); break; - case 'õ': buf.append( "õ" ); break; - case 'Õ': buf.append( "Õ" ); break; - case 'ý': buf.append( "ý" ); break; - case 'Ý': buf.append( "Ý" ); break; - case 'û': buf.append( "û" ); break; - case 'Û': buf.append( "Û" ); break; - case 'ú': buf.append( "ù" ); break; - case 'Ú': buf.append( "Ù" ); break; - case 'Ù': buf.append( "Ú" ); break; - case 'Ê': buf.append( "Ê" ); break; - case 'ê': buf.append( "ê" ); break; - case 'å': buf.append( "å" ); break; - case 'Å': buf.append( "Å" ); break; - case 'ë': buf.append( "ë" ); break; - case 'Ë': buf.append( "Ë" ); break; - case 'ÿ': buf.append( "ÿ" ); break; - case 'ï': buf.append( "ï" ); break; - case 'Ï': buf.append( "Ï" ); break; - case '«': buf.append( "«" ); break; - case '»': buf.append( "»" ); break; - case '\'': buf.append( "´" ); break; - case '\"': buf.append( """ ); break; - //case '\u8211': buf.append( "–" ); break; - //case '\u8212': buf.append( "—" ); break; - //case '\u8220': buf.append( "“" ); break; - //case '\u8221': buf.append( "”" ); break; - //case '\u8222': buf.append( "„" ); break; - //case '\"': buf.append( """ ); break; - default: buf.append( s.charAt(i) ); - } - - } - return buf.toString(); - } - - - public static String decodeHTMLinTags(String s){ - StringBuffer buffer = new StringBuffer(); - boolean start = false; - boolean stop = false; - int startIndex = 0; - int stopIndex = 0; - int temp = 0; - - for(int i=0;i'){ - stop = true; - stopIndex = i; - - if(start && stop){ - buffer.append(s.substring(temp,startIndex)); - buffer.append(replaceQuot(s.substring(startIndex,stopIndex+1))); - i= temp= stopIndex+1; - start= stop= false; - } - } - } - if(stopIndex>0){ - buffer.append(s.substring(stopIndex+1)); - return buffer.toString(); - } else { - return s; - } - } - - public static String replaceQuot(String s) { - StringBuffer buffer = new StringBuffer(); - for(int j = 0; j < s.length();j++){ - if(s.charAt(j)=='&'){ - if(s.indexOf( """,j) == j) { - buffer.append( "\"" ); - j += 5; - }//if - } else { - buffer.append(s.charAt(j)); - }//else - }//for - return buffer.toString(); - } - - /** wandelt Quotes in Sonderzeichen um - */ - /** - public static String decodeHtml(String s) { - StringBuffer buf = new StringBuffer(); - for(int i=0;i < s.length(); i++ ) { - if( s.indexOf( "ö", i ) == i ) { - buf.append( "ö" ); i += 5; - continue; - } - if( s.indexOf( "ä", i ) == i ) { - buf.append( "ä" ); i += 5; - continue; - } - if( s.indexOf( "ü", i ) == i ) { - buf.append( "ü" ); i += 5; - continue; - } - if( s.indexOf( "Ö", i ) == i ) { - buf.append( "Ö" ); i += 5; - continue; - } - if( s.indexOf( "Ä", i ) == i ) { - buf.append( "Ä" ); i += 5; - continue; - } - if( s.indexOf( "Ü", i ) == i ) { - buf.append( "Ü" ); i += 5; - continue; - } - if( s.indexOf( "ß", i ) == i ) { - buf.append( "ß" ); i += 6; - continue; - } - if( s.indexOf( """, i ) == i ) { - buf.append( "\"" ); i += 5; - continue; - } - buf.append( s.charAt(i) ); - } - return buf.toString(); - } - */ - - /** - * schnellere Variante der String.toLowerCase()-Routine - * - * @return String in Kleinbuchsten - */ - public static String toLowerCase(String s) { - int l = s.length(); - char[] a = new char[l]; - for (int i = 0; i < l; i++) - a[i] = Character.toLowerCase(s.charAt(i)); - return new String(a); - } - - /** - * Findet element im String-Array array - * @param array - * @param element - * @return Fundstelle als int oder -1 - */ - public static int indexOf(String[] array, String element) { - if (array != null) - for (int i = 0; i < array.length; i++) - if (array[i].equals(element)) - return i; - return -1; - } - - /** - * Testet auf Vorkommen von element in array - * @param array String-Array - * @param element - * @return true wenn element vorkommt, sonst false - */ - public static boolean contains(String[] array, String element) { - return indexOf(array, element) >= 0; - } - - /** - * Ermittelt CRC-Prüfsumme von String s - * @param s - * @return CRC-Prüfsumme - */ - public static int getCRC(String s) { - int h = 0; - char val[] = s.toCharArray(); - int len = val.length; - - for (int i = 0 ; i < len; i++) { - h &= 0x7fffffff; - h = (((h >> 30) | (h << 1)) ^ (val[i]+i)); - } - - return (h << 8) | (len & 0xff); - } + private static RE re_newline2br, re_brbr2p, re_mail, re_url, re_tags; + + private StringUtil() { } // this avoids contruction + + static { + try { + //precompile regex + re_newline2br = new RE("(\r?\n){1}"); + re_brbr2p = new RE("(
\r?\n
){1,}"); + re_mail = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)"); + re_url = new RE("((https://)|(http://)|(ftp://)){1}([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/?([^ \t\r\n<>\\)\\]]+[^ \t\r\n.,<>\\)\\]])"); + re_tags = new RE("<[^>]*>",RE.REG_ICASE); + } + catch (REException e){ + System.err.println("FATAL: StringUtil: could not precompile REGEX: "+e.toString()); + } + } + + + /** + * Wandelt Datum in einen 8-ziffrigen String um (yyyymmdd) + * @param theDate + * @return 8-ziffriger String (yyyymmdd) + */ + + public static final String date2webdbDate (GregorianCalendar theDate) { + StringBuffer webdbDate = new StringBuffer(); + webdbDate.append(String.valueOf(theDate.get(Calendar.YEAR))); + webdbDate.append(pad2(theDate.get(Calendar.MONTH) + 1)); + webdbDate.append(pad2(theDate.get(Calendar.DATE))); + return webdbDate.toString(); + } + + /** + * Wandelt Calendar in einen 12-ziffrigen String um (yyyymmddhhmm) + * @param theDate + * @return 12-ziffriger String (yyyymmdd) + */ + + public static final String date2webdbDateTime (GregorianCalendar theDate) { + StringBuffer webdbDate = new StringBuffer(); + webdbDate.append(String.valueOf(theDate.get(Calendar.YEAR))); + webdbDate.append(pad2(theDate.get(Calendar.MONTH) + 1)); + webdbDate.append(pad2(theDate.get(Calendar.DATE))); + webdbDate.append(pad2(theDate.get(Calendar.HOUR))); + webdbDate.append(pad2(theDate.get(Calendar.MINUTE))); + return webdbDate.toString(); + } + + /** + * wandelt Calendar in dd.mm.yyyy / hh.mm um + * @param theDate + * @return String mit (dd.mm.yyyy / hh.mm um) + */ + public static String date2readableDateTime (GregorianCalendar theDate) { + String readable = ""; + int hour; + readable += pad2(theDate.get(Calendar.DATE)); + readable += "." + pad2(theDate.get(Calendar.MONTH) + 1); + readable += "." + String.valueOf(theDate.get(Calendar.YEAR)); + hour = theDate.get(Calendar.HOUR); + if (theDate.get(Calendar.AM_PM) == Calendar.PM) + hour += 12; + readable += " / " + pad2(hour); + readable += ":" + pad2(theDate.get(Calendar.MINUTE)); + return readable; + } + + /** + * wandelt eine Datum in einen 8-buchstabigen String, der durch / + * getrennt ist. + * + * @param webdbDate + * @return String mit /yyyy/mm/dd + */ + public static final String webdbDate2path (String webdbDate) { + StringBuffer path = new StringBuffer(); + path.append("/").append(webdbDate.substring(0, 4)); + path.append("/").append(webdbDate.substring(4, 6)); + path.append("/"); + //who did this? + //path.append("/").append(webdbDate.substring(6, 8)); + return path.toString(); + } + + /** + * wandelt Calendar in dd.mm.yyyy um + * + * @param theDate + * @return String mit dd.mm.yyyy + */ + public static final String webdbDate2readableDate (String webdbDate) { + String date = ""; + date += webdbDate.substring(6, 8); + date += "." + webdbDate.substring(4, 6); + date += "." + webdbDate.substring(0, 4); + return date; + } + + + /** + * converts string from format: yyyy-mm-dd__hh:mm:ss.d + * to dd.mm.yyyy hh:mm + */ + public static String dateToReadableDate(String date) { + StringBuffer returnDate = new StringBuffer(); + if (date!=null) { + + returnDate.append(date.substring(8,10)).append('.'); + returnDate.append(date.substring(5,7)).append('.'); + returnDate.append(date.substring(0,4)).append(' '); + returnDate.append(date.substring(11,16)); + } + return returnDate.toString(); + } + + /** + * converts string from format: yyyy-mm-dd__hh:mm:ss.d + * to yyyy + */ + public static String dateToYear (String date) { + StringBuffer returnDate = new StringBuffer(); + if (date!=null) { + + returnDate.append(date.substring(0,4)); + } + return returnDate.toString(); + } + + /** + * converts string from format: yyyy-mm-dd__hh:mm:ss.d + * to [m]m + */ + public static String dateToMonth (String date) { + StringBuffer returnDate = new StringBuffer(); + if (date!=null) { + if (!date.substring(5,6).equalsIgnoreCase("0")) returnDate.append(date.substring(5,7)); + else returnDate.append(date.substring(6,7)); + } + return returnDate.toString(); + } + + /** + * converts string from format: yyyy-mm-dd__hh:mm:ss.d + * to [d]d + */ + public static String dateToDayOfMonth (String date) { + StringBuffer returnDate = new StringBuffer(); + if (date!=null) { + if (!date.substring(8,9).equalsIgnoreCase("0")) returnDate.append(date.substring(8,10)); + else returnDate.append(date.substring(9,10)); + } + return returnDate.toString(); + } + + /** + * converts string from format: yyyy-mm-dd__hh:mm:ss.d + * to hh:mm + */ + public static String dateToTime (String date) { + StringBuffer returnDate = new StringBuffer(); + if (date!=null) { + returnDate.append(date.substring(11,16)); + } + return returnDate.toString(); + } /** - * Liefert Default-Wert def zurück, wenn String s - * kein Integer ist. - * - * @param s - * @param def - * @return geparster int aus s oder def - */ - public static int parseInt(String s, int def) { - if (s == null) return def; - try { - return Integer.parseInt(s); - } catch (NumberFormatException e) { - return def; - } - } - - /** - * Liefert Defaultwert def zurück, wenn s nicht zu einem float geparsed werden kann. - * @param s - * @param def - * @return geparster float oder def - */ - public static float parseFloat(String s, float def) { - if (s == null) return def; - try { - return new Float(s).floatValue(); - } catch (NumberFormatException e) { - return def; - } - } - - /** - * Findet Ende eines Satzes in String text - * @param text - * @param startIndex - * @return index des Satzendes, oder -1 - */ - public static int findEndOfSentence(String text, int startIndex) { - while (true) { - int i = text.indexOf('.', startIndex); - if (i < 0) return -1; - if (i > 0 && !Character.isDigit(text.charAt(i-1)) && - (i+1 >= text.length() - || text.charAt(i+1) == ' ' - || text.charAt(i+1) == '\n' - || text.charAt(i+1) == '\t')) - return i+1; - startIndex = i+1; - } - } - - /** - * Findet Wortende in String text ab startIndex - * @param text - * @param startIndex - * @return Index des Wortendes, oder -1 - */ - public static int findEndOfWord(String text, int startIndex) { - int i = text.indexOf(' ', startIndex), - j = text.indexOf('\n', startIndex); - if (i < 0) i = text.length(); - if (j < 0) j = text.length(); - return Math.min(i, j); - } - - /** - * This routine makes html links (href) out of text browseable urls - * @param text - * @return Konvertierter String - */ - public static String makeLinks(String text) { - int i = 0; - StringBuffer buf = new StringBuffer(text.length()); - while (true) { - int j = text.indexOf("http://", i); - if (j < 0) { - buf.append(text.substring(i)); - break; - } else { - buf.append(text.substring(i, j)); - int k = findEndOfWord(text,j+7); - String url=""; - if (k<0) url = text.substring(j); - else url = text.substring(j,k); - - buf.append(""+url+""); - //System.out.println("url mark: " + url); - i = j+url.length(); - } - } - return buf.toString(); - - } - - - /** - * convertNewline2P ist eine regex-routine zum umwandeln von 2 oder mehr newlines (\n) - * in den html-tag

- * nur sinnvoll, wenn text nicht im html-format eingegeben - */ - public static String convertNewline2P(String haystack) { - try { - RE regex = new RE("(
\r?\n
){1,}"); - return regex.substituteAll(haystack,"\n

"); - } catch(REException ex){ - return null; - } - } - - /** - * convertNewline2Break ist eine regex-routine zum umwandeln von 1 newline (\n) - * in den html-tag
- * nur sinnvoll, wenn text nicht im html-format eingegeben - */ - public static String convertNewline2Break(String haystack) { - try { - RE regex = new RE("(\r?\n){1}"); - return regex.substituteAll(haystack,"$0
"); - } catch(REException ex){ - return null; - } - } - - /** - * createMailLinks wandelt text im email-adressenformat - * in einen klickbaren link um - * nur sinnvoll, wenn text nicht im html-format eingegeben - */ - public static String createMailLinks(String haystack) { - try { - RE regex = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)"); - return regex.substituteAll(haystack,"$0"); - } catch(REException ex){ - return null; - } - } - - - /** - * createMailLinks wandelt text im email-adressenformat - * in einen klickbaren link um - * nur sinnvoll, wenn text nicht im html-format eingegeben - */ - public static String createMailLinks(String haystack, String imageRoot, String mailImage) { - try { - RE regex = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)"); - return regex.substituteAll(haystack," $0"); - } catch(REException ex){ - return null; - } - } - - - /** - * createURLLinks wandelt text im url-format - * in einen klickbaren link um - * nur sinnvoll, wenn text nicht im html-format eingegeben - */ - public static String createURLLinks(String haystack) { - try { - //dieser Ausdruck brauch dringend fachliche Beratung - RE regex = new RE("((https://)|(http://)|(ftp://))+([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/([^ \t\r\n<>]+[^ \t\r\n.,<>])"); - return regex.substituteAll(haystack,"$0"); - } catch(REException ex){ - return null; - } - } - - /** - * this routine takes text in url format and makes - * a clickaeble "" link removing any "illegal" html tags - * @param haystack, the url - * @param title, the href link text - * @param imagRoot, the place to find icons - * @param extImage, the url of the icon to show next to the link - * @return a String containing the url - */ - public static String createURLLinks(String haystack, String title, String imageRoot,String extImage) { - try { - //dieser Ausdruck brauch dringend fachliche Beratung - RE regex = new RE("((https://)|(http://)|(ftp://))+([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/?([^ \t\r\n<>]+[^ \t\r\n.,<>])"); - if (title == null) { - return regex.substituteAll(haystack," $0"); - } else { - title = removeHTMLTags(title); - return regex.substituteAll(haystack," "+title+""); - } - } catch(REException ex){ - return null; - } - } - - /** - * this routine takes text in url format and makes - * a clickaeble "" link removing any "illegal" html tags - * @param haystack, the url - * @param imageRoot, the place to find icons - * @param extImage, the url of the icon to show next to the link - * @param intImage, unused - * @return a String containing the url - */ - public static String createURLLinks(String haystack, String title, String imageRoot,String extImage,String intImage) { - return createURLLinks(haystack, title, imageRoot, extImage); - } - - /** - * this routine takes text in url format and makes - * an image link removing any "illegal" html tags - * @param haystack, the url - * @param title, the image alt text, can be null - * @param height, height of the image - * @param width, width of the image - * @return a String containing the url - */ - public static String createIMGLinks(String haystack, String title, String height,String width) { - try { - //dieser Ausdruck brauch dringend fachliche Beratung - RE regex = new RE("((https://)|(http://)|(ftp://))+([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/?([^ \t\r\n<>]+[^ \t\r\n.,<>])"); - if (title != null) { - title = removeHTMLTags(title); - return regex.substituteAll(haystack,"\""+title+"\"/ 
"+title+""); - } else { - return regex.substituteAll(haystack,"\"\"/ "); - } - } catch(REException ex){ - return null; - } - } - - - - /** - * deleteForbiddenTags - * this method deletes all - - - - - - - +indymedia.de | comment.commit + + +

+ - - - +
- + - - + - - + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + +
- Kommentierung eines Beiträgs bei Indymedia - + Kommentierung eines Beiträgs bei Indymedia +
- -

- Bitte respektiere die Meinungen anderer und bleibe beim - Thema des Artikels, den Du kommentierst und versuche, - präzise zu sein. -

- Indymedia ist grundsätzlich offen für alle Meinungen, - es sei denn sie haben faschistische, rassistische, - sexistische oder generell menschenverachtende Inhalte. - Bedenke bei Deinem Kommentar, dass die Leute, die hier - schreiben, nicht unbedingt einer Weltanschauung sind. - Darum beurteile sie auch nicht danach. Indymedia ist - für alle, die meinen, etwas zu sagen zu haben zu den - politischen und sozialen Verhältnissen auf der Welt. - Darum erwarten wir, dass Kommentar-SchreiberInnen - grundsätzlich solidarisch auf andere Meinungen - reagieren. Wir behalten uns vor, diffamierende - Aburteilungen und Beschimpfungen zu löschen. -

-
-
+

+ + Hinweis: Dein Kommentar kann in jedem Stil und jeder Form sein, akademisch bis persönlich.
+ Aber bitte bleibe beim Thema des Artikels, den Du kommentierst und versuche, präzise zu sein. +
+

+ +
- Kommentierungsformular - + Kommentierungsformular +
- Titel des Kommentars: -
- [ muss ausgefüllt werden ] -
+ Titel des Kommentars: + + (muss ausgefüllt werden) +
- Dein Name: - -
- [ muss ausgefüllt werden ] -
+ Dein Name: + + (muss ausgefüllt werden) +
- Deine eMail-Adresse: - -
- [ optional ] -
+ Deine eMail-Adresse: + + (optional) +
- Deine Web Adresse: - -
- [ optional ] -
+ Deine Web Adresse: + + (optional) +
- Deine Telefon-Nr.: - -
- [ optional ] -
+ Deine Telefon-Nr.: + + (optional) +
- Deine Adresse: - -
- [ optional ] -
+ Deine Adresse: + + (optional) +
- Die Sprache deines Kommentares: - - - [ optional ] - + Die Sprache deines Kommentares: + + + (optional) +
- Dein Kommentar: -   -

-
+ Dein Kommentar: + +   +

+
- Bitte drücke den Verschicken-Knopf nur einmal!!!
- In wenigen Minuten ist Dein Kommentar unter dem kommentierten - Artikel. Manchmal kann es aber aufgrund technischer Probleme - etwas dauern bis er erscheint. -

- Die Moderationskriterien kannst Du - hier nachlesen

-

  -
-

  -
-
-
  + +
+  
+ +
+
+  
+ +
+
diff --git a/templates-dist/de/open/comment_done.template b/templates-dist/de/open/comment_done.template index bff8e759..1dfc6ed3 100755 --- a/templates-dist/de/open/comment_done.template +++ b/templates-dist/de/open/comment_done.template @@ -1,76 +1,35 @@ - - - Indymedia Germany | Comment done | ${now} - - - - - - - - - - - - - - - - + + + indymedia.de | open posting + - - + - - - - - - - - - - -
- Immer ruhig mit den jungen Pferden! -
-

- Du hast vermutlich den Reload-Button - benutzt oder versucht, Deinen Kommentar noch einmal zu posten. Das ist aber - unnötig. Die Tatsache, dass Du diesen Text liest, bedeutet, dass Dein - Kommentar schon angekommen ist. Er wird gleich auf der Seite auftauchen. Versprochen. -
Keine Panik!


-
-
- - >> Zurück zum kommentierten Artikel -
+ + + + + + + + + +
+ Dein Kommentar ist jetzt auf dem Weg zur WebSite! +
+ +
+ Er landet direkt in einem intelligenten Filter - und wenn er keine rassistischen, sexistischen oder faschistischen Inhalte oder Werbung enthält, wird er in Kürze auf http://www.germany.indymedia.org/newswire/ auftauchen.
+
+
Gedulde Dich einen Moment - Es lohnt sich!

+
+
+
+ >> Zurück zum kommentierten Artikel +
diff --git a/templates-dist/de/open/comment_dupe.template b/templates-dist/de/open/comment_dupe.template index bff8e759..9ec36487 100755 --- a/templates-dist/de/open/comment_dupe.template +++ b/templates-dist/de/open/comment_dupe.template @@ -1,76 +1,40 @@ - - - Indymedia Germany | Comment done | ${now} - - - - - - - - - - - - - - - - + + + indymedia.de | open posting - Kommentar-Duplikat + - - + - - - - - - - - - - -
- Immer ruhig mit den jungen Pferden! -
-

- Du hast vermutlich den Reload-Button - benutzt oder versucht, Deinen Kommentar noch einmal zu posten. Das ist aber - unnötig. Die Tatsache, dass Du diesen Text liest, bedeutet, dass Dein - Kommentar schon angekommen ist. Er wird gleich auf der Seite auftauchen. Versprochen. -
Keine Panik!


-
-
- - >> Zurück zum kommentierten Artikel -
+ + + + + + + + + +
+ + Immer ruhig mit den jungen Pferden! + +
+ +
+ Du hast vermutlich den Reload-Button + benutzt oder versucht, Deinen Kommentar noch einmal zu posten. Das ist aber + unnötig. Die Tatsache, dass Du diesen Text liest, bedeutet, dass Dein + Kommentar schon angekommen ist. Er wird gleich auf der Seite auftauchen. Versprochen. +
+
Keine Panik

+
+
+
+ >> Zurück zum kommentierten Artikel +
diff --git a/templates-dist/de/open/posting.template b/templates-dist/de/open/posting.template index c930b658..b61959cb 100755 --- a/templates-dist/de/open/posting.template +++ b/templates-dist/de/open/posting.template @@ -1,388 +1,216 @@ -Indymedia Germany | Open Posting | ${now} - - - - - - - - - - - - - - - - - - - - + indymedia.de | open posting + + + + + + + + - - - - - - - - - - - - - - - - - - - - -
- - Direkt zum Eingabeformular springen! -
-

- Veröffentliche Deinen Beitrag

-
-

Kurze Anleitung zum Posten eines Beitrages in de.indymedia.org

- - - -Indymedia ist ein basisdemokratischer Nachrichtenkanal. -Wir arbeiten aus Liebe und aus Respekt gegenüber Menschen, -die sich für eine bessere, lebenswertere Welt engagieren. -Bei Indymedia kann grundsätzlich JedeR Texte, Videos, Audios oder Fotos -zu politischen oder sozialen Themen veröffentlichen. -

- -Indymedia will vor allem die Möglichkeit geben, -subjektive Stellungnahmen verschiedenster Menschen -'auf der Strasse' über politische Ereignisse oder aus -der alltäglichen Lebenswelt zu veröffentlichen. Zudem -ist Indymedia eine Plattform für Hintergrundberichte, -die andere Hintergründe als kommerzielle Medien aufzeigen. -

+ -Um indymedia als Plattform für eigene -Berichterstattung zu konturieren, werden bestimmte -Beiträge nicht auf die Startseite gestellt. Dazu gehören: -

-
    -
  • -Termine und Demoaufrufe [ Weil wir wissen, dass diese für die Mobilisierung -sehr wichtig sind, verlinken wir zu verschiedenen Internetprojekten, auf -denen Ihr gute Terminsammlungen findet ] Bei angelaufenen Kampagnen werden -regelmäßig Termine und Aufrufe in die Mittelspalten-Texte als Links gesetzt. -

    + + + + + + + + + - - - - - - - +

    Zur Erinnerung:

    +

      +
    • Bitte schicke nur News-Artikel und benutze zum Kommentieren von Artikeln das Kommentierformular, das Du unter jedem Artikel findest. +
    • Bitte schicke nur eine Kopie Deines Artikels - Bitte drücke den Verschicken-Knopf nur einmal. +
    • Veröffentliche nur selbst erstellte Beiträge. (Keine Agenturmeldungen, Zeitungsartikel oder ähnliches!). +
    + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Direkt zum Eingabeformular springen! +
    +
    +
    + Veröffentliche Deinen Beitrag

    +
    +

    Kurze Anleitung zum Posten eines Beitrages in germany.indymedia

    -
  • -schon an anderen Stellen veröffentlichte Texte aus kommerziellen Medien -kopierte Texte
    -[ hierbei sind Übersetzungen von Texten und Meldungen -von hier kaum zugänglichen Medien eine Ausnahme ] -

    +

    Das Independent Media Center ist ein kollektiv geführtes Mediennetzwerk zur Produktion von radikalen, passionierten und durchaus auch subjektiven, persönlichen Stellungnahmen verschiedenster Menschen 'auf der Strasse', z.B. vor, während oder nach Kampagnen, polit. Ereignissen oder aus der alltäglichen Lebenswelt. Wir arbeiten aus Liebe und aus Respekt gegenüber Menschen, die sich für eine bessere, lebenswertere Welt engagieren, und deren Arbeit von den Medienkonzernen nicht oder nur verzerrt dargestellt wird.

    -
  • Gruppenstatements, Presseerklärungen, Diskussionspapiere, Massenmails -
    +

    Indymedia ist ein demokratischer Nachrichtenkanal. Wir wollen Beiträge, Artikel, Meinungen und Infos aus der ganzen Welt veröffentlichen. Alle Beiträge werden sofort unzensiert veröffentlicht, sofern sie nicht in die im Mission Statement genannten Kategorien fallen. Allerdings erscheinen sie dann nicht gleich auf der Startseite, sondern auf einer eigenen Open-Posting-Seite. Dort werden sie von wechselnden Moderationsteams gegengelesen und + anschliessend auf den newswire der Starttseite weitergeleitet.
    + Um diesen Ausschlussprozess so transparent wie möglich zu gestalten, können alle nicht veröffentlichten Beiträge per e-mail angefordert weren.

    -[auch hier geht es um die Zugänglichkeit von Texten. Beiträge von -Gruppen, die schon auf zahlreichen anderen Internet-Seiten oder in -Zeitschriften veröffentlicht wurden, werden nicht auf die Startseite -gestellt, weil es nicht der Ansatz von indymedia ist alles -irgendwie relevante auf der Seite zu versammeln, sondern eine -Plattform für eigene Berichterstattung zu sein. Unter eigener -Berichtserstattung verstehen wir allerdings Presseerklärungen -von Kleingruppen oder Diskussionspapiere einzelner -

    -
  • -superkurze Meldungen: -

    +

    Bitte benutze dieses Formular nur, um neue Beiträge und Ideen beizusteuern. Kommentare gehören zu dem jeweils diskutierten Beitrag. Wenn Du etwas zu einem Beitrag zu sagen hast, dann benutze dafür bitte die Kommentar-Funktion am Ende jedes Beitrags.

    -
  • -reine Kommentare ohne Nachrichtenwert
    -[ Zusätzlich zu den selbstverfassten Beiträgen, gibt es bei indymedia -noch die Möglichkeit über Artikel zu diskutieren. -Das könnt Ihr unter dem jeweiligen Artikel - einfach auf -"Kommentar eingeben" klicken ] -

    +

    Unser Auffassung nach sollten Beiträge, die an diese Site geschickt werden, frei zur nicht-kommerziellen Wiederverwertung sein. Wenn Du nicht möchtest, dass das für Deinen Beitrag zutrifft, dann nenne Deine Konditionen in der Zusammenfassung.

    -
  • -Beiträge von hierarchischen Gruppen und Parteien -

    +

    Du kannst dieses Formular benutzen, um Deinen Artikel, Deinen Audio-Beitrag, Deinen Video-Beitrag oder Deine Fotos zu veröffentlichen. Bitte beschränke Dich auf Beiträge zu politischem oder sozialem Aktivismus. Wir (die Menschen, die diese Site organisieren) behalten uns vor, die Präsentation der zugeschickten Beiträge zu verändern. Weitere Informationen findest Du im Mission Statement.

    -
  • -Außerdem gibt es Beiträge, die sofort in ein -Müllarchiv kommen: -

    -[1] Diskriminierender oder menschenverachtender Inhalt. -

    -[2] Offensichtlicher Spam +

    Nach dem Beiträge veröffentlicht wurden, können sie vom Kollektiv, das diese Site betreut, editiert, verlinkt oder sogar gelöscht werden.

    +
    - - -

    -Was mit Eurem Beitrag passiert, lest Ihr am besten -unter Grundsätze und Moderation nach. Hier eine kurze Zusammenfassung: -

    - -Alle Beiträge werden sofort unzensiert veröffentlicht. -Allerdings erscheinen sie dann nicht gleich auf der -Startseite, sondern auf der Open-Posting-Seite -alle Beiträge -alle Beiträge. Dort werden sie von Moderationskollektiven -gegengelesen. Entsprechen sie den indymedia-Grundsätzen -werden sie auf den newswire der Startseite weitergeleitet. -In die Mittelspalte nehmen wir in der Regel Beiträge, -die einen guten Überblick über ein aktuelles Thema geben. -Diese Artikel werden von uns auch leicht redigiert: -Wir korrigieren Rechtschreibfehler, versuchen unverständliche -Stellen zu glätten und setzen Links hinein. Verlautbarungen, -Texte, die keinen politischen oder sozialen Inhalt haben, -reine Diskussionsbeiträge und Termine bleiben im Open Posting. -Texte mit menschenverachtendem Inhalt oder Spam kommen ins -Müllarchiv. Damit sind sie nicht mehr einsehbar. Wer -sie trotzdem lesen will, kann sie per e-mail anfordern. -Diese Moderationskriterien sind Resultat eines weltweiten -Diskussionsprozesses über indymedia und werden ständig neu -diskutiert und überarbeitet. -

    - -Urheberrecht: Unserer Auffassung nach sollten -Beiträge, die an diese Site geschickt werden, frei zur -nicht-kommerziellen Wiederverwertung sein. Wenn Du -nicht möchtest, dass das für Deinen Beitrag zutrifft, -dann nenne Deine Konditionen in der Zusammenfassung. -

    - -
  • -
    - Veröffentlichungsformular -
    -
    - Anzahl der Medien - -   -
    Anzahl der Medien  +
    - Gib Deinem Beitrag einen Titel: - -
    - [ muss ausgefüllt werden ] - -
    - Thema Von Deinem Beitrag: - -
    - [ optional ] -
    - AutorIn des Beitrags: - -
    - [ muss ausgefüllt werden ] -
    - Eine kurze Zusammenfassung des Beitrags: - -
    - [ nicht mehr als 15 Zeilen ] -
    - - Die Kontaktinformationen sind optional, aber ermöglichen, - dass unser Publikum (z.B. auch JournalistInnen) Dich bezüglich - Deines Beitrages erreichen können, was auch eine Weiterverwertung - Deines Beitrages an anderen Stellen ermöglicht. - -
    - Deine eMail-Adresse: - -
    - [ optional ] -
    - Deine Web Adresse: - -
    - [ optional ] -
    - Deine Adresse: - -
    - [ optional ] -
    - Deine Telefon-Nr.: - -
    - [ optional ] -
    - Die Sprache deines Beitrages: - -
    - [ optional ] -
    - ein Artikel:
    - Der Text, der Deinen Beitrag begleiten soll - - wenn Du nur Text schicken willst, dann benutze auch dafür dieses Feld. -
      - -

    -
    - Medien: - - Hier kannst Du ein Medien zu Deinem Artikel hochladen
    -
    Bild ${m} -
    - [ optional ] -
    - Medienunterschrift ${m}: - -
    - [ optional ] -
    +
    Veröffentlichungsformular
    +
    + Gib Deinem Beitrag einen Titel: + +
    (muss ausgefüllt werden)
    +
    + Thema Von Deinem Beitrag: + + + (optional) +
    + AutorIn des Beitrags: + +
    (muss ausgefüllt werden)
    +
    + Eine kurze Zusammenfassung des Beitrags: + + +
    (nicht mehr als 5 Zeilen)
    +
    + + Die Kontaktinformationen sind optional, aber ermöglichen, dass unser Publikum (z.B. auch JournalistInnen) Dich bezüglich Deines Beitrages erreichen können, was auch eine Weiterverwertung Deines Beitrages an anderen Stellen ermöglicht. + +
    + Deine eMail-Adresse: + + (optional) +
    + Deine Web Adresse: + + + (optional) +
    + Deine Adresse: + + (optional) +
    + Deine Telefon-Nr.: + + (optional) +
    + Die Sprache deines Beitrages: + + + (optional) +
    + Dein Artikel:
    + Der Text, der Deinen Beitrag begleiten soll - wenn Du nur Text schicken willst, dann benutze auch dafür dieses Feld. +
    +   +

    +
    + Medien: + + Hier kannst Du ein Medien zu Deinem Artikel hochladen (bislang nur jpg-Bilder)
    +
    Bild ${m} + (optional) +
    + Medienunterschrift ${m}: + + (optional) +
    +
    +  
    + +
    +
    +  
    +
    - -
-

- - Bitte drücke den Verschicken-Knopf nur einmal!!!
- In wenigen Minuten erscheind Dein Beitrag dann auf der - - "Open Posting" - Seite.
- Das ist nicht die Startseite.
- Manchmal kann es aber aufgrund technischer Probleme - etwas dauern bis er erscheint. -

- Die Moderationskriterien kannst Du - hier nachlesen -

-

  -
-

  -
-
diff --git a/templates-dist/de/open/posting_done.template b/templates-dist/de/open/posting_done.template index 22f257c8..d58649a6 100755 --- a/templates-dist/de/open/posting_done.template +++ b/templates-dist/de/open/posting_done.template @@ -2,78 +2,39 @@ -Indymedia Germany | Open Posting | ${now} - - + indymedia.de | open posting + - - - - - - - - - - - - - + + +
+ - - - + + + + + + +
Hurra, Du hast Deinen Artikel abgeschickt!
+ + +
- + +
+Dein Artikel landet jetzt direkt in einem intelligenten Filter. Wenn Dein Artikel keine rassistischen, sexistischen oder faschistischen Inhalte hatte, und auch nicht ganz ohne Inhalt, also leer war, dann wird er in Kürze auf http://www.germany.indymedia.org/newswire/ auftauchen.

+
Gedulde Dich einen Moment! Es lohnt sich!


- - - - - - - - - - + + + + + + +
- Hurra, Du hast Deinen Artikel abgeschickt! -
- -
- Dein Artikel landet in einigen Minuten auf der - "Open Posting" - - Seite. Das ist nicht die Startseite. - Die Moderationskriterien kannst Du - hier lesen

-
Gedulde Dich einen Moment! Es lohnt sich!


-
-
- >> Zurück -
+ >> Zurück +
- - + \ No newline at end of file diff --git a/templates-dist/de/open/posting_dupe.template b/templates-dist/de/open/posting_dupe.template index 09f9bf0b..d8b5d20a 100755 --- a/templates-dist/de/open/posting_dupe.template +++ b/templates-dist/de/open/posting_dupe.template @@ -2,78 +2,41 @@ -Indymedia Germany | Open Posting | ${now} - - - - - - - - - - - - - - - - - - - + indymedia.de | open posting - Posting-Duplikat - + - - - - - - - - - - +
- Immer ruhig mit den jungen Pferden! -
- -
- Du hast vermutlich den Reload-Button - benutzt oder versucht, Deinen Artikel noch einmal zu posten. Das ist aber - unnötig. Die Tatsache, dass Du diesen Text liest, bedeutet, dass Dein - Posting schon angekommen ist. Er wird gleich auf der Seite auftauchen. Versprochen.
- Technischer Hintergrund ist, daß de.indy über einen - Proxy-Server läuft und der ist nicht immer minuten-aktuell. -
Keine Panik!


-
-
- >> Zurück -
+ + + + + + + +
+ + Immer ruhig mit den jungen Pferden! + +
+ +
+ Du hast vermutlich den Reload-Button + benutzt oder versucht, Deinen Artikel noch einmal zu posten. Das ist aber + unnötig. Die Tatsache, dass Du diesen Text liest, bedeutet, dass Dein + Posting schon angekommen ist. Er wird gleich auf der Seite auftauchen. Versprochen. +
+ Technischer Hintergrund ist, daß de.indy über einen + Proxy-Server läuft und der ist nicht immer minuten-aktuell. +
+
Keine Panik

+
+
+
+ >> Zurück +
diff --git a/templates-dist/producer/content.template b/templates-dist/producer/content.template index d18c8ff8..04fb3e69 100755 --- a/templates-dist/producer/content.template +++ b/templates-dist/producer/content.template @@ -1,11 +1,20 @@ -mir.indymedia.de: ${title} +mir.indymedia.de: ${content.title} - - - + + + + + + + + + + + + @@ -55,29 +64,42 @@
-

${title}

-

${creator}, ${webdb_create_formatted}

-

${description} +

${content.title}

+

${content.creator}, ${content.webdb_create_formatted}

+

${content.description} - -

- + +

+ ${media["url"]} +

+ + +

+ ${media["url"]} +

+
+ +

+ ${media["url"]} +

+
+ +

I ${media["url"]} -

-

${content_data}

- +

${content.content_data}

+ @@ -88,12 +110,12 @@ - - - + +
- - - eMail: ${creator_email}
+ + - eMail: ${content.creator_email}
- - Homepage: ${creator_main_url}
+ + Homepage: ${content.creator_main_url}
 
+ Make a quick comment on this article
diff --git a/templates-dist/producer/openposting.template b/templates-dist/producer/openposting.template index a3592551..577490d4 100755 --- a/templates-dist/producer/openposting.template +++ b/templates-dist/producer/openposting.template @@ -58,19 +58,19 @@

${i.title}

${i.creator}, ${i.webdb_create_formatted}

- - ${i.to_media_audio[0]["url"]} - - - ${i.to_media_video[0]["url"]} - - - ${i.to_media_other[0]["url"]} - -

- - ${i.to_media_images[0]["url"]} - + + ${i.to_media_audio[0]["list"]} + + + ${i.to_media_video[0]["list"]} + + + ${i.to_media_other[0]["list"]} + +

+ + ${i.to_media_images[0]["list"]} + ${i.description}

[read]

diff --git a/templates-dist/producer/startpage.template b/templates-dist/producer/startpage.template index 3a44bb0b..d5f4bc75 100755 --- a/templates-dist/producer/startpage.template +++ b/templates-dist/producer/startpage.template @@ -58,17 +58,17 @@

${s.creator}, ${s.webdb_create_formatted}

- ${s.to_media_audio[0]["url"]} + ${s.to_media_audio[0]["list"]} - ${s.to_media_video[0]["url"]} + ${s.to_media_video[0]["list"]} - ${s.to_media_other[0]["url"]} + ${s.to_media_other[0]["list"]}

- ${s.to_media_images[0]["url"]} + ${s.to_media_images[0]["list"]} ${s.description}

[read]

@@ -87,17 +87,17 @@

${i.creator}, ${i.webdb_create_formatted}

- ${i.to_media_audio[0]["url"]} + ${i.to_media_audio[0]["list"]} - ${i.to_media_video[0]["url"]} + ${i.to_media_video[0]["list"]} - ${i.to_media_other[0]["url"]} + ${i.to_media_other[0]["list"]}

- ${i.to_media_images[0]["url"]} + ${i.to_media_images[0]["list"]} ${i.description}

[read]

@@ -121,8 +121,8 @@

- ${n.icon_alt} + ${n.to_media_icon["icon_alt"]} ${n.title}
${n.webdb_create_formatted}

diff --git a/templates-dist/producer/topiclist.template b/templates-dist/producer/topiclist.template index 04ab03cf..1b75e662 100755 --- a/templates-dist/producer/topiclist.template +++ b/templates-dist/producer/topiclist.template @@ -59,17 +59,17 @@

${special.creator}, ${special.webdb_create_formatted}

- ${special.to_media_audio[0]["url"]} + ${special.to_media_audio[0]["list"]} - ${special.to_media_video[0]["url"]} + ${special.to_media_video[0]["list"]} - ${special.to_media_other[0]["url"]} + ${special.to_media_other[0]["list"]}

- ${special.to_media_images[0]["url"]} + ${special.to_media_images[0]["list"]} ${special.description}

[read]

@@ -87,17 +87,17 @@

${i.creator}, ${i.webdb_create_formatted}

- ${i.to_media_audio[0]["url"]} + ${i.to_media_audio[0]["list"]} - ${i.to_media_video[0]["url"]} + ${i.to_media_video[0]["list"]} - ${i.to_media_other[0]["url"]} + ${i.to_media_other[0]["list"]}

- ${i.to_media_images[0]["url"]} + ${i.to_media_images[0]["list"]} ${i.description}

[read]

diff --git a/templates-dist/usererror.template b/templates-dist/usererror.template new file mode 100755 index 00000000..3b408884 --- /dev/null +++ b/templates-dist/usererror.template @@ -0,0 +1,37 @@ + + +indymedia.de | Fehlerhafte Eingabe + + + +
+ + + + + + + + + + + + +
+

OOPS!

+
+
+

Bei der Eingabe hat es folgende fehler gegeben: +

+

+

${errorstring} +

+

+

+

Also, bitte druecken sie die zueruck taste und versuchen sie nochmal + +

+

+ + +