[Cpan-forum-commit] rev 57 - in trunk: lib/CPAN lib/CPAN/Forum t templates www

svn at pti.co.il svn at pti.co.il
Wed Feb 2 11:56:09 IST 2005


Author: gabor
Date: 2005-02-02 11:56:09 +0200 (Wed, 02 Feb 2005)
New Revision: 57

Modified:
   trunk/lib/CPAN/Forum.pm
   trunk/lib/CPAN/Forum/Markup.pm
   trunk/t/010-markup.t
   trunk/templates/editor.tmpl
   trunk/templates/footer.tmpl
   trunk/templates/head.tmpl
   trunk/templates/home.tmpl
   trunk/templates/listing.tmpl
   trunk/templates/message.tmpl
   trunk/templates/posts.tmpl
   trunk/www/style.css
Log:
lots of changes in the style sheet and the templates

Modified: trunk/lib/CPAN/Forum/Markup.pm
===================================================================
--- trunk/lib/CPAN/Forum/Markup.pm	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/lib/CPAN/Forum/Markup.pm	2005-02-02 09:56:09 UTC (rev 57)
@@ -21,12 +21,12 @@
 	close_b    : m{</b>}
 	open_i     : m{<i>}
 	close_i    : m{</i>}
-	text       : m{[\r\t\n -;=?-~]+}                {$item[1] }
+	text       : m{[\r\t\n -;=?-~]+}              {$item[1] }
 
 	marked_code: open_code code close_code        { join("", @item[1..$#item]) }
 	open_code  : m{<code>}                        { qq(<div class="code">) }
 	close_code : m{</code>}                       { qq(</div>) }
-	code       : m{[\r\t\n -~]+?(?=</code>)}        { CGI::escapeHTML($item[1]) }
+	code       : m{[\r\t\n -~]+?(?=</code>)}      { CGI::escapeHTML(CPAN::Forum::Markup::limit_rows($item[1])) }
 
 	eodata     : m{^\Z}
 	};
@@ -36,6 +36,20 @@
 	return $self;
 }
 
+# takes a string
+# makes sure every line is max N characters long
+sub limit_rows {
+	my ($text) = @_;
+	my $N = 70;
+	
+	my @text = split /\n/, $text;
+	my @new;
+	foreach my $row (@text) {
+		push @new, $row;
+	}
+	return join "\n", @new;
+}
+
 sub parser {
 	my ($self) = @_;
 	return Parse::RecDescent->new($self->{grammar});

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/lib/CPAN/Forum.pm	2005-02-02 09:56:09 UTC (rev 57)
@@ -471,7 +471,55 @@
 etc. path. (or use relative URLs).
 
 
+=head2 TEMPLATES
 
+
+root templates:
+
+about.tmpl
+change_password.tmpl
+faq.tmpl
+groups.tmpl
+help.tmpl
+home.tmpl
+internal_error.tmpl
+login.tmpl
+module_search_form.tmpl
+module_select_form.tmpl
+mypan.tmpl
+notes.tmpl
+posts.tmpl
+pwreminder.tmpl
+search.tmpl
+users.tmpl
+register.tmpl
+threads.tmpl
+
+
+every root template should INCLUDE      -> head.tmpl navigation.tmpl footer.tmpl
+
+groups.tmpl            -> links.tmpl listing.tmpl     (list of messages within one group)
+home.tmpl              -> listing.tmpl                (list of messages in all the site)
+posts.tmpl             -> links.tmpl message.tmpl message.tmpl editor.tmpl  
+                                                      (single message 
+													  with or without the editor
+													  with or without a preview pane)
+search.tmpl            -> listing.tmpl                (list of messages resulted from search)
+threads.tmpl           -> links.tmpl
+users.tmpl             -> listing.tmpl                (list of messages of one user)
+
+
+Non root templates:
+links.tmpl      - a bunch of links to search.cpan.org and similar places (specific to one distro)
+listing.tmpl    - can show the titles of many messages 
+message.tmpl    - can show one message (or a preview message)
+naviagtion.tmpl -
+head.tmpl       -
+footer.tmpl     -
+
+Use this for mapping:
+grep INCLUDE *| grep -v navigation.tmpl | grep -v footer.tmpl | grep -v head.tmpl
+
 =head1 METHODS
 
 =head2 cgiapp_init
@@ -1671,7 +1719,6 @@
 }
 
 
-# partially written code to select a module name
 sub module_search {
 	my ($self) = @_;
 

Modified: trunk/t/010-markup.t
===================================================================
--- trunk/t/010-markup.t	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/t/010-markup.t	2005-02-02 09:56:09 UTC (rev 57)
@@ -5,9 +5,19 @@
 use Test::More "no_plan";
 use Test::Exception;
 
+
+
 use lib "blib/lib";
 use CPAN::Forum::Markup;
 
+my $long = "123456789 " x 10;
+my $long_new = "123456789 " x 6 . "\n" . "123456789 " x 4;
+my $long2 = "123456789 " x 10 . "abcde " x 20;
+my $long2_new = "123456789 " x 6 . "\n" . "123456789 " x 4 . "\n" . "abcde " x 13 . "\n" . "abcde " x 7;
+is(CPAN::Forum::Markup::limit_rows("some text"), "some text");
+is(CPAN::Forum::Markup::limit_rows($long), $long);
+is(CPAN::Forum::Markup::limit_rows($long2), $long2);
+
 my $markup = CPAN::Forum::Markup->new();
 
 my %cases = (
@@ -70,13 +80,12 @@
 	#throws_ok {f($c)} $fails{$c}, "OK";
 }
 
-
 my $data = join "", <DATA>;
 foreach my $code (split /CODE/, $data) {
 	#print STDERR $code;
 	my $out = $markup->posting_process($code);
 	ok(defined($out), "BIG CODE");
-	ok(length($out) > length ($code));
+	ok(length($out) > length ($code)) or print STDERR $out;
 }
 
 

Modified: trunk/templates/editor.tmpl
===================================================================
--- trunk/templates/editor.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/editor.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -29,7 +29,7 @@
 </p>
 </form>
 
-<div id="posting_rules">Posting Rules:</div>
+<div class="posting_rules">Posting Rules:</div>
 <ul class="postrules">
 	<li> Currently no HTML markup is allowed at all. If you'd like to show &lt; 
 		you'll have to type &amp;lt;</li>

Modified: trunk/templates/footer.tmpl
===================================================================
--- trunk/templates/footer.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/footer.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -5,7 +5,6 @@
 	Comments, and other submissions on CPAN Forum are Copyright 2005, their respective owners.<br />
 	Site maintainer is not responsible for content.
 </div>
-</div>
 <p>
      <a href="http://validator.w3.org/check?uri=referer"><img
         src="http://www.w3.org/Icons/valid-xhtml10"

Modified: trunk/templates/head.tmpl
===================================================================
--- trunk/templates/head.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/head.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -10,7 +10,6 @@
 <p class="warning">Warning: this is a test site, the data here will be deleted.<br />
 For real use, please visit the <a href="http://www.cpanforum.com/">the production site</a>.</p>
 </TMPL_IF>
-<div id="container">
 	
 <p id="pageHeader">CPAN::Forum</p>
 

Modified: trunk/templates/home.tmpl
===================================================================
--- trunk/templates/home.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/home.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -3,8 +3,6 @@
 
 <TMPL_INCLUDE NAME="navigation.tmpl">
 
-<div id="posts">
 <TMPL_INCLUDE NAME="listing.tmpl">
-</div>
 
 <TMPL_INCLUDE NAME="footer.tmpl">

Modified: trunk/templates/listing.tmpl
===================================================================
--- trunk/templates/listing.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/listing.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -1,5 +1,5 @@
 <TMPL_IF messages>
-<table id="posts_table">
+<table class="posts">
 	<tr class="posts_head">
 		<th class="col1">Module</th>
 		<th class="col2">Title</th>

Modified: trunk/templates/message.tmpl
===================================================================
--- trunk/templates/message.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/message.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -1,23 +1,29 @@
-<!-- Post id <TMPL_VAR id><br> -->
-<TMPL_IF parentid>
-	In response to <a href="/posts/<TMPL_VAR parentid>"><TMPL_VAR parentid></a>
+<table class="message">
+<tr class="message_row_head"><td>
+   Posted on <span class="date"><TMPL_VAR date></span> 
+   by <span class="username"><a href="/users/<TMPL_VAR postername>"><TMPL_VAR postername></a></span>
+  <TMPL_IF parentid>
+	<span class="inresponse">in response to <a href="/posts/<TMPL_VAR parentid>"><TMPL_VAR parentid></a></div>
 	<TMPL_IF thread_id>
-	  (See the whole <a href="/threads/<TMPL_VAR thread_id>">thread of <TMPL_VAR thread_count></a>)
+	  <span class="seethread">(See the whole <a href="/threads/<TMPL_VAR thread_id>">thread of <TMPL_VAR thread_count></a>)</div>
 	</TMPL_IF>
-	<br>
-</TMPL_IF>
-
-Posted on <span class="date"><TMPL_VAR date></span> by <a href="/users/<TMPL_VAR postername>"><TMPL_VAR postername></a> 
-
-<div class="subject"><TMPL_VAR subject></div>
-
-<TMPL_VAR text>
-
+  </TMPL_IF>
+</td></tr>
+<tr class="message_row_subject"><td><TMPL_VAR subject></span></td></tr>
+<tr class="message_row_text"><td>
+    <TMPL_VAR text>
+</td></tr>
+<tr class="message_row_foot"><td>
 <TMPL_IF responses>
 	Direct Responses:
 	<TMPL_LOOP responses>
 	 <a href="/posts/<TMPL_VAR id>"><TMPL_VAR id></a> | 
 	</TMPL_LOOP>
 </TMPL_IF>
+   <TMPL_UNLESS editor>
+    <a href="/response_form/<TMPL_VAR id>">Write a response</a>
+   </TMPL_UNLESS>
+</td></tr>
+</table>
 
 

Modified: trunk/templates/posts.tmpl
===================================================================
--- trunk/templates/posts.tmpl	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/templates/posts.tmpl	2005-02-02 09:56:09 UTC (rev 57)
@@ -28,8 +28,6 @@
 
 <TMPL_IF editor>
 	<TMPL_INCLUDE NAME="editor.tmpl">
-<TMPL_ELSE>
-	<a href="/response_form/<TMPL_VAR id>">Write a response</a>.
 </TMPL_IF>
 
 <TMPL_INCLUDE NAME="footer.tmpl">

Modified: trunk/www/style.css
===================================================================
--- trunk/www/style.css	2005-02-01 23:13:20 UTC (rev 56)
+++ trunk/www/style.css	2005-02-02 09:56:09 UTC (rev 57)
@@ -1,17 +1,15 @@
-body { 
-	background: #dddddd; 
+BODY { 
+	background: #eeeeee; 
+	font-family: Arial;
 }
 
-#container { 
-	background: #dddddd;
-}
 .warning {
 	color: red;
 	font-size: 20pt;
 }
 
 #pageHeader { 
-	background: #eeeeee; 
+	background: #dddddd; 
 	margin-top: 10px; 
 	margin-left: 25px; 
 	margin-bottom: 0px; 
@@ -24,13 +22,13 @@
 }
 
 #pageTitle { 
-	margin-top: 0px; 
 	background: white; 
+	margin-top: 0px; 
+	margin-bottom: 20px;
 	height: 18px; 
 	padding: 0px 0px 0px 20px; 
 	font-size: 12pt;
 	color: #333333;
-	margin-bottom: 20px;
 	border: solid thin;
 	border-color: #333333;
 }
