Author: juhliarik Date: Tue May 29 17:05:37 2007 New Revision: 38183 URL: http://svn.opensuse.org/viewcvs/yast?rev=38183&view=rev Log: added new option for uploading (vsftpd) Modified: trunk/ftp-server/config/ftp-server.rnc trunk/ftp-server/src/FtpServer.ycp trunk/ftp-server/src/dialogs.ycp trunk/ftp-server/src/uiforms.ycp trunk/ftp-server/src/wid_functions.ycp trunk/ftp-server/src/write_load.ycp Modified: trunk/ftp-server/config/ftp-server.rnc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/config/ftp-server.rnc?... ============================================================================== --- trunk/ftp-server/config/ftp-server.rnc (original) +++ trunk/ftp-server/config/ftp-server.rnc Tue May 29 17:05:37 2007 @@ -35,5 +35,7 @@ element CertFile { text }? & element VirtualUser { text }? & element FTPUser { text }? & - element GuestUser { text }? + element GuestUser { text }? & + element EnableUpload { text }? + } \ No newline at end of file Modified: trunk/ftp-server/src/FtpServer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/FtpServer.ycp?rev=... ============================================================================== --- trunk/ftp-server/src/FtpServer.ycp (original) +++ trunk/ftp-server/src/FtpServer.ycp Tue May 29 17:05:37 2007 @@ -146,7 +146,7 @@ "UmaskAnon", "UmaskLocal", "PasMinPort", "PasMaxPort", "MaxIdleTime", "MaxClientsPerIP", "MaxClientsNumber", "LocalMaxRate", "AnonMaxRate", "AnonAuthen", "AnonReadOnly", "AnonCreatDirs", "Banner", "SSLEnable", "TLS", "AntiWarez", "SSL", "StartXinetd", -"PassiveMode", "CertFile", "SSLv2", "SSLv3", "VirtualUser", "FTPUser", "GuestUser"]; +"PassiveMode", "CertFile", "SSLv2", "SSLv3", "VirtualUser", "FTPUser", "GuestUser", "EnableUpload"]; /** * map of deafult values for options in UI @@ -186,6 +186,7 @@ "VirtualUser" : "NO", "FTPUser" : "ftp", "GuestUser" : "", + "EnableUpload" : "NO", ]; Modified: trunk/ftp-server/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/dialogs.ycp?rev=38... ============================================================================== --- trunk/ftp-server/src/dialogs.ycp (original) +++ trunk/ftp-server/src/dialogs.ycp Tue May 29 17:05:37 2007 @@ -223,11 +223,13 @@ result["custom_widget"] = `VBox(); result["init"] = InitAnonSettings; result["store"] = StoreAnonSettings; + result["handle"] = HandleAnonSettings; result["help"] = DialogHelpText("anon_settings"); return result; } + /** * Init function where are added UI hadle functions * Expert Settings widget (vsftpd) @@ -431,6 +433,28 @@ /** * Init function where are added UI hadle functions + * Anonymous Settings widget + * define for tabs_vsftpd/tabs_pureftpd necessary later in screens (CWNTree) + * + * @return map<string,any> map for Anonymous Settings widget + */ + +map<string,any> vsftpd_anon_settings () { + map<string,any> result = $[]; + + result["contents"] = `VBox ( + VsftpdAnonSettings() + ); + // TRANSLATORS: part of dialog caption + result["caption"] = _("FTP Anonymous Settings"); + // TRANSLATORS: tree menu item + result["tree_item_label"] = _("Authentication"); + result["widget_names"] = [ "DisBackButton", "AnonSettings"]; + + return result; +} +/** + * Init function where are added UI hadle functions * Expert Settings widget (vsftpd) * define for tabs_vsftpd necessary later in screens (CWNTree) * @@ -513,7 +537,7 @@ "VSFTPDAddSettings": VSFTPDSettings(), - "PUREFTPDAddSettings": PUREFTPDAddSettings (), + //"PUREFTPDAddSettings": PUREFTPDAddSettings (), "RBVsPureFTPd" : RBVsftpdPureftpd (), @@ -537,7 +561,7 @@ "perfor_settings" :perfor_settings (), - "anon_settings" : anon_settings (), + "anon_settings" : vsftpd_anon_settings (), "addit_settings" : addit_settings (), Modified: trunk/ftp-server/src/uiforms.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/uiforms.ycp?rev=38... ============================================================================== --- trunk/ftp-server/src/uiforms.ycp (original) +++ trunk/ftp-server/src/uiforms.ycp Tue May 29 17:05:37 2007 @@ -94,6 +94,49 @@ } + + + + + + +term VsftpdAnonSettings() { + term dialog = `VBox ( + `Frame ( _("Enable/Disable Anonymous and Local Users"), + `RadioButtonGroup(`id("AnonAuthen"), + `HBox(`HSpacing(1),`VBox( + `Left(`RadioButton(`id(0), "Anonymo&us Only")), + `Left(`RadioButton(`id(1), "Aut&henticated Users Only", true)), + `Left(`RadioButton(`id(2), "&Both")) + )) + ) //end of `HBox(`HSpacing(1),`RadioButtonGroup(`id("AnonAuthen") + ), //end of `Frame ( _("Enable/Disable Anonymous and Local Users") + `VSpacing(1), + `Frame ( _("Uploading"), + `HBox(`HSpacing(1),`VBox ( + `Left(`CheckBox (`id("EnableUpload"), `opt(`notify), _("&Enable Upload"))), + `HBox(`HSpacing(2),`VBox( + `Left(`CheckBox (`id("AnonReadOnly"), _("Anon&ymous Can Upload"))), + `Left(`CheckBox (`id("AnonCreatDirs"), _("Anonymou&s Can Create Directories"))) + )) + )) + ), //end of `Frame ( _("Anonymous Settings") + `VStretch() + ); + return dialog; +} + + + + + + + + + + + + term FTPAnonSettings() { term dialog = `VBox ( `Frame ( _("Enable/Disable Anonymous and Local Users"), @@ -118,6 +161,11 @@ } + + + + + term VSFTPDAddSettings() { term dialog = `VBox ( `CheckBoxFrame ( `id("PassiveMode"), _("Pass&ive Mode"), true, Modified: trunk/ftp-server/src/wid_functions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/wid_functions.ycp?... ============================================================================== --- trunk/ftp-server/src/wid_functions.ycp (original) +++ trunk/ftp-server/src/wid_functions.ycp Tue May 29 17:05:37 2007 @@ -307,7 +307,7 @@ } /** - * Init function for performance settings + * Init function for anon settings * change ValidChars from textentry */ void InitAnonSettings(string key) { @@ -318,13 +318,19 @@ (FtpServer::ValueUIEdit("AnonReadOnly") == "NO")); UI::ChangeWidget(`id( "AnonCreatDirs" ), `Value, (FtpServer::ValueUIEdit("AnonCreatDirs") == "YES")); - - + if (FtpServer::vsftpd_edit) { + UI::ChangeWidget(`id( "EnableUpload" ), `Value, + (FtpServer::ValueUIEdit("EnableUpload") == "YES")); + if (!((boolean) UI::QueryWidget(`id("EnableUpload"), `Value))) { + UI::ChangeWidget(`id("AnonReadOnly"), `Enabled, false); + UI::ChangeWidget(`id( "AnonCreatDirs" ),`Enabled, false); + } + } } /** - * Store function for performance settings + * Store function for anon settings * save values to temporary structure */ void StoreAnonSettings (string key, map event) { @@ -334,11 +340,35 @@ }); FtpServer::WriteToEditMap("AnonReadOnly", (((boolean) UI::QueryWidget(`id("AnonReadOnly"), `Value) == true) ? "NO":"YES")); - + if (FtpServer::vsftpd_edit) + FtpServer::WriteToEditMap("EnableUpload", (((boolean) UI::QueryWidget(`id("EnableUpload"), `Value) == true) ? "YES":"NO")); +} + +/** + * Handle function for anon settings + * save values to temporary structure + */ + +symbol HandleAnonSettings(string key, map event) { + if (FtpServer::vsftpd_edit) { + any button = event["ID"]:nil; + if (button == "EnableUpload") { + boolean check_upload = (boolean) UI::QueryWidget(`id("EnableUpload"), `Value); + if (check_upload) { + UI::ChangeWidget(`id("AnonReadOnly"), `Enabled, true); + UI::ChangeWidget(`id( "AnonCreatDirs" ),`Enabled, true); + } else { + UI::ChangeWidget(`id("AnonReadOnly"), `Enabled, false); + UI::ChangeWidget(`id( "AnonCreatDirs" ),`Enabled, false); + } + } // end of if (button == "EnableUpload") { + } // end of if (FtpServer::vsftpd_edit) { } + + /** * Init function for pure-ftp-server add settings * change values a display correct widget Modified: trunk/ftp-server/src/write_load.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/write_load.ycp?rev... ============================================================================== --- trunk/ftp-server/src/write_load.ycp (original) +++ trunk/ftp-server/src/write_load.ycp Tue May 29 17:05:37 2007 @@ -703,10 +703,13 @@ if (FtpServer::vsftpd_edit) { if (write) { yes_no = FtpServer::EDIT_SETTINGS["AnonReadOnly"]:nil; - if (yes_no == "YES") + if (yes_no == "YES") { FtpServer::VS_SETTINGS["anon_upload_enable"] = "NO"; - else + FtpServer::VS_SETTINGS["write_enable"] = "NO"; + } else { FtpServer::VS_SETTINGS["anon_upload_enable"] = "YES"; + FtpServer::VS_SETTINGS["write_enable"] = "YES"; + } } else { if (haskey(FtpServer::VS_SETTINGS, "anon_upload_enable")) { yes_no = toupper(FtpServer::VS_SETTINGS["anon_upload_enable"]:nil); @@ -728,7 +731,9 @@ case("AnonCreatDirs"): if (vsftpd_edit) { if (write) { - FtpServer::VS_SETTINGS["anon_mkdir_write_enable"] = EDIT_SETTINGS["AnonCreatDirs"]:nil; + FtpServer::VS_SETTINGS["anon_mkdir_write_enable"] = FtpServer::EDIT_SETTINGS["AnonCreatDirs"]:nil; + if (FtpServer::EDIT_SETTINGS["AnonCreatDirs"]:nil == "YES") + FtpServer::VS_SETTINGS["write_enable"] = "YES"; } else { return ((haskey(FtpServer::VS_SETTINGS, "anon_mkdir_write_enable") ? toupper(FtpServer::VS_SETTINGS["anon_mkdir_write_enable"]:nil) : FtpServer::DEFAULT_CONFIG["AnonCreatDirs"]:nil)); @@ -743,6 +748,25 @@ toupper(FtpServer::PURE_SETTINGS["AnonymousCanCreateDirs"]:nil):FtpServer::DEFAULT_CONFIG["AnonCreatDirs"]:nil)); } break; + //only vsftpd + case("EnableUpload"): + if (FtpServer::vsftpd_edit) { + if (write) { + if (FtpServer::EDIT_SETTINGS["EnableUpload"]:nil != "") + FtpServer::VS_SETTINGS["write_enable"] = FtpServer::EDIT_SETTINGS["EnableUpload"]:nil; + else + FtpServer::VS_SETTINGS["write_enable"] = nil; + } else { + return ((haskey(FtpServer::VS_SETTINGS, "write_enable") ? + FtpServer::VS_SETTINGS["write_enable"]:nil : FtpServer::DEFAULT_CONFIG["EnableUpload"]:nil)); + } + } else { + if (!write) + return FtpServer::DEFAULT_CONFIG["EnableUpload"]:nil; + else + return ""; + } + break; //only vsftpd case("Banner"): -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org