fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-09-20 09:42 am

[dw-free] Cumulative layout credits

[commit: http://hg.dwscoalition.org/dw-free/rev/203a37ceb000]

http://bugs.dwscoalition.org/show_bug.cgi?id=1845

Credit both the theme and layout author in the layout module. Core code and
put into Bases.

Patch by [personal profile] ninetydegrees.

Files modified:
  • bin/upgrading/s2layers/bases/themes.s2
  • bin/upgrading/s2layers/core2.s2
--------------------------------------------------------------------------------
diff -r 15902e394b79 -r 203a37ceb000 bin/upgrading/s2layers/bases/themes.s2
--- a/bin/upgrading/s2layers/bases/themes.s2	Mon Sep 20 16:56:37 2010 +0800
+++ b/bin/upgrading/s2layers/bases/themes.s2	Mon Sep 20 17:42:25 2010 +0800
@@ -80,7 +80,7 @@ layerinfo redist_uniq = "bases/comfort";
 layerinfo redist_uniq = "bases/comfort";
 layerinfo author_name = "timeasmymeasure";
 
-set layout_authors = [ { "name" => "timeasmymeasure", "type" => "user" } ];
+set theme_authors = [ { "name" => "timeasmymeasure", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -134,7 +134,7 @@ layerinfo redist_uniq = "bases/lightonda
 layerinfo redist_uniq = "bases/lightondark";
 layerinfo author_name = "cesy";
 
-set layout_authors = [ { "name" => "cesy", "type" => "user" } ];
+set theme_authors = [ { "name" => "cesy", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -197,7 +197,7 @@ layerinfo redist_uniq = "bases/nnwm2009"
 layerinfo redist_uniq = "bases/nnwm2009";
 layerinfo author_name = "zvi";
 
-set layout_authors = [ { "name" => "zvi", "type" => "user" } ];
+set theme_authors = [ { "name" => "zvi", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -294,7 +294,7 @@ layerinfo redist_uniq = "bases/strawberr
 layerinfo redist_uniq = "bases/strawberrysundae";
 layerinfo author_name = "sky";
 
-set layout_authors = [ { "user" => "sky", "type" => "user" } ];
+set theme_authors = [ { "name" => "sky", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -353,7 +353,7 @@ layerinfo redist_uniq = "bases/summerhol
 layerinfo redist_uniq = "bases/summerholiday";
 layerinfo author_name = "rb";
 
-set layout_authors = [ { "name" => "rb", "type" => "user" } ];
+set theme_authors = [ { "name" => "rb", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -406,7 +406,7 @@ layerinfo redist_uniq = "bases/sunandsan
 layerinfo redist_uniq = "bases/sunandsand";
 layerinfo author_name = "twtd";
 
-set layout_authors = [ { "name" => "twtd", "type" => "user" } ];
+set theme_authors = [ { "name" => "twtd", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
@@ -518,7 +518,7 @@ layerinfo redist_uniq = "bases/velvetste
 layerinfo redist_uniq = "bases/velvetsteel";
 layerinfo author_name = "timeasmymeasure";
 
-set layout_authors = [ { "name" => "timeasmymeasure", "type" => "user" } ];
+set theme_authors = [ { "name" => "timeasmymeasure", "type" => "user" } ];
 
 ##===============================
 ## Page Colors
diff -r 15902e394b79 -r 203a37ceb000 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Mon Sep 20 16:56:37 2010 +0800
+++ b/bin/upgrading/s2layers/core2.s2	Mon Sep 20 17:42:25 2010 +0800
@@ -1512,9 +1512,11 @@ set module_credit_section = "one";
 set module_credit_section = "one";
 
 property string{}[] layout_authors { noui = 1;  des = "The layout author (or authors). Accepts 'name', 'url', 'type'"; }
+property string{}[] theme_authors { noui = 1;  des = "The theme author (or authors). Accepts 'name', 'url', 'type'"; }
 property string{}[] layout_resources { noui = 1; des = "Resources used in the layout. Accepts 'name', 'url'"; }
 
 set layout_authors = [];
+set theme_authors = [];
 set layout_resources = [];
 
 property string[] module_search_group {
@@ -2435,7 +2437,13 @@ property string text_generated_on {
 
 property string text_powered_by { noui = 1; des = "Text to describe what site hosts the journal"; }
 
-property string text_layout_authors { noui = 1; des = "Text label for the layout author"; }
+property string text_layout_authors { noui = 1; des = "Text label for the style author"; }
+property string text_base_layout_authors {
+    noui = 1;
+    des = "Text label for the base style author";
+    note = "Used when style and theme have different authors";
+}
+property string text_theme_authors { noui = 1; des = "Text label for the theme author"; }
 property string text_layout_resources { noui = 1; des = "Text label for the layout resources"; }
 
 property string text_posting_in {
@@ -2470,7 +2478,9 @@ set text_view_month = "View Subjects";
 set text_view_month = "View Subjects";
 set text_generated_on = "Page generated";
 set text_powered_by = "Powered by";
-set text_layout_authors = "Layout:";
+set text_layout_authors = "Style:";
+set text_base_layout_authors = "Base style:";
+set text_theme_authors = "Theme:";
 set text_layout_resources = "Resources:";
 set text_posting_in = " posting in ";
 set text_nosubject = "(no subject)";
@@ -4001,10 +4011,13 @@ function print_module_links() {
 }
 function print_module_credit() {
     var string ret = "";
-    var int authors_size = size $*layout_authors;
-    if ( $authors_size > 0 ) {
+    var int layout_authors_size = size $*layout_authors;
+    var int theme_authors_size = size $*theme_authors;
+    var string text_style_authors = ($theme_authors_size > 0) ? $*text_base_layout_authors : $*text_layout_authors;
+
+    if ( $layout_authors_size > 0) {
         var int count = 0;
-        $ret = $ret  + "<dt>$*text_layout_authors</dt> ";
+        $ret = $ret  + "<dt>$text_style_authors</dt> ";
         foreach var string{} author ( $*layout_authors ) {
             var string item;
             if ( $author{"url"} != "" ) {
@@ -4021,7 +4034,31 @@ function print_module_credit() {
 
             $ret = $ret + "<dd>$item";
             $count++;
-            if ($count < $authors_size ) { $ret = $ret + ","; }
+            if ($count < $layout_authors_size ) { $ret = $ret + ","; }
+            $ret = $ret + "</dd>\n";
+        }
+    }
+
+    if ( $theme_authors_size > 0) {
+        var int count = 0;
+        $ret = $ret  + "<dt>$*text_theme_authors</dt> ";
+        foreach var string{} author ( $*theme_authors ) {
+            var string item;
+            if ( $author{"url"} != "" ) {
+                $item = "<a href='" + $author{"url"} + "'>" + $author{"name"} + "</a>";
+            } elseif ( $author{"type"} == "user" ) {
+                var UserLite u = UserLite( $author{"name"} );
+                if ( defined $u ) {
+                    $item = $u->ljuser();
+                }
+            }
+            if ( $item == "" ) {
+                $item = $author{"name"};
+            }
+
+            $ret = $ret + "<dd>$item";
+            $count++;
+            if ($count < $theme_authors_size ) { $ret = $ret + ","; }
             $ret = $ret + "</dd>\n";
         }
     }
--------------------------------------------------------------------------------