@@ -40,53 +38,68 @@
 	margin-bottom: 20px; 
 	font-size: 10pt;
 	text-align: center; 
-	padding-bottom:1em;
-	width: 780px;
+	padding-bottom:1px;
+/*	width: 780px;*/
 }
 
-a       {
-	color: #003399;
+.message {
+	color: #000000;
 }
+TABLE.message {
+	border-width: 3;
+	border-style: groove;
+	border-collapse: no;
+	table-layout: fixed;
+	align: 
+	width: 90%;
+}
+.message_row_head {
+	background: white;
+	font-size: 10pt;
+}
+.message_row_subject {
+	background: white;
+/*	background: red;*/
+}
 
-a:visited {
-	color: #663399;
+.message_row_text {
+	background: white;
+/*	background: yellow;*/
 }
+.message_row_foot {
+	background: white;
+	font-size: 10pt;
+}
 
-#posts { 
-	margin-left: 20px;
+
+A       {
+	color: #003399;
 }
 
-#posts h3 {
-	color: #1E90FF;
+A:visited {
+	color: #663399;
 }
 
-#posts_table { 
-	margin: 10px 0px 10px 0px;
+TABLE.posts { 
+	margin: 5px 0px 5px 0px;
 	border: solid thin;
 	border-color: #333333;
 }
 
 .posts_head {
-	color: inherit;
 	background-color: #E8EBEF;
 	border: #B1BDC9 solid thin;
 }
 
-table {
-	border-collapse: collapse;
-	border-spacing: 0;
-	border-width: 0;
-	color: inherit;
-}
-
 .odd {
-	/*background: #20B2AA;*/
-	background: #AAAAAA;
-	color: inherit; 
+	background: #bbbbbb;
 }
+.even {
+	background: #aaaaaa;
+}
 
 .odd TD, .even TD {
-	padding: 0ex 0ex 0ex 1ex;
+	padding: 0ex 0ex 0ex 1px;
 	vertical-align: baseline;
 }
 
@@ -98,13 +111,17 @@
 }
 
 .threads_even TD {
-/*	background: #dddddd;*/
 	border-style: solid;
 	border-width: 2px;
 	border-color: yellow;
 }
 
+TD {
+	margin:  0;
+	padding: 0;
+}
 
+
 .col1 {
 	width: 25%;
 }
@@ -129,12 +146,12 @@
 	padding: 0.2ex 0.4ex;
 }
 
