Author: juhliarik Date: Thu Jul 12 11:23:38 2007 New Revision: 39344 URL: http://svn.opensuse.org/viewcvs/yast?rev=39344&view=rev Log: added validate functuion for target saving image Modified: trunk/kdump/src/dialogs.ycp trunk/kdump/src/uifunctions.ycp Modified: trunk/kdump/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/dialogs.ycp?rev=39344&r1=39343&r2=39344&view=diff ============================================================================== --- trunk/kdump/src/dialogs.ycp (original) +++ trunk/kdump/src/dialogs.ycp Thu Jul 12 11:23:38 2007 @@ -176,6 +176,8 @@ ), "init" : InitTargetKdump, "handle" : HandleTargetKdump, + "validate_type" : `function, + "validate_function": ValidTargetKdump, "store" : StoreTargetKdump, "help" : HelpKdump("TargetKdump"), Modified: trunk/kdump/src/uifunctions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/kdump/src/uifunctions.ycp?rev=39344&r1=39343&r2=39344&view=diff ============================================================================== --- trunk/kdump/src/uifunctions.ycp (original) +++ trunk/kdump/src/uifunctions.ycp Thu Jul 12 11:23:38 2007 @@ -414,7 +414,84 @@ } +/** + * Function validates options in + * "Saving Target for kdump Image" + */ + +boolean ValidTargetKdump (string key, map event) { + string radiobut = tostring(UI::QueryWidget(`id ("DumpTarget"), `Value)); + string value = nil; + boolean anon = true; + if (radiobut == "local_filesystem") { + value = tostring(UI::QueryWidget(`id ("dir"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Directory for Saving Dumps\""); + UI::SetFocus(`id("dir")); + return false; + } + } else if (radiobut == "ftp") { + value = tostring(UI::QueryWidget(`id ("server"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Server Name\""); + UI::SetFocus(`id("server")); + return false; + } + value = tostring(UI::QueryWidget(`id ("dir"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Directory on Server\""); + UI::SetFocus(`id("dir")); + return false; + } + anon = (boolean) UI::QueryWidget(`id ("anonymous"), `Value); + if (!anon) { + value = tostring(UI::QueryWidget(`id ("user_name"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"User Name\""); + UI::SetFocus(`id("user_name")); + return false; + } + + } + } else if ((radiobut == "ssh") || (radiobut == "nfs")) { + value = tostring(UI::QueryWidget(`id ("server"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Server Name\""); + UI::SetFocus(`id("server")); + return false; + } + value = tostring(UI::QueryWidget(`id ("dir"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Directory on Server\""); + UI::SetFocus(`id("dir")); + return false; + } + + } else if (radiobut == "cifs") { + value = tostring(UI::QueryWidget(`id ("server"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Server Name\""); + UI::SetFocus(`id("server")); + return false; + } + value = tostring(UI::QueryWidget(`id ("dir"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Directory on Server\""); + UI::SetFocus(`id("dir")); + return false; + } + value = tostring(UI::QueryWidget(`id ("share"), `Value)); + if ((value == nil) || (value == "")) { + Popup::Error("You need specify \"Exported Share\""); + UI::SetFocus(`id("share")); + return false; + } + + } + + return true; +} /** * Function stores option * "Saving Target for kdump Image" -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org