Module: Yast::FtpServerComplexInclude
- Defined in:
- ../../src/include/ftp-server/complex.rb
Instance Method Summary (collapse)
- - (Object) initialize_ftp_server_complex(include_target)
-
- (Object) Modified
Return a modification status.
- - (Object) PollAbort
-
- (Object) ReadDialog
Read settings dialog.
-
- (Boolean) ReadFTPService
Init settings dialog (select the daemon).
- - (Object) ReallyAbort
-
- (Object) WriteDialog
Write settings dialog.
Instance Method Details
- (Object) initialize_ftp_server_complex(include_target)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File '../../src/include/ftp-server/complex.rb', line 11 def initialize_ftp_server_complex(include_target) Yast.import "UI" textdomain "ftp-server" Yast.import "Label" Yast.import "Popup" Yast.import "Wizard" Yast.import "Confirm" Yast.import "FtpServer" Yast.import "Package" Yast.import "Service" Yast.include include_target, "ftp-server/helps.rb" end |
- (Object) Modified
Return a modification status
28 29 30 |
# File '../../src/include/ftp-server/complex.rb', line 28 def Modified FtpServer.Modified end |
- (Object) PollAbort
36 37 38 |
# File '../../src/include/ftp-server/complex.rb', line 36 def PollAbort UI.PollInput == :abort end |
- (Object) ReadDialog
Read settings dialog
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File '../../src/include/ftp-server/complex.rb', line 255 def ReadDialog Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", "")) # FtpServer::AbortFunction = PollAbort; result = ReadFTPService() return :abort if !result return :abort if !Confirm.MustBeRoot ret = FtpServer.Read if FtpServer.vsftpd_edit && ret || !FtpServer.vsftpd_edit && ret return :next else return :abort end #return ret ? `next : `abort; end |
- (Boolean) ReadFTPService
Init settings dialog (select the daemon)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File '../../src/include/ftp-server/complex.rb', line 45 def ReadFTPService #Checking if ftp daemons are installed rad_but = 0 vsftpd_init_count = 0 pureftpd_init_count = 0 ret = nil vs_package_available = false pure_package_available = false if Package.Installed("vsftpd") vsftpd_init_count = Ops.add(vsftpd_init_count, 1) FtpServer.vsftpd_installed = true end if Package.Installed("pure-ftpd") pureftpd_init_count = Ops.add(pureftpd_init_count, 1) FtpServer.pureftpd_installed = true end if vsftpd_init_count == 0 && pureftpd_init_count == 0 vs_package_available = Package.Available("vsftpd") pure_package_available = Package.Available("pure-ftpd") if !vs_package_available && !pure_package_available Popup.Error(_("Packages for vsftpd and pure-ftpd are not available.")) Builtins.y2error( "[ftp-server] (ReadFTPService ()) Packages for vsftpd and pure-ftpd are not available." ) return false end UI.OpenDialog( RadioButtonGroup( Id("IntstallFTPd"), # end of `VBox( VBox( Heading(_("No server package installed.")), Left(Label(_("Choose an FTP daemon."))), Left(Label(_("Press Cancel to cancel FTP configuration."))), Left(RadioButton(Id(0), Opt(:notify), _("&vsftpd"), true)), Left(RadioButton(Id(1), Opt(:notify), _("&pure-ftpd"))), ButtonBox( PushButton(Id(:accept), Label.OKButton), PushButton(Id(:cancel), Label.CancelButton) ) ) ) #end of `RadioButtonGroup(`id("IntstallFTPd") ) # end of UI::OpenDialog( if !vs_package_available UI.ChangeWidget(Id(0), :Enabled, false) UI.ChangeWidget(Id(1), :Value, true) end if !pure_package_available UI.ChangeWidget(Id(1), :Enabled, false) UI.ChangeWidget(Id(0), :Value, true) end install = 0 while true ret = UI.UserInput if ret == :accept install = Convert.to_integer( UI.QueryWidget(Id("IntstallFTPd"), :CurrentButton) ) break elsif ret == :cancel UI.CloseDialog Builtins.y2milestone("[ftp-server] Installation was aborted") return false end end UI.CloseDialog result = nil daemon_list = [] daemon = "" if install == 0 daemon = "vsftpd" daemon_list = Builtins.add(daemon_list, daemon) result = vs_package_available else daemon = "pure-ftpd" daemon_list = Builtins.add(daemon_list, daemon) result = pure_package_available end #result = Package::Available(daemon); if result == true result = Package.DoInstall(daemon_list) if result == false Popup.Error(_("Installation failed.")) Builtins.y2milestone("[ftp-server] Installation failed") return false end if daemon == "pure-ftpd" FtpServer.pureftpd_installed = true pureftpd_init_count = Ops.add(pureftpd_init_count, 1) else FtpServer.vsftpd_installed = true vsftpd_init_count = Ops.add(vsftpd_init_count, 1) end elsif result == false Popup.Error(_("Package for FTP is not available.")) Builtins.y2milestone("[ftp-server] Package for ftp is not available") return false elsif result == nil Popup.Error(_("Package not found.")) Builtins.y2milestone("[ftp-server] Package was not found") return false end end #end of if ((vsftpd_init_count == 0) && (pureftpd_init_count == 0)) { #Checking Enabled services for ftp daemons if Service.Enabled("pure-ftpd") pureftpd_init_count = Ops.add(pureftpd_init_count, 1) end if Service.Enabled("vsftpd") vsftpd_init_count = Ops.add(vsftpd_init_count, 1) end #Checking status of ftp daemons if Service.Status("vsftpd") == 0 FtpServer.vsftpd_edit = true vsftpd_init_count = Ops.add(vsftpd_init_count, 1) else FtpServer.vsftpd_edit = false end if Service.Status("pure-ftpd") == 0 FtpServer.vsftpd_edit = false pureftpd_init_count = Ops.add(pureftpd_init_count, 1) else FtpServer.vsftpd_edit = true end # open dialog for choosing ftp daemon if pureftpd_init_count == vsftpd_init_count && FtpServer.pureftpd_installed && FtpServer.vsftpd_installed UI.OpenDialog( RadioButtonGroup( Id(:rb), VBox( Label(_("Choose daemon?")), Left( RadioButton( Id(0), Opt(:notify), _("&vsftpd"), FtpServer.vsftpd_edit ? true : false ) ), Left( RadioButton( Id(1), Opt(:notify), _("&pure-ftpd"), FtpServer.vsftpd_edit ? false : true ) ), ButtonBox( PushButton(Id(:close), Label.OKButton), PushButton(Id(:abort), Label.CancelButton) ) ) ) #end of `RadioButtonGroup(`id(`rb), `VBox( ) #end of UI::OpenDialog( while true ret = UI.UserInput if ret == :close rad_but = Convert.to_integer( UI.QueryWidget(Id(:rb), :CurrentButton) ) break elsif ret == :abort return false end end #end of while (true) { if rad_but == 0 FtpServer.vsftpd_edit = true else FtpServer.vsftpd_edit = false end Builtins.y2milestone( "[ftp-server] Terminating by the radiobutom ID '%1'", rad_but ) UI.CloseDialog else if FtpServer.pureftpd_installed && !FtpServer.vsftpd_installed FtpServer.vsftpd_edit = false end if !FtpServer.pureftpd_installed && FtpServer.vsftpd_installed FtpServer.vsftpd_edit = true end end true end |
- (Object) ReallyAbort
32 33 34 |
# File '../../src/include/ftp-server/complex.rb', line 32 def ReallyAbort !FtpServer.Modified || Popup.ReallyAbort(true) end |
- (Object) WriteDialog
Write settings dialog
273 274 275 276 277 278 |
# File '../../src/include/ftp-server/complex.rb', line 273 def WriteDialog Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", "")) # FtpServer::AbortFunction = PollAbort; ret = FtpServer.Write ret ? :next : :abort end |