Skip to content

Commit 24f5292

Browse files
Added configuration page
1 parent 8dcdca6 commit 24f5292

File tree

4 files changed

+206
-169
lines changed

4 files changed

+206
-169
lines changed

Koha/Plugin/Com/PerplexedTheta/SENUX.pm

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ sub new {
3535

3636
sub install {
3737
my ($self) = shift;
38+
39+
$self->store_data({ enable_js => 1 });
40+
3841
return 1;
3942
}
4043

@@ -43,6 +46,27 @@ sub uninstall {
4346
return 1;
4447
}
4548

49+
sub configure {
50+
my ($self) = @_;
51+
my $cgi = $self->{'cgi'};
52+
53+
unless ($cgi->param('save')) {
54+
my $template = $self->get_template({file => 'configure.tt'});
55+
56+
$template->param(
57+
enable_js => $self->retrieve_data('enable_js'),
58+
);
59+
60+
$self->output_html($template->output());
61+
}
62+
else {
63+
$self->store_data({
64+
enable_js => scalar $cgi->param('enable_js') ? 1 : 0,
65+
});
66+
$self->go_home();
67+
}
68+
}
69+
4670
sub api_namespace {
4771
my ($self) = @_;
4872

@@ -68,6 +92,9 @@ sub opac_head {
6892
sub opac_js {
6993
my ($self) = @_;
7094

95+
return
96+
unless scalar $self->retrieve_data('enable_js') == 1;
97+
7198
return '<script src="/api/v1/contrib/senux/static/static_files/dist/senux.min.js"></script>';
7299
}
73100

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[% USE raw %]
2+
[% USE KohaDates %]
3+
[% PROCESS 'i18n.inc' %]
4+
[% SET footerjs = 1 %]
5+
[% INCLUDE 'doc-head-open.inc' %]
6+
<title>SENUX: Configure &rsaquo; Plugins &rsaquo; Administration &rsaquo; Koha</title>
7+
[% INCLUDE 'doc-head-close.inc' %]
8+
</head>
9+
10+
<body id="senux_plugin_configure" class="plugin">
11+
[% WRAPPER 'header.inc' %]
12+
[% INCLUDE 'prefs-admin-search.inc' %]
13+
[% END %]
14+
15+
[% WRAPPER 'sub-header.inc' %]
16+
[% WRAPPER breadcrumbs %]
17+
[% WRAPPER breadcrumb_item %]
18+
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
19+
[% END %]
20+
[% WRAPPER breadcrumb_item %]
21+
<a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a>
22+
[% END %]
23+
[% WRAPPER breadcrumb_item bc_active= 1 %]
24+
<span>SENUX: Configure</span>
25+
[% END %]
26+
[% END #/ WRAPPER breadcrumbs %]
27+
[% END #/ WRAPPER sub-header.inc %]
28+
29+
<div class="main container-fluid">
30+
<div class="row">
31+
<div class="col-md-10 order-md-2 order-sm-1">
32+
<main>
33+
<h1>SENUX: Configure</h1>
34+
<form id="form" action="" method="get">
35+
<fieldset class="rows">
36+
<p>Please specify if you wish to enable the built-in JavaScript helpers. These may clash with your OPACUserJS. If so, disable these below.</p>
37+
<li>
38+
<label for="enable_js">Enable JavaScript</label>
39+
<select name="enable_js">
40+
[% IF enable_js == 1 %]
41+
<option value="1" selected="selected">Yes</option>
42+
<option value="0">No</option>
43+
[% ELSE %]
44+
<option value="1">Yes</option>
45+
<option value="0" selected="selected">No</option>
46+
[% END %]
47+
</select>
48+
</li>
49+
</ol>
50+
</fieldset>
51+
<fieldset class="action">
52+
<input type="hidden" name="class" value="[% CLASS %]"/>
53+
<input type="hidden" name="method" value="[% METHOD %]"/>
54+
<input type="hidden" name="save" value="1" />
55+
<input type="submit" class="btn btn-primary" value="Save" />
56+
<a class="cancel" href="/cgi-bin/koha/plugins/plugins-home.pl">Cancel</a>
57+
</fieldset>
58+
</form>
59+
</main>
60+
</div> <!-- /.col-md-10.order-md-2 -->
61+
<div class="col-md-2 order-sm-2 order-md-1">
62+
<aside>
63+
[% INCLUDE 'admin-menu.inc' %]
64+
</aside>
65+
</div> <!-- /.col-md-2.order-md-1 -->
66+
</div>
67+
</div>
68+
69+
[% MACRO jsinclude BLOCK %]
70+
<script>
71+
$( document ).ready( function() {
72+
$('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl"]').addClass("current");
73+
} );
74+
</script>
75+
<script>
76+
$( document ).ready( function() {
77+
// silence is golden
78+
} );
79+
</script>
80+
[% END %]
81+
82+
[% INCLUDE 'intranet-bottom.inc' %]

0 commit comments

Comments
 (0)