[Cpan-forum-commit] rev 355 - in trunk: . lib/CPAN lib/CPAN/Forum/RM templates templates/popup www

svn at pti.co.il svn at pti.co.il
Fri Oct 26 13:46:03 EEST 2007


Author: gabor
Date: 2007-10-26 13:46:03 +0300 (Fri, 26 Oct 2007)
New Revision: 355

Added:
   trunk/templates/popup/
   trunk/templates/popup/head.tmpl
   trunk/templates/popup/modules_with_tags.tmpl
Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
   trunk/lib/CPAN/Forum/RM/Tags.pm
   trunk/www/display_tags.js
   trunk/www/style.css
Log:
create new template to be used for popup windows



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4576
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4577
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum/RM/Tags.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Tags.pm	2007-10-26 10:45:40 UTC (rev 354)
+++ trunk/lib/CPAN/Forum/RM/Tags.pm	2007-10-26 10:46:03 UTC (rev 355)
@@ -16,6 +16,8 @@
     $self->log->debug("tags path='$path' value='$value'");
     if ($path eq 'name' and $value) {
         return $self->_list_modules_with_tag($value);
+    } elsif ($path eq 'name_popup') {
+        return $self->_list_modules_with_tag($value, 'popup/');
     } elsif ($path eq 'user' and $value) {
         my $tags = CPAN::Forum::DB::Tags->get_tags_of_user($value); # SQL
         return $self->_list_tags($tags, {user_name => $value});
@@ -49,9 +51,10 @@
 }
 
 sub _list_modules_with_tag {
-    my ($self, $value) = @_;
+    my ($self, $value, $type) = @_;
+    $type ||= '';
 
-    my $t = $self->load_tmpl("modules_with_tags.tmpl",
+    my $t = $self->load_tmpl("${type}modules_with_tags.tmpl",
         loop_context_vars => 1,
         global_vars => 1,
     );
@@ -59,7 +62,6 @@
     $t->param(tag => $value);
     $t->param(modules => $modules);
     return $t->output; 
-    
 }
 
 1;

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2007-10-26 10:45:40 UTC (rev 354)
+++ trunk/lib/CPAN/Forum.pm	2007-10-26 10:46:03 UTC (rev 355)
@@ -1626,15 +1626,14 @@
 
 
     my $tags = '';
-print STDERR "here '$path'\n";
     if ($path eq "list_tags") {
         my $gr = CPAN::Forum::DB::Groups->info_by(name => $value); # SQL
         if ($gr) {
             my $gid = $gr->{id};
             my $modules = CPAN::Forum::DB::Tags->get_tags_of_module($gid); # SQL
-            use Data::Dumper;
-            print STDERR Dumper $modules;
-            $tags = join ",", map {"$_->{name},$_->{cnt}"} @$modules;
+            #use Data::Dumper;
+            #print STDERR Dumper $modules;
+            $tags = join ",", map {"$_->{name}:$_->{cnt}"} @$modules;
         }
     }
 

Added: trunk/templates/popup/head.tmpl
===================================================================
--- trunk/templates/popup/head.tmpl	                        (rev 0)
+++ trunk/templates/popup/head.tmpl	2007-10-26 10:46:03 UTC (rev 355)
@@ -0,0 +1,7 @@
+<TMPL_IF loggedin>You are logged in to CPAN::Forum as <TMPL_VAR username></TMPL_IF>
+<TMPL_IF admin></TMPL_IF>
+<TMPL_IF test_site_warning>
+<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 live site</a>.</p>
+</TMPL_IF>
+

Added: trunk/templates/popup/modules_with_tags.tmpl
===================================================================
--- trunk/templates/popup/modules_with_tags.tmpl	                        (rev 0)
+++ trunk/templates/popup/modules_with_tags.tmpl	2007-10-26 10:46:03 UTC (rev 355)
@@ -0,0 +1,5 @@
+<TMPL_INCLUDE NAME="popup/head.tmpl">
+<p>Modules with tag <b><TMPL_VAR tag></b></p>
+<TMPL_LOOP modules>
+<a href="/dist/<TMPL_VAR name>"><TMPL_VAR name></a> <TMPL_VAR cnt><br />
+</TMPL_LOOP>

Modified: trunk/www/display_tags.js
===================================================================
--- trunk/www/display_tags.js	2007-10-26 10:45:40 UTC (rev 354)
+++ trunk/www/display_tags.js	2007-10-26 10:46:03 UTC (rev 355)
@@ -1,17 +1,12 @@
 var cpan_forum_url = "http://cgi.cpanforum.local/";
 
 function cpan_forum_list_tags() {
-    //alert("test");
-    //alert(action);
-    //var url = document.URL;
-    //var url = cpan_forum_url;//+ "rm=tags_of&amp;distro=" + distro;
-    //cpan_forum_ajaxFunction(url, function(response) {
-    // this is built by the application
-    //var response = "test,testing,web,app devx";
     var response = cpan_forum_tags;
     var tags = response.split(",");
+    for(var i=0; i<tags.length; i++) {
+        tags[i] = tags[i].split(":")[0];
+    }
     // TODO return will not be simple array, it will be a hash with values such as the density of tags
-    //var tags = new Array({"one":1, "two":2, "apple":3, "x":3});
     //tags.sort();
     //alert(tags.join());
     //var tags = new Array("xtest", "testing", "web", "app dev");
@@ -37,7 +32,7 @@
 }
 
 function cpan_forum_popup_tag(tag) {
-    var w = window.open(cpan_forum_url, 'cpan_forum_list_distros', "width=600,height=300");
+    var w = window.open(cpan_forum_url + '/tags/name_popup/' + tag, 'cpan_forum_list_distros', "width=600,height=300");
     //w.document.write("Tag: '" + tag + "'<br/>");
     //var distros = cpan_forum_get_distros_by_tag(tag);
     //for(var i=0; i<distros.length; i++) {

Modified: trunk/www/style.css
===================================================================
--- trunk/www/style.css	2007-10-26 10:45:40 UTC (rev 354)
+++ trunk/www/style.css	2007-10-26 10:46:03 UTC (rev 355)
@@ -47,11 +47,11 @@
 	color: #000000;
 }
 TABLE.message {
-	border-width: 3;
+	border-width: 3px;
 	border-style: groove;
-	border-collapse: no;
+	/*border-collapse: no; */
 	table-layout: fixed;
-	align: 
+	/*align: */
 	width: 90%;
 }
 .message_row_head {
@@ -235,7 +235,7 @@
 .text {
 	background: #eeeeee;
 /*	white-space: pre;*/
-	table-width: 80%;
+	/*table-width: 80%;*/
 }
 .code {
 	background: #dddddd;



More information about the Cpan-forum-commit mailing list