/[smecontribs]/rpms/smeserver-BackupPC/contribs10/smeserver-BackupPC-0.2-Add-sm2-panel-using-iframe.patch
ViewVC logotype

Contents of /rpms/smeserver-BackupPC/contribs10/smeserver-BackupPC-0.2-Add-sm2-panel-using-iframe.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Oct 2 07:49:55 2021 UTC (3 years, 2 months ago) by brianr
Branch: MAIN
CVS Tags: smeserver-BackupPC-0_2-9_el7_sme, smeserver-BackupPC-0_2-10_el7_sme, smeserver-BackupPC-0_2-15_el7_sme, smeserver-BackupPC-0_2-13_el7_sme, smeserver-BackupPC-0_2-14_el7_sme, smeserver-BackupPC-0_2-11_el7_sme, smeserver-BackupPC-0_2-12_el7_sme, HEAD
* Fri Oct 01 2021 Brian Read <brianr@bjsystems.co.uk> 0.2-9.sme
- Add in code for SM2 panel using iframe - note: Authentication not sorted [SME: 11701]

1 diff -urN smeserver-BackupPC-0.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm smeserver-BackupPC-0.2/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm
2 --- smeserver-BackupPC-0.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm 1970-01-01 01:00:00.000000000 +0100
3 +++ smeserver-BackupPC-0.2/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm 2021-07-20 14:33:00.000000000 +0100
4 @@ -0,0 +1,104 @@
5 +package SrvMngr::Controller::Backuppc;
6 +
7 +#----------------------------------------------------------------------
8 +# heading : Administration
9 +# description : BackupPC
10 +# navigation : 4000 4200
11 +#----------------------------------------------------------------------
12 +# name : backuppc, method : get, url : /backuppc, ctlact : Backuppc#main
13 +# routes : end
14 +
15 +use strict;
16 +use warnings;
17 +use Mojo::Base 'Mojolicious::Controller';
18 +use utf8;
19 +
20 +use Locale::gettext;
21 +use SrvMngr::I18N;
22 +use SrvMngr qw(theme_list init_session ip_number_or_blank);
23 +
24 +use Quota;
25 +use esmith::ConfigDB;
26 +use esmith::AccountsDB;
27 +
28 +use esmith::util;
29 +use File::Basename;
30 +use File::Find;
31 +use File::Path qw(make_path remove_tree);
32 +
33 +use esmith::Backup;
34 +use esmith::BackupHistoryDB;
35 +use esmith::util;
36 +use esmith::lockfile;
37 +
38 +use constant DEBUG => $ENV{MOJO_SMANAGER_DEBUG} || 0;
39 +
40 +our $cdb = esmith::ConfigDB->open || die "Couldn't open config db";
41 +our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
42 +
43 +sub main {
44 +
45 + my $c = shift;
46 + $c->app->log->info($c->log_req);
47 +
48 + #my $modul = get_backuppc( $c );
49 +
50 + my $url = "https://".$c->session->{'SystemName'}.".".$c->session->{"DomainName"}."/BackupPC";
51 + #my $url = 'https://sme10.thereadclan.me.uk/BackupPC';
52 + $c->stash(url => $url );
53 + $c->render(template => 'backuppc');
54 +
55 +}
56 +
57 +
58 +sub get_backuppc {
59 +
60 + my ($c) = @_;
61 +
62 + my $tx = $c->tx;
63 + my $req = $tx->req;
64 +
65 +# 3 env variables for durep.cgi
66 + #$ENV{'SCRIPT_NAME'} = 'durep';
67 + #$ENV{'REQUEST_METHOD'} = $req->method;
68 + #$ENV{'QUERY_STRING'} = $req->url->query->to_string;
69 +
70 + my $res = `https:////sme10.thereadclan.me.uk//BackupPC`;
71 +
72 + my $res = `/usr/share/BackupPC/sbin/BackupPC_Admin`; #
73 + my $step = 0; my $out;
74 + my @lines = split /\n/, $res;
75 + # remove except 'body'
76 + foreach my $line (@lines) {
77 + if ( $line =~ m|<body>| ) {
78 + $step = 1;
79 + } elsif ( $line =~ m|</body>| ) {
80 + $step = 2;
81 + } elsif ( $step == 1 ) {
82 + $out .= $line;
83 + }
84 + }
85 + return $out;
86 +}
87 +
88 +#sub main {
89 +
90 +# my $c = shift;
91 +# $c->app->log->info($c->log_req);
92 +
93 +# BEGIN
94 +# {
95 +# $ENV {'PATH'} = '/bin:/usr/bin:/sbin';
96 +# $ENV {'SHELL'} = '/bin/bash';
97 +# delete $ENV {'ENV'};
98 +# }
99 +
100 +
101 + #$c = $c->redirect_to("https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/BackupPC");
102 +# $c = $c->redirect_to("https://sme10.thereadclan.me.uk//BackupPC");
103 +
104 +#}
105 +
106 +
107 +1;
108 +
109 diff -urN smeserver-BackupPC-0.2.old/root/usr/share/smanager/themes/default/templates/backuppc.html.ep smeserver-BackupPC-0.2/root/usr/share/smanager/themes/default/templates/backuppc.html.ep
110 --- smeserver-BackupPC-0.2.old/root/usr/share/smanager/themes/default/templates/backuppc.html.ep 1970-01-01 01:00:00.000000000 +0100
111 +++ smeserver-BackupPC-0.2/root/usr/share/smanager/themes/default/templates/backuppc.html.ep 2021-07-19 15:36:00.000000000 +0100
112 @@ -0,0 +1,26 @@
113 +% layout 'default', title => 'Sme server 2 - BackupPC';
114 +
115 +% content_for 'head_contrib' => begin
116 +
117 +%end
118 +
119 +% content_for 'module' => begin
120 + % if ($config->{debug} == 1) {
121 + <p>
122 + %= dumper stash 'url'
123 + </p>
124 + % }
125 +
126 + <div id="central">
127 + % if ( stash 'error' ) {
128 + <br><div class=sme-error>
129 + %= $c->render_to_string(inline => stash 'error')
130 + </div>
131 + %}
132 +
133 + <iframe src="<%= $url %>" title="Backup PC" width="100%" height="1000px"></iframe>
134 +
135 + %#= $c->render_to_string(inline => $modul)
136 +
137 + </div>
138 +% end

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed