3 css-install - an Oddmuse module that allows users to change the site CSS
7 This module allows users to install their own CSS. This is useful for
8 new wikis, specially if using the I<Namespaces> extension.
12 Installing a module is easy: Create a modules subdirectory in your
13 data directory, and put the Perl file in there. It will be loaded
18 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/css-install.pl">css-install.pl</a></p>';
24 C<@CssList> contains a list of all the recommended CSS URLs.
30 use vars
qw(@CssList);
32 # List of Oddmuse CSS URLs
34 @CssList = qw(http://www.emacswiki.org/css/astrid.css
35 http://www.emacswiki.org/css/beige-red.css
36 http://www.emacswiki.org/css/blue.css
37 http://www.emacswiki.org/css/cali.css
38 http://www.emacswiki.org/css/green.css
39 http://www.emacswiki.org/css/hug.css
40 http://www.emacswiki.org/css/oddmuse.css
41 http://www.emacswiki.org/css/wikio.css);
43 push(@MyAdminCode, \
&CssInstallMenu
);
46 my ($id, $menuref, $restref) = @_;
47 push(@
$menuref, ScriptLink
('action=css', T
('Install CSS'), 'css'))
51 $Action{css
} = \
&DoCss
;
54 my $css = GetParam
('install', '');
56 my $data = GetRaw
($css);
57 ReportError
(Ts
('%s returned no data, or LWP::UserAgent is not available.', $css),
58 '500 INTERNAL SERVER ERROR') unless $data;
59 SetParam
('text', $data);
60 DoPost
($StyleSheetPage);
62 print GetHeader
('', T
('Install CSS')), $q->start_div({-class=>'content css'}),
63 $q->p(Ts
('Copy one of the following stylesheets to %s:', GetPageLink
($StyleSheetPage)));
65 print GetFormStart
(undef, 'GET'), GetHiddenValue
('action', 'css');
66 print GetHiddenValue
('css', '');
67 print $q->submit(-name
=>'Reset', -value
=>T
('Reset'));
70 print GetFormStart
(undef, 'GET'), GetHiddenValue
('action', 'css');
71 print GetHiddenValue
('install', '');
72 print $q->submit(-name
=>'Save', -accesskey
=>T
('s'), -value
=>T
('Save'));
75 foreach my $url (@CssList) {
76 print $q->start_div({-class=>'sheet'}), $q->p(GetUrl
($url));
78 print GetFormStart
(undef, 'GET'), GetHiddenValue
('action', 'css');
79 print GetHiddenValue
('css', $url);
80 print $q->submit(-name
=>'Preview', -accesskey
=>T
('p'), -value
=>T
('Preview'));
83 print GetFormStart
(undef, 'GET'), GetHiddenValue
('action', 'css');
84 print GetHiddenValue
('css', '');
85 print GetHiddenValue
('install', $url);
86 print $q->submit(-name
=>'Save', -accesskey
=>T
('s'), -value
=>T
('Save'));
95 =head1 COPYRIGHT AND LICENSE
97 Copyright (C) 2011 Alex Schroeder <alex@gnu.org>
99 This program is free software: you can redistribute it and/or modify it under
100 the terms of the GNU General Public License as published by the Free Software
101 Foundation, either version 3 of the License, or (at your option) any later
104 This program is distributed in the hope that it will be useful, but WITHOUT ANY
105 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
106 PARTICULAR PURPOSE. See the GNU General Public License for more details.
108 You should have received a copy of the GNU General Public License along with
109 this program. If not, see <http://www.gnu.org/licenses/>.