[dw-free] S2 needs a layout credit module
[commit: http://hg.dwscoalition.org/dw-free/rev/677e7e2729fd]
http://bugs.dwscoalition.org/show_bug.cgi?id=1412
Add layout credit module for crediting layout authors.
Patch by
afuna.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1412
Add layout credit module for crediting layout authors.
Patch by
Files modified:
- bin/upgrading/s2layers/core2.s2
- bin/upgrading/s2layers/core2base/layout.s2
- bin/upgrading/s2layers/drifting/layout.s2
- bin/upgrading/s2layers/negatives/layout.s2
- cgi-bin/LJ/S2Theme/negatives.pm
--------------------------------------------------------------------------------
diff -r 0c901a3e684a -r 677e7e2729fd bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2 Sat Aug 08 18:04:44 2009 +0000
+++ b/bin/upgrading/s2layers/core2.s2 Sat Aug 08 18:19:56 2009 +0000
@@ -1405,6 +1405,26 @@ set module_customtext_show = false;
set module_customtext_show = false;
set module_customtext_order = 13;
set module_customtext_section = "one";
+
+property string[] module_credit_group {
+ des = "Layout Credit";
+ grouptype = "module";
+}
+set module_credit_group = ["module_credit_show", "module_credit_order", "module_credit_section"];
+property bool module_credit_show { grouped = 1; }
+property int module_credit_order { grouped = 1; }
+property string module_credit_section { grouped = 1; }
+
+set module_credit_show = true;
+set module_credit_order = 14;
+set module_credit_section = "one";
+
+property string{}[] layout_authors { noui = 1; des = "The layout 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 layout_resources = [];
+
##===============================
## Journal style - fonts
##===============================
@@ -1917,17 +1937,24 @@ property string text_module_customtext_c
property string text_module_customtext_url {
des = "URL for 'Custom text' header link";
- maxlenght = 100;
+ maxlength = 100;
size = 20;
example = "http://www.dreamwidth.org";
}
+property string text_module_credit {
+ des = "Text for the 'Layout Credit' module heading";
+ maxlength = 50;
+ size = 20;
+ example = "Layout Credit";
+}
set text_module_links = "Links";
set text_module_pagesummary = "Page Summary";
set text_module_syndicate = "Syndicate";
set text_module_tags = "Tags";
set text_module_popular_tags = "Most Popular Tags";
+set text_module_credit = "Layout Credit";
set text_module_customtext = "Custom text";
set text_module_customtext_content = "";
@@ -2100,6 +2127,9 @@ 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_resources { noui = 1; des = "Text label for the layout resources"; }
+
property string text_posting_in {
des = "Text when user is posting in a community";
example = "posting in ";
@@ -2118,6 +2148,8 @@ 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_resources = "Resources:";
set text_posting_in = " posting in ";
set text_nosubject = "(no subject)";
@@ -2392,9 +2424,8 @@ function modules_init()
if ( $*module_time_show ) { $*module_sections{$*module_time_section}[$*module_time_order]=["time"]; }
if ( $*module_poweredby_show ) { $*module_sections{$*module_poweredby_section}[$*module_poweredby_order]=["poweredby"]; }
if ( $*module_customtext_show ) { $*module_sections{$*module_customtext_section}[$*module_customtext_order]=["customtext"]; }
-
-
-
+ if ( $*module_credit_show ) { $*module_sections{$*module_credit_section }[$*module_credit_order]=["credit"]; }
+
#if ( $*module_%%mod%%_show ) { $*module_sections{$*module_%%mod%%_section }[$*module_%%mod%%_order]=["%%mod%%"]; }
}
@@ -3492,6 +3523,58 @@ function print_module_links() {
close_module();
}
}
+function print_module_credit() {
+ var string ret = "";
+ var int authors_size = size $*layout_authors;
+ if ( $authors_size > 0 ) {
+ var int count = 0;
+ $ret = $ret + "<dt>$*text_layout_authors</dt>";
+ foreach var string{} author ( $*layout_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 < $authors_size ) { $ret = $ret + ","; }
+ $ret = $ret + "</dd>\n";
+ }
+ }
+
+ var int resources_size = size $*layout_resources;
+ if ( $resources_size > 0 ) {
+ var int count = 0;
+ $ret = $ret + "<dt>$*text_layout_resources</dt>";
+ foreach var string{} resource ( $*layout_resources ) {
+ var string item;
+ if ( $resource{"url"} != "" ) {
+ $item = "<a href='" + $resource{"url"} + "'>" + $resource{"name"} + "</a>";
+ } else {
+ $item = $resource{"name"};
+ }
+
+ $ret = $ret + "<dd>$item";
+ $count++;
+ if ($count < $resources_size ) { $ret = $ret + ","; }
+ $ret = $ret + "</dd>\n";
+ }
+ }
+
+ if ( $ret != "" ) {
+ open_module("credit", $*text_module_credit, "");
+ print safe "<dl>$ret</dl>";
+ close_module();
+ }
+}
function handle_module_group_array(string[][] list) {
foreach var string[] item ($list) {
@@ -3530,6 +3613,9 @@ function handle_module_group_array(strin
}
elseif ($module == "links") {
print_module_links();
+ }
+ elseif ($module == "credit") {
+ print_module_credit();
}
}
}
diff -r 0c901a3e684a -r 677e7e2729fd bin/upgrading/s2layers/core2base/layout.s2
--- a/bin/upgrading/s2layers/core2base/layout.s2 Sat Aug 08 18:04:44 2009 +0000
+++ b/bin/upgrading/s2layers/core2base/layout.s2 Sat Aug 08 18:19:56 2009 +0000
@@ -158,6 +158,7 @@ propgroup modules {
property use module_syndicate_group;
property use module_time_group;
property use module_poweredby_group;
+ property use module_credit_group;
}
# explicitly define what sections the layout has available
@@ -599,7 +600,15 @@ ul.userlite-interaction-links li {
display: block;
padding: 2px;
}
-
+.module-credit dt, .module-credit dd {
+ display: inline;
+ margin: 0;
+ padding: 0;
+}
+.module-credit dt {
+ font-weight: bold;
+ margin-right: 0.5em;
+}
.module-syndicate .module-content {
text-align: center;
} --->
diff -r 0c901a3e684a -r 677e7e2729fd bin/upgrading/s2layers/drifting/layout.s2
--- a/bin/upgrading/s2layers/drifting/layout.s2 Sat Aug 08 18:04:44 2009 +0000
+++ b/bin/upgrading/s2layers/drifting/layout.s2 Sat Aug 08 18:19:56 2009 +0000
@@ -8,13 +8,16 @@ layerinfo "name" = "Drifting";
layerinfo "name" = "Drifting";
layerinfo "redist_uniq" = "drifting/layout";
layerinfo "author_name" = "Jennie Griner";
-layerinfo "autor_email" = "jennielynn1127@livejournal.com";
+layerinfo "author_email" = "jennielynn1127@livejournal.com";
layerinfo "des" = "Based on the Drifting v1.0 design at OSWD by Pat Heard";
layerinfo "lang" = "en";
################################################################################
# Properties
################################################################################
+
+set layout_authors = [ { "name" => "Jennie Griner"} ];
+set layout_resources = [ { "name" => "OSWD design", "url" => "http://www.oswd.org/design/information/id/1955" } ];
# COLOURS
################################################################################
@@ -179,6 +182,7 @@ propgroup modules
property use module_syndicate_group;
property use module_userprofile_group;
property use module_time_group;
+ property use module_credit_group;
}
set module_layout_sections = "none|(none)|one|Sidebar|two|Footer";
@@ -193,6 +197,7 @@ set module_syndicate_section = "none";
set module_syndicate_section = "none";
set module_userprofile_section = "none";
set module_time_section = "none";
+set module_credit_section = "one";
set module_calendar_order = 1;
set module_navlinks_order = 2;
@@ -520,6 +525,22 @@ function Page::print_default_stylesheet(
border-bottom: 1px solid $*color_module_border;
}
+ /* Credit
+ ***************************************************************************/
+ .module-credit dl {
+ padding: 0 0 0 20px;
+ font-size: 0.8em;
+ }
+ .module-credit dt, .module-credit dd {
+ display: inline;
+ margin: 0;
+ padding: 0;
+ }
+ .module-credit dt {
+ font-weight: bold;
+ margin-right: 0.5em;
+ }
+
/* Reply
***************************************************************************/
#reply h2 {
diff -r 0c901a3e684a -r 677e7e2729fd bin/upgrading/s2layers/negatives/layout.s2
--- a/bin/upgrading/s2layers/negatives/layout.s2 Sat Aug 08 18:04:44 2009 +0000
+++ b/bin/upgrading/s2layers/negatives/layout.s2 Sat Aug 08 18:19:56 2009 +0000
@@ -4,6 +4,8 @@ layerinfo author_name = "phoenix";
layerinfo author_name = "phoenix";
layerinfo des = "Highly customisable div-based layout";
layerinfo lang = "en";
+
+set layout_authors = [ { "name" => "phoenix", "type" => "user" } ];
##===============================
## Display settings - general
@@ -98,6 +100,7 @@ propgroup modules {
property use module_syndicate_group;
property use module_time_group;
property use module_poweredby_group;
+ property use module_credit_group;
}
@@ -111,6 +114,7 @@ set module_tags_section = "one";
set module_tags_section = "one";
set module_links_section = "one";
set module_syndicate_section = "one";
+set module_credit_section = "one";
set module_calendar_section = "three";
set module_calendar_opts_type = "horizontal";
@@ -404,6 +408,15 @@ function Page::print_default_stylesheet(
.module-calendar a:hover{
color: $*color_module_link_hover;
}
+ .module-credit dt, .module-credit dd {
+ display: inline;
+ margin: 0;
+ padding: 0;
+ }
+ .module-credit dt {
+ font-weight: bold;
+ margin-right: 0.5em;
+ }
.floatclear {
visibility: hidden;
diff -r 0c901a3e684a -r 677e7e2729fd cgi-bin/LJ/S2Theme/negatives.pm
--- a/cgi-bin/LJ/S2Theme/negatives.pm Sat Aug 08 18:04:44 2009 +0000
+++ b/cgi-bin/LJ/S2Theme/negatives.pm Sat Aug 08 18:19:56 2009 +0000
@@ -2,8 +2,8 @@ use base qw( LJ::S2Theme );
use base qw( LJ::S2Theme );
sub cats { qw( featured ) }
-sub designer { "phoenixdreaming" }
+sub designer { "phoenix" }
sub layouts { ( "2r" => "two-columns-right" ) }
sub layout_prop { "layout_type" }
-1;
\ No newline at end of file
+1;
--------------------------------------------------------------------------------
