[Slashdotjp-dev 1547] [1078] Add HTML "<meta name=description>" into pollBooth.pl

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 3月 17日 (火) 17:18:18 JST


Revision: 1078
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1078
Author:   tach
Date:     2009-03-17 17:18:18 +0900 (Tue, 17 Mar 2009)

Log Message:
-----------
Add HTML "<meta name=description>" into pollBooth.pl
 - add first 250 chars of question and answers on indevidual page
 - add first 250 chars of questions on index page

Modified Paths:
--------------
    slashjp/trunk/debian/changelog
    slashjp/trunk/plugins/PollBooth/pollBooth.pl


-------------- next part --------------
Modified: slashjp/trunk/debian/changelog
===================================================================
--- slashjp/trunk/debian/changelog	2009-03-17 07:45:01 UTC (rev 1077)
+++ slashjp/trunk/debian/changelog	2009-03-17 08:18:18 UTC (rev 1078)
@@ -5,9 +5,12 @@
     - index.pl: add data "meta_desc" and title of first 5 articles
     - journal.pl: add first 250 chars of article on article page
     - journal.pl: add first 250 chars of article titles on index page
+    - pollBooth.pl: add first 250 chars of question and answers on indevidual
+      page
+    - pollBooth.pl: add first 250 chars of questions on index page
   * Redirect Antenna URL on IndexHandler
 
- -- Taku YASUI <tach****@osdn*****>  Tue, 17 Mar 2009 07:44:20 +0000
+ -- Taku YASUI <tach****@osdn*****>  Tue, 17 Mar 2009 08:15:45 +0000
 
 slash (2.5.0.233-7) unstable; urgency=low
 

Modified: slashjp/trunk/plugins/PollBooth/pollBooth.pl
===================================================================
--- slashjp/trunk/plugins/PollBooth/pollBooth.pl	2009-03-17 07:45:01 UTC (rev 1077)
+++ slashjp/trunk/plugins/PollBooth/pollBooth.pl	2009-03-17 08:18:18 UTC (rev 1078)
@@ -59,14 +59,28 @@
 	}
 
 	# create title
+	my $polldb = getObject('Slash::PollBooth', { db_type => 'reader' });
 	my $title = getData('title');
+	my $meta_desc = '';
 	if ($form->{qid}) {
-		my $polldb = getObject('Slash::PollBooth', { db_type => 'reader' });
-		$title .= ': ' . $polldb->getPollQuestion($form->{qid})->{question};
+		my $pollq = $polldb->getPollQuestion($form->{qid});
+		$title .= ': ' . $pollq->{question};
+		$meta_desc = $pollq->{question} . " ";
+		my $pollans = $polldb->getPollAnswers($form->{qid}, [ 'answer' ]);
+		foreach my $a (@$pollans) {
+			$meta_desc .= $a->[0] . "\x{3002}" if ($a->[0]);
+		}
+	} else {
+		my $questions = $polldb->getPollQuestionList(10);
+		$meta_desc = '';
+		foreach my $q (@$questions) {
+			$meta_desc .= $q->[1] . " " if ($q->[1]);
+		}
 	}
+	$meta_desc = shorten(strip_nohtml($meta_desc), 250);
 	$title .= " - $constants->{sitename}";
 
-	header($title, $form->{section}, { tab_selected => 'poll'}) or return;
+	header($title, $form->{section}, { tab_selected => 'poll', meta_desc => $meta_desc }) or return;
 
 	$ops{$op}->($form, $slashdb, $constants);
 



Slashdotjp-dev メーリングリストの案内
Back to archive index