svnno****@sourc*****
svnno****@sourc*****
2008年 5月 16日 (金) 17:01:23 JST
Revision: 655 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=655 Author: tach Date: 2008-05-16 17:01:23 +0900 (Fri, 16 May 2008) Log Message: ----------- Add feature to write static html file for mobile mode Modified Paths: -------------- slashjp/branches/2.5.0.192/debian/changelog slashjp/branches/2.5.0.192/sql/mysql/defaults.sql slashjp/branches/2.5.0.192/themes/slashcode/tasks/freshenup.pl -------------- next part -------------- Modified: slashjp/branches/2.5.0.192/debian/changelog =================================================================== --- slashjp/branches/2.5.0.192/debian/changelog 2008-05-16 07:54:45 UTC (rev 654) +++ slashjp/branches/2.5.0.192/debian/changelog 2008-05-16 08:01:23 UTC (rev 655) @@ -15,8 +15,9 @@ /usr/lib/perl5/Slash/DB/MySQL.pm line 10184 * Enable to specify encoding for prog2file - use 'encoding' to option + * Add feature to write static html file for mobile mode - -- Taku YASUI <tach****@osdn*****> Fri, 16 May 2008 07:23:02 +0000 + -- Taku YASUI <tach****@osdn*****> Fri, 16 May 2008 08:00:52 +0000 slash (2.5.0.192-12) unstable; urgency=low Modified: slashjp/branches/2.5.0.192/sql/mysql/defaults.sql =================================================================== --- slashjp/branches/2.5.0.192/sql/mysql/defaults.sql 2008-05-16 07:54:45 UTC (rev 654) +++ slashjp/branches/2.5.0.192/sql/mysql/defaults.sql 2008-05-16 08:01:23 UTC (rev 655) @@ -1145,6 +1145,8 @@ INSERT IGNORE INTO vars (name, value, description) VALUES ('topiclist_dont_show_nexuses','1','Do not show nexus topics on topic list'); INSERT IGNORE INTO vars (name, value, description) VALUES ('mobile_enabled','0','Use mobile mode (1: enable, 0: disable)'); INSERT IGNORE INTO vars (name, value, description) VALUES ('mobile_useragent_regex','','User-Agent regex to force mobile mode'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('mobile_encoding','Shift_JIS','Content encoding for mobile webpages (static html files)'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('mobile_staticdir','','Path for mobile static html files (disabled if empty)'); UPDATE vars SET value='text/html; charset=UTF-8' WHERE name='content_type_webpage'; UPDATE vars SET value='0' WHERE name='draconian_charset'; UPDATE vars SET value='UTF-8' WHERE name='rdfencoding'; Modified: slashjp/branches/2.5.0.192/themes/slashcode/tasks/freshenup.pl =================================================================== --- slashjp/branches/2.5.0.192/themes/slashcode/tasks/freshenup.pl 2008-05-16 07:54:45 UTC (rev 654) +++ slashjp/branches/2.5.0.192/themes/slashcode/tasks/freshenup.pl 2008-05-16 08:01:23 UTC (rev 655) @@ -321,6 +321,34 @@ } } + # mobile mode + if ($constants->{mobile_enabled} && $constants->{mobile_staticdir}) { + my $filename_m = "$constants->{mobile_staticdir}/$sid.html"; + my $args_m = "$vu ssi=yes m=1 sid='$sid'$cchp_param"; + my ($success_m, $stderr_text_m) = prog2file( + "$basedir/article.pl", + $filename_m, + { + args => $args_m, + verbosity => verbosity(), + handle_err => 1, + encoding => $constants->{mobile_encoding}, + } + ); + if (!$success_m) { + $logmsg .= " success='$success_m'"; + $do_log ||= (verbosity() >= 1); + } + if ($stderr_text_m) { + $stderr_text_m =~ s/\s+/ /g; + $logmsg .= " stderr: '$stderr_text_m'"; + if ($stderr_text_m =~ /\b(ID \d+, \w+;\w+;\w+) :/) { + # template error, skip + slashdErrnote("template error updating $sid: $stderr_text_m"); + } + } + } + # Now we extract what we need from the file we created my($cc, $hp) = _read_and_unlink_cchp_file($cchp_file, $cchp_param); if (defined($cc)) { @@ -428,6 +456,22 @@ handle_err => 0 }); + # mobile mode + if ($constants->{mobile_enabled} && $constants->{mobile_staticdir}) { + my $filename_m = "$constants->{mobile_staticdir}/$base.html"; + my $args_m = "$vu ssi=yes m=1"; + prog2file( + "$basedir/$gSkin->{index_handler}", + $filename_m, + { + args => "$args_m section='$gSkin->{name}'$extra_args", + verbosity => verbosity(), + handle_err => 0, + encoding => $constants->{mobile_encoding}, + } + ); + } + if ($constants->{plugin}{FireHose}) { gen_firehose_static($virtual_user, "index_firehose.shtml", $gSkin->{name}, "", { skipmenu => 1, skippop => 1, fhfilter => "story", duration => "7", mode => 'fulltitle', mixedmode => '1', setfield => '1', color => "black", index => "1", nocolors => 1 }); if ($base ne "firehose") { @@ -467,6 +511,23 @@ verbosity => verbosity(), handle_err => 0 }); + + # mobile mode + if ($constants->{mobile_enabled} && $constants->{mobile_staticdir}) { + my $filename_m = "$constants->{mobile_staticdir}/$skinname.html"; + my $args_m = "$vu ssi=yes m=1"; + prog2file( + "$basedir/$gSkin->{index_handler}", + $filename_m, + { + args => "$args_m section='$skin->{name}'$extra_args", + verbosity => verbosity(), + handle_err => 0, + encoding => $constants->{mobile_encoding}, + } + ); + } + if ($constants->{plugin}{FireHose}) { gen_firehose_static($virtual_user, "index_firehose.shtml", $skin->{name}, $skinname, { skipmenu => 1, skippop => 1, fhfilter => "'story $skin->{name}'", duration => "7", mode => 'fulltitle', mixedmode => '1', setfield => '1', color => "black", index => "1", nocolors => "1" }); if ($base ne "firehose") {