Rev 11931 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11931 | Rev 12452 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | 11 | ||
12 | my %GMT_ZONE = (GMT => 1, UTC => 1, UT => 1, Z => 1); |
12 | my %GMT_ZONE = (GMT => 1, UTC => 1, UT => 1, Z => 1); |
13 | 13 | ||
14 | 14 | ||
15 | my $wims_ref='http://127.0.0.1/wims'; |
15 | my $wims_ref='http://127.0.0.1/wims'; |
16 | my $file='' ; |
16 | my $file='' ; |
17 | my ($out, $modif, $text); |
17 | my ($out, $modif, $text); |
18 | 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'}) ; |
19 | 19 | ||
20 | while ($_ = shift (@ARGV)) |
20 | while ($_ = shift (@ARGV)) |
21 | { |
21 | { |
22 | last if (!/^--/); |
22 | last if (!/^--/); |
23 | if (/^--wims=(.*)$/) { $wims_ref = $1; } |
23 | if (/^--wims=(.*)$/) { $wims_ref = $1; } |
24 | elsif (/^--file=(.*)$/) { $file = $1 ; } |
24 | elsif (/^--file=(.*)$/) { $file = $1 ; } |
25 | elsif (/^--out=(.*)$/) { $out = $1 . "/" ; } |
25 | elsif (/^--out=(.*)$/) { $out = $1 . "/" ; } |
26 | elsif (/^--type=(.*)$/) { $modif = $1 ; } |
26 | elsif (/^--type=(.*)$/) { $modif = $1 ; } |
27 | } ; |
27 | } ; |
28 | $wims_ref =~ s,/wims.cgi,, ; |
28 | $wims_ref =~ s,/wims.cgi,, ; |
29 | my $head= "<\?xml version=\"1.0\" encoding=\"ISO-8859-1\"\?> |
29 | my $head= "<\?xml version=\"1.0\" encoding=\"ISO-8859-1\"\?> |
30 | <rss version=\"2.0\"> |
30 | <rss version=\"2.0\"> |
31 | <channel> |
31 | <channel> |
32 | <title>WIMS</title> |
32 | <title>WIMS</title> |
33 | <link>$wims_ref</link> |
33 | <link>$wims_ref</link> |
34 | <description>NEWS</description> |
34 | <description>NEWS</description> |
35 | \n" |
35 | \n" |
36 | ; |
36 | ; |
37 | 37 | ||
38 | my $tail="</channel></rss>"; |
38 | my $tail="</channel></rss>"; |
39 | 39 | ||
40 | open(IN, "$file.$modif") or die $file ; |
40 | open(IN, "$file.$modif") or die $file ; |
41 | my @lignes = <IN>; |
41 | my @lignes = <IN>; |
42 | my ($cnt, $used)= (1,'') ; |
42 | my ($cnt, $used)= (1,'') ; |
43 | my @ta; |
43 | my @ta; |
44 | foreach( reverse( @lignes ) ) { |
44 | foreach( reverse( @lignes ) ) { |
45 | my @l=split(":", $_) ; |
45 | my @l=split(":", $_) ; |
46 | my $date= convdate($l[0]) ; |
46 | my $date= convdate($l[0]) ; |
47 | next if !($l[1]) ; |
47 | next if !($l[1]) ; |
48 | my @ta=split(" ", $l[1]) ; |
48 | my @ta=split(" ", $l[1]) ; |
49 | next if !($l[1]) || ($used =~ /$l[1]/) || ($cnt > 100) ; |
49 | next if !($l[1]) || ($used =~ /$l[1]/) || ($cnt > 100) ; |
50 | $cnt ++ ; |
50 | $cnt ++ ; |
51 | $used .= " " . $l[1] ; |
51 | $used .= " " . $l[1] ; |
52 | $text .= |
52 | $text .= |
53 | "<item> |
53 | "<item> |
54 | <title>$l[1]</title> |
54 | <title>$l[1]</title> |
55 | <link>$wims_ref/wims.cgi?module=$ta[0]</link> |
55 | <link>$wims_ref/wims.cgi?module=$ta[0]</link> |
56 | <guid isPermaLink=\"true\">$wims_ref/wims.cgi?module=$ta[0]</guid> |
56 | <guid isPermaLink=\"true\">$wims_ref/wims.cgi?module=$ta[0]</guid> |
Line 61... | Line 61... | ||
61 | 61 | ||
62 | out("$out$modif.xml" , $head . $text . $tail) ; |
62 | out("$out$modif.xml" , $head . $text . $tail) ; |
63 | 63 | ||
64 | sub convdate { my ($d)= @_ ; |
64 | sub convdate { my ($d)= @_ ; |
65 | $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/ ; |
66 | time2str(str2time($d)); |
66 | time2str(str2time($d)); |
67 | } |
67 | } |
68 | 68 | ||
69 | sub out { my ($bloc, $text) = @_ ; |
69 | sub out { my ($bloc, $text) = @_ ; |
70 | open (OUT, ">$bloc") || die $bloc ; |
70 | open (OUT, ">$bloc") || die $bloc ; |
71 | print OUT $text ; close OUT ; |
71 | print OUT $text ; close OUT ; |
72 | } |
72 | } |
73 | 73 | ||
74 | 74 | ||
75 | ########################### from HTML::date.pm |
75 | ########################### from HTML::date.pm |
76 | sub time2str (;$) |
76 | sub time2str (;$) |