-.faq dt {
+.faq DT {
 	font-size: 1.2em;
 	font-weight: bold;
 }
 
-.faq dd {
+.faq DD {
 	margin-bottom: 10px;
 }
 
@@ -155,30 +172,25 @@
 }
 
 
-#posting_rules {
+.posting_rules {
 	margin-top: 10px;
 }
 
-/*
-does not work ?
-.threads TABLE {
-}
-*/
 
-
 IMG { 
 	border: 0; 
 }
+
 FORM { 
 	margin: 0; 
 }
 
-input {
+INPUT {
 	margin: 2px; 
 }
 
 .title {
-	font-size: 18pt;
+	font-size: 16pt;
 	font-weight: bold;
 }
 
@@ -199,17 +211,18 @@
 
 }
 
-.subject {
-	font-weight: bold;
-}
 
 .text {
 	background: #eeeeee;
-	white-space: pre;
+/*	white-space: pre;*/
+	table-width: 80%;
 }
 .code {
 	background: #dddddd;
 	white-space: pre;
+	width: 100px;
+/* for now I remove this, later we can implement some virtual line break as in the Monks */
+  
 }
 
 
@@ -228,31 +241,4 @@
 	width: 70%;
 }
 
-/* ?? */
-.menubar {
-	background: #006699;
-	margin: 1ex 0;
-	padding: 1px;
-} 
 
-.menubar A {
-	padding: 0.8ex;
-	font: bold 10pt Arial,Helvetica,sans-serif;
-}
-
-.menubar A:link, .menubar A:visited {
-	color: white;
-	text-decoration: none;
-}
-
-.menubar A:hover {
-	color: #ff6600;
-	text-decoration: underline;
-}
-
-TD {
-	margin:  0;
-	padding: 0;
-}
-
-



More information about the Cpan-forum-commit mailing list