[dw-nonfree] Refactor DW::SiteScheme / remove some duplicated cdoe
[commit: http://hg.dwscoalition.org/dw-nonfree/rev/26b68135eab0]
http://bugs.dwscoalition.org/show_bug.cgi?id=3409
Update to use the new method signature for DW::SiteScheme.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3409
Update to use the new method signature for DW::SiteScheme.
Patch by
Files modified:
- cgi-bin/DW/Hooks/SiteScheme.pm
- cgi-bin/DW/SiteScheme/Local.pm
--------------------------------------------------------------------------------
diff -r be061450c558 -r 26b68135eab0 cgi-bin/DW/Hooks/SiteScheme.pm
--- a/cgi-bin/DW/Hooks/SiteScheme.pm Sun Jan 23 10:50:31 2011 +0800
+++ b/cgi-bin/DW/Hooks/SiteScheme.pm Mon Jan 24 16:21:00 2011 +0800
@@ -2,8 +2,9 @@
#
# Authors:
# Janine Smith <janine@netrophic.com>
+# Andrea Nall <anall@andreanall.com>
#
-# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+# Copyright (c) 2009-2011 by Dreamwidth Studios, LLC.
#
# This program is NOT free software or open-source; you can use it as an
# example of how to implement your own site-specific extensions to the
@@ -15,17 +16,28 @@ package DW::Hooks::SiteScheme;
use strict;
use LJ::Hooks;
+use DW::SiteScheme;
LJ::Hooks::register_hook('modify_scheme_list', sub {
- my $schemesref = shift;
+ my ( $schemes, $merge_func ) = @_;
- @$schemesref = (
- { scheme => "tropo-red", title => "Tropospherical Red" },
- { scheme => "tropo-purple", title => "Tropospherical Purple" },
- { scheme => "celerity-local", title => "Celerity" },
- { scheme => "gradation-horizontal-local", title => "Gradation Horizontal" },
- { scheme => "gradation-vertical-local", title => "Gradation Vertical" },
- { scheme => "lynx", title => "Lynx (light mode)" },
+ $merge_func->(
+ 'celerity-local' => { parent => 'celerity', title => "Celerity" },
+ 'dreamwidth' => { parent => 'global', internal => 1 },
+ 'gradation-horizontal-local' => { parent => 'gradation-horizontal', title => "Gradation Horizontal" },
+ 'gradation-vertical-local' => { parent => 'gradation-vertical', title => "Gradation Vertical" },
+ 'tropo-common' => { parent => 'common', internal => 1 },
+ 'tropo-purple' => { parent => 'tropo-common', title => "Tropospherical Purple" },
+ 'tropo-red' => { parent => 'tropo-common', title => "Tropospherical Red" },
+ );
+
+ @{$schemes} = (
+ { scheme => "tropo-red" },
+ { scheme => "tropo-purple" },
+ { scheme => "celerity-local" },
+ { scheme => "gradation-horizontal-local" },
+ { scheme => "gradation-vertical-local" },
+ { scheme => "lynx" },
);
});
diff -r be061450c558 -r 26b68135eab0 cgi-bin/DW/SiteScheme/Local.pm
--- a/cgi-bin/DW/SiteScheme/Local.pm Sun Jan 23 10:50:31 2011 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#!/usr/bin/perl
-#
-# DW::SiteScheme::Local
-#
-# Register the local sitesechemes
-#
-# Authors:
-# Andrea Nall <anall@andreanall.com>
-#
-# Copyright (c) 2010 by Dreamwidth Studios, LLC.
-#
-# This program is NOT free software or open-source; you can use it as an
-# example of how to implement your own site-specific extensions to the
-# Dreamwidth Studios open-source code, but you cannot use it on your site
-# or redistribute it, with or without modifications.
-#
-use strict;
-use DW::SiteScheme;
-
-DW::SiteScheme->register_siteschemes(
- 'celerity-local' => 'celerity',
- 'dreamwidth' => 'global',
- 'gradation-horizontal-local' => 'gradation-horizontal',
- 'gradation-vertical-local' => 'gradation-vertical',
- 'tropo-common' => 'common',
- 'tropo-purple' => 'tropo-common',
- 'tropo-red' => 'tropo-common'
-);
-
-DW::SiteScheme->register_default_sitescheme( 'tropo-red' );
-
-1;
--------------------------------------------------------------------------------
