1 |
diff -ruN e-smith-backup-2.4.0/root/etc/e-smith/web/functions/backup e-smith-backup-2.4.0.new/root/etc/e-smith/web/functions/backup |
2 |
--- e-smith-backup-2.4.0/root/etc/e-smith/web/functions/backup 2014-02-02 22:08:41.000000000 -0800 |
3 |
+++ e-smith-backup-2.4.0.new/root/etc/e-smith/web/functions/backup 2014-02-02 22:57:24.000000000 -0800 |
4 |
@@ -1161,6 +1161,7 @@ |
5 |
my $backupwkIncOnlyTimeout; |
6 |
my $compression; |
7 |
my $VFSType = $q->param ('VFSType'); |
8 |
+ my $error=""; |
9 |
my $dof; |
10 |
my @usbdisks; |
11 |
my %dlabels = (); |
12 |
@@ -1230,13 +1231,11 @@ |
13 |
push @usbdisks, $vollbl; |
14 |
} |
15 |
} |
16 |
- |
17 |
unless ($usbdisks[0]){ |
18 |
- esmith::cgi::genResult( |
19 |
- $fm->{cgi}, $fm->localise('ERR_NO_USB_DISK')); |
20 |
- return |
21 |
- } |
22 |
- } |
23 |
+ push @usbdisks, $fm->localise('ERR_NO_USB_DISK'); |
24 |
+ $error='nousb'; |
25 |
+ } |
26 |
+ } |
27 |
|
28 |
print $q->startform( |
29 |
-method => 'POST', |
30 |
@@ -1431,6 +1430,7 @@ |
31 |
|
32 |
print "</table>\n"; |
33 |
|
34 |
+ if ($error eq 'nousb') {$VFSType = "nousb";} |
35 |
print $q->start_table ({width => "100%", -class => "sme-noborders"}); |
36 |
print $q->Tr($q->th({-class => "sme-layout"}, |
37 |
$q->submit( |
38 |
@@ -1462,7 +1462,7 @@ |
39 |
{ |
40 |
my ($q) = @_; |
41 |
|
42 |
- my $status = $q->param ('workstnbackup'); |
43 |
+ my $status = $q->param ('workstnbackup') || ""; |
44 |
my $inconly = $q->param ('incOnlyTimeout'); |
45 |
my $dof = $q->param('dof'); |
46 |
my $ampm; |
47 |
@@ -1472,13 +1472,39 @@ |
48 |
$q, |
49 |
undef, $fm->localise('UPDATING_WORKSTN_CONF') |
50 |
); |
51 |
+ |
52 |
+ my $rec = $conf->get('backupwk'); |
53 |
+ unless (defined $rec) |
54 |
+ { |
55 |
+ $rec = $conf->new_record('backupwk', {type=>'service'}); |
56 |
+ } |
57 |
+ |
58 |
+ unless ( $status eq 'on') |
59 |
+ { |
60 |
+ # set service to disabled |
61 |
+ my $old = $conf->get('UnsavedChanges')->value; |
62 |
+ |
63 |
+ $rec->set_prop('status', 'disabled'); |
64 |
+ $conf->get('UnsavedChanges')->set_value($old); |
65 |
|
66 |
+ system("/sbin/e-smith/signal-event", "conf-backup") == 0 |
67 |
+ or die($fm->localise('ERR_CONF_BACKUP')."\n"); |
68 |
+ |
69 |
+ esmith::cgi::genResult($q, $fm->localise('SUCCESSFULLY_DISABLED_WORKSTN')); |
70 |
+ return; |
71 |
+ } |
72 |
+ |
73 |
#-------------------------------------------------- |
74 |
# Untaint parameters and check for validity |
75 |
#-------------------------------------------------- |
76 |
|
77 |
my $VFSType = $q->param ('VFSType'); |
78 |
- |
79 |
+ if ( $VFSType eq 'nousb') |
80 |
+ { |
81 |
+ esmith::cgi::genResult($q, $fm->localise('ERR_NO_USB_DISK')); |
82 |
+ return; |
83 |
+ } |
84 |
+ |
85 |
my $backupwkStation = $q->param ('backupwkStation'); |
86 |
if ( $VFSType eq 'usb') { $backupwkStation = 'localhost' } |
87 |
if ($backupwkStation =~ /^\s*(\S+)\s*$/) { |
88 |
@@ -1587,12 +1613,6 @@ |
89 |
return; |
90 |
} |
91 |
|
92 |
- my $rec = $conf->get('backupwk'); |
93 |
- unless (defined $rec) |
94 |
- { |
95 |
- $rec = $conf->new_record('backupwk', {type=>'service'}); |
96 |
- } |
97 |
- |
98 |
$rec->set_prop('SmbHost', $backupwkStation); |
99 |
$rec->set_prop('SmbShare', $backupwkFolder); |
100 |
$rec->set_prop('Login', $backupwkLogin); |
101 |
@@ -1619,9 +1639,6 @@ |
102 |
} |
103 |
|
104 |
$rec->set_prop('Program', $module); |
105 |
- |
106 |
- if (defined $status && $status eq 'on') |
107 |
- { |
108 |
|
109 |
my $backupwkHour = $q->param ('backupwkHour'); |
110 |
if ($backupwkHour =~ /^(.*)$/) { |
111 |
@@ -1688,22 +1705,6 @@ |
112 |
esmith::cgi::genResult( |
113 |
$q, $fm->localise('SUCCESSFULLY_ENABLED_WORKSTN').$q->br(). |
114 |
$fm->localise('WITH_BACKUP_TIME')."$backupwkHour:$backupwkMin"); |
115 |
- } |
116 |
- else |
117 |
- { |
118 |
- # set service to disabled |
119 |
- my $old = $conf->get('UnsavedChanges')->value; |
120 |
- |
121 |
- $rec->set_prop('status', 'disabled'); |
122 |
- $conf->get('UnsavedChanges')->set_value($old); |
123 |
- |
124 |
- system("/sbin/e-smith/signal-event", "conf-backup") == 0 |
125 |
- or die($fm->localise('ERR_CONF_BACKUP')."\n"); |
126 |
- |
127 |
- esmith::cgi::genResult( |
128 |
- $q, $fm->localise('SUCCESSFULLY_DISABLED_WORKSTN') |
129 |
- ); |
130 |
- } |
131 |
|
132 |
return; |
133 |
} |