afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-04-26 04:07 pm

[dw-free] Fix up layout types definition

[commit: http://hg.dwscoalition.org/dw-free/rev/0994eaccc677]

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

layout_types stuff, for selecting the layout types via images in the wizard.

Thanks to [personal profile] nova for 3l.png, and to [personal profile] aveleh for
the changes to core2

Patch by [personal profile] afuna.

Files modified:
  • bin/upgrading/en.dat
  • bin/upgrading/s2layers/core2.s2
  • bin/upgrading/s2layers/core2base/layout.s2
  • bin/upgrading/s2layers/negatives/layout.s2
  • cgi-bin/LJ/Customize.pm
  • cgi-bin/LJ/S2Theme/core2base.pm
  • cgi-bin/LJ/S2Theme/negatives.pm
  • htdocs/img/customize/layouts/3.png
  • htdocs/img/customize/layouts/3l.png
  • htdocs/img/customize/layouts/3m.png
  • htdocs/img/customize/layouts/3r.png
--------------------------------------------------------------------------------
diff -r 2247cb60a27e -r 0994eaccc677 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Sun Apr 26 13:49:54 2009 +0000
+++ b/bin/upgrading/en.dat	Sun Apr 26 23:51:26 2009 +0800
@@ -632,9 +632,11 @@ customize.layouts.2r=2 Column (sidebar o
 
 customize.layouts.2rnh=2 Column (sidebar on right; no header)
 
-customize.layouts.3l=3 Column (content on left)
-
-customize.layouts.3m=3 Column (content in middle)
+customize.layouts.3l=3 Column (sidebars on the left)
+
+customize.layouts.3r=3 Column (sidebars on the right)
+
+customize.layouts.3=3 Column (sidebars on either side)
 
 customize.layouts_for_dropdown.choose=(Choose a Layout)
 
diff -r 2247cb60a27e -r 0994eaccc677 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Sun Apr 26 13:49:54 2009 +0000
+++ b/bin/upgrading/s2layers/core2.s2	Sun Apr 26 23:51:26 2009 +0800
@@ -1180,6 +1180,28 @@ set comment_management_links = "icons";
 ## Display settings - sidebar
 ##===============================
 
+# FIXME: Not sure if none is a sensible value, but need something appropriate as a default for designers who are not using this option.
+# In order to use layout_type on /customize/ in official layouts, the associated S2Theme file needs to be edited, and then changing the layout type will select a different wizard-layer.  Non-official layouts can use this property on the /customize/options.bml page.  Both methods will add the layout_type to <body> in the Page::print-wrapper to allow CSS to be written accordingly.
+
+property string layout_type {
+        des = "Layout Type";
+        values = "|none|one-column|One column|two-columns-left|Two columns (Sidebar on Left)|two-columns-right|Two columns (Sidebar on Right)|three-columns-sides|Three columns (Sidebars on either side)|three-columns-left|Three column (Sidebars on Left)|three-columns-right|Three column (Sidebars on Right)";
+    }
+
+property string sidebar_width {
+    des = "Set the width of any sidebars.  Ensure that the value is given in em or px.";
+    example = "15em";
+}
+
+property string sidebar_width_doubled {
+    des = "Enter in a value twice that of any sidebars.  Also ensure that the value is given in em or px.";
+    example = "30em";
+}
+
+set layout_type = "";
+set sidebar_width = "";
+set sidebar_width = "";
+
 property string module_layout_sections {
     des = "Map module sections to user-friendly names for the wizard. Layouts may want to override this";
     example = "none|(none)|one|Header|two|Sidebar|three|Footer";
@@ -2634,7 +2656,7 @@ function Page::print_wrapper_start(strin
 {
 # FIXME: this should also print classes that identify the layout/style and other options like the number of columns.
     var string class = $opts{"class"} ? """class="$opts{"class"}" """ : "";
-    """<body class="page-$.view $class">\n""";
+    """<body class="page-$.view $*layout_type $class">\n""";
 }
 
 function Page::print_wrapper_end() 
diff -r 2247cb60a27e -r 0994eaccc677 bin/upgrading/s2layers/core2base/layout.s2
--- a/bin/upgrading/s2layers/core2base/layout.s2	Sun Apr 26 13:49:54 2009 +0000
+++ b/bin/upgrading/s2layers/core2base/layout.s2	Sun Apr 26 23:51:26 2009 +0800
@@ -10,7 +10,14 @@ propgroup presentation {
     property use num_items_recent;
     property use num_items_reading;
     property use use_journalstyle_entry_page;
+    property use layout_type;
+    property use sidebar_width;
+    property use sidebar_width_doubled;
 }
+
+set sidebar_width = "15em";
+set sidebar_width_doubled = "30em";
+set layout_type = "one-column";
 
 ##===============================
 ## Journal style - colors
@@ -56,7 +63,7 @@ propgroup modules {
 }
 
 # explicitly define what sections the layout has available
-set module_layout_sections = "none|(none)|one|Sidebar|two|Footer";
+set module_layout_sections = "none|(none)|one|Sidebar|two|Sidebar-Two|three|Footer";
 
 ##===============================
 ## Custom CSS
diff -r 2247cb60a27e -r 0994eaccc677 bin/upgrading/s2layers/negatives/layout.s2
--- a/bin/upgrading/s2layers/negatives/layout.s2	Sun Apr 26 13:49:54 2009 +0000
+++ b/bin/upgrading/s2layers/negatives/layout.s2	Sun Apr 26 23:51:26 2009 +0800
@@ -14,8 +14,8 @@ propgroup presentation {
     property use num_items_recent;
     property use num_items_reading;
     property use use_journalstyle_entry_page;
+    property use layout_type;
 }
-
 
 ##===============================
 ## Journal style - colors
diff -r 2247cb60a27e -r 0994eaccc677 cgi-bin/LJ/Customize.pm
--- a/cgi-bin/LJ/Customize.pm	Sun Apr 26 13:49:54 2009 +0000
+++ b/cgi-bin/LJ/Customize.pm	Sun Apr 26 23:51:26 2009 +0800
@@ -681,8 +681,9 @@ sub get_layouts {
         '2r'   => LJ::Lang::ml('customize.layouts.2r'),
         '2lnh' => LJ::Lang::ml('customize.layouts.2lnh'),
         '2rnh' => LJ::Lang::ml('customize.layouts.2rnh'),
-        '3l'   => LJ::Lang::ml('customize.layouts.3l'),
-        '3m'   => LJ::Lang::ml('customize.layouts.3m'),
+        '3l'   => LJ::Lang::ml( 'customize.layouts.3l' ),
+        '3r'   => LJ::Lang::ml( 'customize.layouts.3r' ),
+        '3'    => LJ::Lang::ml( 'customize.layouts.3' ),
     );
 }
 
diff -r 2247cb60a27e -r 0994eaccc677 cgi-bin/LJ/S2Theme/core2base.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/LJ/S2Theme/core2base.pm	Sun Apr 26 23:51:26 2009 +0800
@@ -0,0 +1,7 @@
+package LJ::S2Theme::core2base;
+use base qw( LJ::S2Theme );
+
+sub layouts { ( "1" => "one-column", "2l" => "two-columns-left", "2r" => "two-columns-right", "3" => "three-columns-sides", "3r" => "three-columns-right", "3l" => "three-columns-left" ) }
+sub layout_prop { "layout_type" }
+
+1;
\ No newline at end of file
diff -r 2247cb60a27e -r 0994eaccc677 cgi-bin/LJ/S2Theme/negatives.pm
--- a/cgi-bin/LJ/S2Theme/negatives.pm	Sun Apr 26 13:49:54 2009 +0000
+++ b/cgi-bin/LJ/S2Theme/negatives.pm	Sun Apr 26 23:51:26 2009 +0800
@@ -4,4 +4,6 @@ sub cats { qw( featured ) }
 sub cats { qw( featured ) }
 sub designer { "phoenixdreaming" }
 
+sub layouts { ( "2r" => "two-columns-right" ) }
+sub layout_prop { "layout_type" }
 1;
\ No newline at end of file
diff -r 2247cb60a27e -r 0994eaccc677 htdocs/img/customize/layouts/3.png
Binary file htdocs/img/customize/layouts/3.png has changed
diff -r 2247cb60a27e -r 0994eaccc677 htdocs/img/customize/layouts/3l.png
Binary file htdocs/img/customize/layouts/3l.png has changed
diff -r 2247cb60a27e -r 0994eaccc677 htdocs/img/customize/layouts/3m.png
Binary file htdocs/img/customize/layouts/3m.png has changed
diff -r 2247cb60a27e -r 0994eaccc677 htdocs/img/customize/layouts/3r.png
Binary file htdocs/img/customize/layouts/3r.png has changed
--------------------------------------------------------------------------------