Rev 975 | Rev 11930 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 975 | Rev 4489 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
2 | #use Date::Format; |
2 | #use Date::Format; |
- | 3 | use warnings; |
|
3 | 4 | use strict; |
|
4 | require Time::Local; |
5 | require Time::Local; |
5 | 6 | ||
6 | use vars qw(@DoW @MoY %MoY); |
7 | use vars qw(@DoW @MoY %MoY); |
7 | @DoW = qw(Sun Mon Tue Wed Thu Fri Sat); |
8 | @DoW = qw(Sun Mon Tue Wed Thu Fri Sat); |
8 | @MoY = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); |
9 | @MoY = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); |
9 | @MoY{@MoY} = (1..12); |
10 | @MoY{@MoY} = (1..12); |
10 | 11 | ||
11 | my %GMT_ZONE = (GMT => 1, UTC => 1, UT => 1, Z => 1); |
12 | my %GMT_ZONE = (GMT => 1, UTC => 1, UT => 1, Z => 1); |
12 | 13 | ||
13 | 14 | ||
14 | $wims_ref='http://127.0.0.1/wims'; |
15 | my $wims_ref='http://127.0.0.1/wims'; |
15 | $file='' ; |
16 | my $file='' ; |
- | 17 | my ($out, $modif, $text); |
|
16 | push (@ARGV,split(' ', $ENV{'wims_exec_parm'})) if ($ENV{'wims_exec_parm'}) ; |
18 | push (@ARGV,split(' ', $ENV{'wims_exec_parm'})) if ($ENV{'wims_exec_parm'}) ; |
17 | 19 | ||
18 | while ($_ = shift (@ARGV)) |
20 | while ($_ = shift (@ARGV)) |
19 | { |
21 | { |
20 | last if (!/^--/); |
22 | last if (!/^--/); |
Line 22... | Line 24... | ||
22 | elsif (/^--file=(.*)$/) { $file = $1 ; } |
24 | elsif (/^--file=(.*)$/) { $file = $1 ; } |
23 | elsif (/^--out=(.*)$/) { $out = $1 . "/" ; } |
25 | elsif (/^--out=(.*)$/) { $out = $1 . "/" ; } |
24 | elsif (/^--type=(.*)$/) { $modif = $1 ; } |
26 | elsif (/^--type=(.*)$/) { $modif = $1 ; } |
25 | } ; |
27 | } ; |
26 | $wims_ref =~ s,/wims.cgi,, ; |
28 | $wims_ref =~ s,/wims.cgi,, ; |
27 | $head= "<\?xml version=\"1.0\" encoding=\"ISO-8859-1\"\?> |
29 | my $head= "<\?xml version=\"1.0\" encoding=\"ISO-8859-1\"\?> |
28 | <rss version=\"2.0\"> |
30 | <rss version=\"2.0\"> |
29 | <channel> |
31 | <channel> |
30 | <title>WIMS</title> |
32 | <title>WIMS</title> |
31 | <link>$wims_ref</link> |
33 | <link>$wims_ref</link> |
32 | <description>NEWS</description> |
34 | <description>NEWS</description> |
33 | \n" |
35 | \n" |
34 | ; |
36 | ; |
35 | 37 | ||
36 | $tail="</channel></rss>"; |
38 | my $tail="</channel></rss>"; |
37 | 39 | ||
38 | open(IN, "$file.$modif") or die $file ; |
40 | open(IN, "$file.$modif") or die $file ; |
39 | my @lignes = <IN>; |
41 | my @lignes = <IN>; |
40 | my ($cnt, $used)= (1) ; |
42 | my ($cnt, $used)= (1,'') ; |
- | 43 | my @ta; |
|
41 | foreach( reverse( @lignes ) ) { |
44 | foreach( reverse( @lignes ) ) { |
42 | my @l=split(":", $_) ; |
45 | my @l=split(":", $_) ; |
43 | my $date= convdate($l[0]) ; |
46 | my $date= convdate($l[0]) ; |
- | 47 | next if !($l[1]) ; |
|
44 | my @ta=split(" ", $l[1]) ; |
48 | my @ta=split(" ", $l[1]) ; |
45 | next if !($l[1]) || ($used =~ /$l[1]/) || ($cnt > 100) ; |
49 | next if !($l[1]) || ($used =~ /$l[1]/) || ($cnt > 100) ; |
46 | $cnt ++ ; |
50 | $cnt ++ ; |
47 | $used .= " " . $l[1] ; |
51 | $used .= " " . $l[1] ; |
48 | $text .= |
52 | $text .= |
Line 50... | Line 54... | ||
50 | <title>$l[1]</title> |
54 | <title>$l[1]</title> |
51 | <link>$wims_ref/wims.cgi?module=$ta[0]</link> |
55 | <link>$wims_ref/wims.cgi?module=$ta[0]</link> |
52 | <guid isPermaLink=\"true\">$wims_ref/wims.cgi?module=$ta[0]</guid> |
56 | <guid isPermaLink=\"true\">$wims_ref/wims.cgi?module=$ta[0]</guid> |
53 | <description>$ta[0] version $ta[1]</description> |
57 | <description>$ta[0] version $ta[1]</description> |
54 | <pubDate>$date</pubDate> |
58 | <pubDate>$date</pubDate> |
55 | </item>\n" |
59 | </item>\n" ; |
56 | } |
60 | } |
- | 61 | ||
57 | out("$out$modif.xml" , $head . $text . $tail) ; |
62 | out("$out$modif.xml" , $head . $text . $tail) ; |
58 | 63 | ||
59 | sub convdate { my ($d)= @_ ; |
64 | sub convdate { my ($d)= @_ ; |
60 | $d =~ s/(\d{4,4})(\d{2,2})(\d{2,2})/$1-$2-$3 03:00:00/ ; |
65 | $d =~ s/(\d{4,4})(\d{2,2})(\d{2,2})/$1-$2-$3 03:00:00/ ; |
61 | time2str(str2time($d)); |
66 | time2str(str2time($d)); |