[yast-commit] r40529 - in /trunk/squid/src: Makefile.am Squid.ycp complex.ycp dialogs.ycp handlers.ycp helps.ycp inits.ycp store_del.ycp wizards.ycp
![](https://seccdn.libravatar.org/avatar/63797a3a1edb765c207a8bc1cdc132e5.jpg?s=120&d=mm&r=g)
Author: dfiser Date: Tue Aug 28 12:56:04 2007 New Revision: 40529 URL: http://svn.opensuse.org/viewcvs/yast?rev=40529&view=rev Log: Changed workflow to DialogTree based dialogs. Squid::StartService now uses Service::Restart instead of Service::Reload. Added: trunk/squid/src/handlers.ycp Modified: trunk/squid/src/Makefile.am trunk/squid/src/Squid.ycp trunk/squid/src/complex.ycp trunk/squid/src/dialogs.ycp trunk/squid/src/helps.ycp trunk/squid/src/inits.ycp trunk/squid/src/store_del.ycp trunk/squid/src/wizards.ycp Modified: trunk/squid/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Makefile.am?rev=40529&r... ============================================================================== --- trunk/squid/src/Makefile.am (original) +++ trunk/squid/src/Makefile.am Tue Aug 28 12:56:04 2007 @@ -15,7 +15,8 @@ inits.ycp \ store_del.ycp \ SquidACL_local_functions.ycp \ - helper_functions.ycp + helper_functions.ycp \ + handlers.ycp desktop_DATA = \ squid.desktop Modified: trunk/squid/src/Squid.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Squid.ycp?rev=40529&r1=... ============================================================================== --- trunk/squid/src/Squid.ycp (original) +++ trunk/squid/src/Squid.ycp Tue Aug 28 12:56:04 2007 @@ -1205,7 +1205,7 @@ Report::Error(Message::CannotStartService("squid")); } }else{ - if (!Service::Reload("squid")){ + if (!Service::Restart("squid")){ ok = false; Report::Error(Message::CannotRestartService("squid")); } Modified: trunk/squid/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/complex.ycp?rev=40529&r... ============================================================================== --- trunk/squid/src/complex.ycp (original) +++ trunk/squid/src/complex.ycp Tue Aug 28 12:56:04 2007 @@ -31,17 +31,17 @@ textdomain "squid"; -import "Popup"; import "Wizard"; -import "Wizard_hw"; import "Confirm"; - +import "DialogTree"; +import "CWMServiceStart"; import "Squid"; -import "SquidACL"; -import "SquidErrorMessages"; - include "squid/helps.ycp"; +include "squid/dialogs.ycp"; +include "squid/handlers.ycp"; +include "squid/store_del.ycp"; +include "squid/inits.ycp"; @@ -78,7 +78,193 @@ } +void SaveAndRestart() +{ + Wizard::CreateDialog(); + WriteDialog(); + UI::CloseDialog(); +} + +string main_caption = _("Squid"); + +map<string, map<string, any> > widget_descr = $[ + "start_stop" : CWMServiceStart::CreateStartStopWidget ($[ + "service_id" : "squid", + "service_running_label" : _("Squid is running"), + "service_not_running_label" : _("Squid is not running"), + "start_now_button" : _("&Start Squid Now"), + "stop_now_button" : _("S&top Squid Now"), + "save_now_action" : SaveAndRestart, + "save_now_button" : _("Sa&ve Settings and Restart Firewall Now"), + //"start_now_action" : uses the default function + //"stop_now_action" : uses the default function + "help" : sformat (CWMServiceStart::StartStopHelpTemplate (true), + // TRANSLATORS: part of help text - push button label, NO SHORTCUT!!! + _("Start Squid Now"), + // TRANSLATORS: part of help text - push button label, NO SHORTCUT!!! + _("Stop Squid Now"), + // TRANSLATORS: part of help text - push button label, NO SHORTCUT!!! + _("Save Settings and Restart Squid Now") + ) + ]), + + "http_ports_table" : $[ + "widget" : `custom, + "custom_widget" : HttpPortsTableWidget(), + "init" : InitHttpPortsTable, + "handle" : HandleHttpPortsTable, + "help" : HELPS["http_ports"]:"" + ], + + "refresh_patterns_table" : $[ + "widget" : `custom, + "custom_widget" : RefreshPatternsTableWidget(), + "init" : InitRefreshPatternsTable, + "handle" : HandleRefreshPatternsTable, + "help" : HELPS["cache"]:"" + ], + + "cache2_dialog" : $[ + "widget" : `custom, + "custom_widget" : Cache2DialogWidget(), + "init" : InitCache2Dialog, + "handle" : HandleCache2Dialog, + "store" : StoreDataFromCache2Dialog, + "validate_type" : `function, + "validate_function" : ValidateCache2Dialog, + "help" : HELPS["cache2"]:"" + ], + + "acl_groups_table" : $[ + "widget" : `custom, + "custom_widget" : ACLGroupsTableWidget(), + "init" : InitACLGroupsTable, + "handle" : HandleAccessControlDialog, + "help" : HELPS["acl_groups"]:"" + ], + "http_access_table" : $[ + "widget" : `custom, + "custom_widget" : HttpAccessTableWidget(), + "init" : InitHttpAccessTable, + "help" : HELPS["http_access"]:"" + ], + + "logging_frame" : $[ + "widget" : `custom, + "custom_widget" : LoggingFrameWidget(), + "init" : InitLoggingFrame, + "handle" : HandleLoggingFrame, + "store" : StoreDataFromLoggingFrame, + "validate_type" : `function, + "validate_function" : ValidateLoggingFrame, + "help" : HELPS["logging"]:"" + ], + "timeouts_frame" : $[ + "widget" : `custom, + "custom_widget" : TimeoutsFrameWidget(), + "init" : InitTimeoutsFrame, + "help" : HELPS["timeouts"]:"" + ], + + "miscellaneous_frame" : $[ + "widget" : `custom, + "custom_widget" : MiscellaneousFrameWidget(), + "init" : InitMiscellaneousFrame, + "store" : StoreDataFromMiscellaneousFrame, + "validate_type" : `function, + "validate_function" : ValidateMiscellaneousFrame, + "help" : HELPS["miscellaneous"]:"" + ] + ]; + +map<string, map<string, any> > screens = $[ + "s1" : $[ + "widget_names" : ["start_stop"], + "contents" : `HBox( + `HSpacing(3), + "start_stop", + `HSpacing(3) + ), + "caption" : main_caption + ": " + _("Start-Up"), + "tree_item_label" : _("Start-Up") + ], + + "s2" : $[ + "widget_names" : ["http_ports_table"], + "contents" : `VBox("http_ports_table"), + "caption" : main_caption + ": " + _("HTTP Ports Setting"), + "tree_item_label" : _("HTTP Ports") + ], + + "s3" : $[ + "widget_names" : ["refresh_patterns_table"], + "contents" : `VBox("refresh_patterns_table"), + "caption" : main_caption + ": " + _("Refresh Patterns Setting"), + "tree_item_label" : _("Refresh Patterns") + ], + + "s4" : $[ + "widget_names" : ["cache2_dialog"], + "contents" : `VCenter("cache2_dialog"), + "caption" : main_caption + ": " + _("Cache Setting"), + "tree_item_label" : _("Cache Setting") + ], + + "s5" : $[ + "widget_names" : ["acl_groups_table", "http_access_table"], + "contents" : `VBox( + "acl_groups_table", + `VSpacing(), + "http_access_table" + ), + "caption" : main_caption + ": " + _("Access Control Setting"), + "tree_item_label" : _("Access Control") + ], + + "s6" : $[ + "widget_names" : ["logging_frame", "timeouts_frame"], + "contents" : `HBox(`HSpacing(3), + `VBox( + "logging_frame", + `VSpacing(), + "timeouts_frame" + ), + `HSpacing(3)), + "caption" : main_caption + ": " + _("Logging and Timeouts Setting"), + "tree_item_label" : _("Logging and Timeouts") + ], + + "s7" : $[ + "widget_names" : ["miscellaneous_frame"], + "contents" : `VBox("miscellaneous_frame"), + "caption" : main_caption + ": " + _("Miscellaneous Setting"), + "tree_item_label" : _("Miscellaneous") + ] + ]; + +list<string> ids_order = ["s1", "s2", "s3", "s4", "s5", "s6", "s7"]; +string initial_screen = "s1"; + +any MainDialog(boolean start_up_dialog) +{ + if (!start_up_dialog){ + ids_order = remove(ids_order, 0); + initial_screen = "s2"; + } + + return DialogTree::ShowAndRun($[ + "ids_order" : ids_order, + "initial_screen" : initial_screen, + "widget_descr" : widget_descr, + "screens" : screens, + "functions" : $[`abort : ReallyAbort], + "back_button" : Label::BackButton(), + "next_button" : Label::FinishButton(), + "abort_button" : Label::AbortButton() + ]); +} + } /* vim: set sw=4 ts=4 et ft=ycp : */ Modified: trunk/squid/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=40529&r... ============================================================================== --- trunk/squid/src/dialogs.ycp (original) +++ trunk/squid/src/dialogs.ycp Tue Aug 28 12:56:04 2007 @@ -32,83 +32,27 @@ textdomain "squid"; import "Label"; -import "Wizard"; -import "SquidACL"; -include "squid/helps.ycp"; -include "squid/popup_dialogs.ycp"; -include "squid/inits.ycp"; -include "squid/store_del.ycp"; +include "squid/helper_functions.ycp"; -boolean reallyAbort() +term HttpPortsTableWidget() { - if (!Squid::GetModified()) - return true; - if (Popup::ReallyAbort(true)) - return true; - return false; -} - - -any HttpPortsDialog(){ - any ret = nil; - any http_port = nil; - any tmp = nil; - integer id_item = nil; - - term dialog_contents = - `VBox( - `Left(`Label( _("HTTP Ports"))), - `Table(`id("http_port"), `opt(`notify), `header(_("Host"), _("Port"), _("Options"))), - `HBox( - `PushButton(`id(`add), Label::AddButton()), - `PushButton(`id(`del), Label::DeleteButton()), - `PushButton(`id(`edit), Label::EditButton()), - `HStretch() - ) - ); - - Wizard::SetContentsButtons(_("Squid - HTTP Ports Setting"), dialog_contents, HELPS["http_ports"]:"", - Label::BackButton(), Label::NextButton()); - Wizard::DisableBackButton(); - - InitHttpPortsTable(); - - while (true){ - ret = UI::UserInput(); - - y2debug("HttpPortsDialog(): ret == %1",ret); - - if (ret == `next) break; - else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - }else if (ret == `add){ - if (AddEditHttpPortDialog(nil)) - InitHttpPortsTable(); - }else if (ret == `edit || ret == "http_port"){ - id_item = (integer)UI::QueryWidget(`id("http_port"), `CurrentItem); - if (AddEditHttpPortDialog(id_item)){ - InitHttpPortsTable(); - UI::ChangeWidget(`id("http_port"), `CurrentItem, id_item); - } - }else if (ret == `del){ - id_item = DelFromHttpPortsTable((integer)UI::QueryWidget(`id("http_port"), `CurrentItem)); - InitHttpPortsTable(); - UI::ChangeWidget(`id("http_port"), `CurrentItem, id_item); - } - } - - return ret; + return `VBox( + `Left(`Label( _("HTTP Ports"))), + `Table(`id("http_port"), `opt(`notify), `header(_("Host"), _("Port"), _("Options"))), + `HBox( + `PushButton(`id(`add), Label::AddButton()), + `PushButton(`id(`del), Label::DeleteButton()), + `PushButton(`id(`edit), Label::EditButton()), + `HStretch() + ) + ); } - - -any CacheDialog(){ - any ret = nil; - integer id_item = 0; - term dialog_contents = +term RefreshPatternsTableWidget() +{ + return `VBox( `Left(`Label( _("Refresh Patterns"))), `HBox( @@ -126,61 +70,12 @@ `HStretch() ) ); - - Wizard::SetContentsButtons(_("Squid - Cache Setting"), dialog_contents, HELPS["cache"]:"", - Label::BackButton(), Label::NextButton()); - - InitRefreshPatternsTable(); - - while (true){ - ret = UI::UserInput(); - - y2debug("CacheDialog(): ret == %1",ret); - - if (ret == `next || ret == `back) break; - else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - }else if (ret == `add){ - if (AddEditRefreshPatternDialog(nil)) - InitRefreshPatternsTable(); - }else if (ret == `edit || ret == "refresh_patterns"){ - id_item = (integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem); - if (AddEditRefreshPatternDialog(id_item)){ - InitRefreshPatternsTable(); - UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); - } - }else if (ret == `del){ - id_item = DelFromRefreshPatternsTable((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); - InitRefreshPatternsTable(); - UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); - }else if (ret == `up){ - id_item = MoveUpRefreshPattern((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); - if (id_item != nil){ - InitRefreshPatternsTable(); - UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); - } - }else if (ret == `down){ - id_item = MoveDownRefreshPattern((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); - if (id_item != nil){ - InitRefreshPatternsTable(); - UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); - } - } - } - - return ret; } - -any Cache2Dialog(){ - any ret = nil; - string cache_dir = ""; - any tmp = nil; - any tmp2 = nil; - - term dialog_contents = - `VCenter( `HBox( +term Cache2DialogWidget() +{ + return + `HBox( `HSpacing(3), `VBox( `VWeight(1, `Frame(_("Cache Setting"), @@ -244,79 +139,14 @@ )) ), `HSpacing(3) - )); - - Wizard::SetContentsButtons("Squid - Cache Setting 2", dialog_contents, HELPS["cache2"]:"", - Label::BackButton(), Label::NextButton()); - - UI::ChangeWidget(`id("cache_max_object_size"), `Notify, true); - UI::ChangeWidget(`id("cache_min_object_size"), `Notify, true); - UI::ChangeWidget(`id("cache_max_object_size_units"), `Notify, true); - UI::ChangeWidget(`id("cache_min_object_size_units"), `Notify, true); - - UI::ChangeWidget(`id("cache_swap_low"), `Notify, true); - UI::ChangeWidget(`id("cache_swap_high"), `Notify, true); - - InitCache2Dialog(); - - while (true){ - ret = UI::UserInput(); - - y2debug("Cache2Dialog(): ret == %1",ret); - - if (ret == `next || ret == `back){ - if (StoreDataFromCache2Dialog()) - break; - }else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - }else if (ret == `browse_cache_dir){ - cache_dir = UI::AskForExistingDirectory((string)UI::QueryWidget(`id("cache_dir"), `Value), "Cache Directory"); - if (cache_dir != nil){ - UI::ChangeWidget(`id("cache_dir"), `Value, cache_dir); - } - - //cache_min_object_size <= cache_max_object_size - }else if (ret == "cache_min_object_size" || ret == "cache_min_object_size_units"){ - tmp = (integer)UI::QueryWidget(`id("cache_min_object_size"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); - tmp2 = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); - if ((integer)tmp > (integer)tmp2){ - UI::ChangeWidget(`id("cache_max_object_size"), `Value, UI::QueryWidget(`id("cache_min_object_size"), `Value)); - UI::ChangeWidget(`id("cache_max_object_size_units"), `Value, UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); - } - }else if (ret == "cache_max_object_size" || ret == "cache_max_object_size_units"){ - tmp = (integer)UI::QueryWidget(`id("cache_min_object_size"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); - tmp2 = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); - if ((integer)tmp > (integer)tmp2){ - UI::ChangeWidget(`id("cache_min_object_size"), `Value, UI::QueryWidget(`id("cache_max_object_size"), `Value)); - UI::ChangeWidget(`id("cache_min_object_size_units"), `Value, UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); - } - - //cache_swap_low <= cache_swap_high - }else if (ret == "cache_swap_low"){ - tmp = UI::QueryWidget(`id("cache_swap_low"), `Value); - if ((integer)tmp > (integer)UI::QueryWidget(`id("cache_swap_high"), `Value)) - UI::ChangeWidget(`id("cache_swap_high"), `Value, tmp); - }else if (ret == "cache_swap_high"){ - tmp = UI::QueryWidget(`id("cache_swap_high"), `Value); - if ((integer)UI::QueryWidget(`id("cache_swap_low"), `Value) > (integer)tmp) - UI::ChangeWidget(`id("cache_swap_low"), `Value, tmp); - } - } - - return ret; + ); } -any AccessControlDialog(){ - any ret = nil; - integer id_item = nil; - term dialog_contents = +term ACLGroupsTableWidget() +{ + return `VBox( `Left(`Label(_("ACL Groups"))), `Table(`id("acl"), `opt(`notify), `header(_("Name"), _("Type"), _("Description"))), @@ -325,10 +155,14 @@ `PushButton(`id(`del_acl), Label::DeleteButton()), `PushButton(`id(`edit_acl), Label::EditButton()), `HStretch() - ), - - `VSpacing(), + ) + ); +} +term HttpAccessTableWidget() +{ + return + `VBox( `Left(`Label(_("Access Control"))), `HBox( `Table(`id("http_access"), `opt(`keepSorting, `notify), `header(_("Allow/Deny"), _("ACL Groups"))), @@ -344,77 +178,11 @@ `HStretch() ) ); - - Wizard::SetContentsButtons(_("Squid - Access Control Setting"), dialog_contents, HELPS["access_control"]:"", - Label::BackButton(), Label::NextButton()); - - InitACLGroupsTable(); - InitHttpAccessTable(); - - while (true){ - ret = UI::UserInput(); - - y2debug("BaseDialog(): ret == %1",ret); - - if (ret == `next || ret == `back) break; - else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - }else if (ret == `add_acl){ - if (AddEditACLDialog(nil)){ - InitACLGroupsTable(); - } - }else if (ret == `edit_acl || ret == "acl"){ - id_item = (integer)UI::QueryWidget(`id("acl"), `CurrentItem); - if (AddEditACLDialog(id_item)){ - InitACLGroupsTable(); - UI::ChangeWidget(`id("acl"), `CurrentItem, id_item); - } - }else if (ret == `del_acl){ - id_item = DelFromACLGroupsTable((integer)UI::QueryWidget(`id("acl"), `CurrentItem)); - InitACLGroupsTable(); - UI::ChangeWidget(`id("acl"), `CurrentItem, id_item); - - }else if (ret == `add_http_access){ - if (AddEditHttpAccessDialog(nil)){ - InitHttpAccessTable(); - } - }else if (ret == `edit_http_access || ret == "http_access"){ - id_item = (integer)UI::QueryWidget(`id("http_access"), `CurrentItem); - if (AddEditHttpAccessDialog(id_item)){ - InitHttpAccessTable(); - UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); - } - }else if (ret == `del_http_access){ - id_item = DelFromHttpAccessTable((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); - InitHttpAccessTable(); - UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); - }else if (ret == `up_http_access){ - id_item = MoveUpHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); - if (id_item != nil){ - InitHttpAccessTable(); - UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); - } - }else if (ret == `down_http_access){ - id_item = MoveDownHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); - if (id_item != nil){ - InitHttpAccessTable(); - UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); - } - } - } - - return ret; } - - -any LoggingAndTimeoutsDialog() +term LoggingFrameWidget() { - any ret = nil; - string tmp = nil; - term dialog_contents = - `HBox(`HSpacing(3), `VBox( + return `Frame(_("Logging"), `VBox( `VSquash(`HBox( @@ -431,10 +199,12 @@ )), `Left(`CheckBox(`id("emulate_httpd_log"), _("Emulate Httpd Log?"))) ) - ), - - `VSpacing(), + ); +} +term TimeoutsFrameWidget() +{ + return `Frame(_("Timeouts"), `VBox( `HBox( @@ -446,49 +216,13 @@ timeUnitWidget("client_lifetime_units") ) ) - ) - ), `HSpacing(3)); - - Wizard::SetContentsButtons("Squid - Logging and Timeouts Setting", dialog_contents, HELPS["logging_timeouts"]:"", - Label::BackButton(), Label::NextButton()); - - InitLoggingFrame(); - InitTimeoutsFrame(); - - while (true){ - ret = UI::UserInput(); - - y2debug("BaseDialog(): ret == %1",ret); - - if (ret == `next || ret == `back){ - if(StoreDataFromLoggingFrame() && StoreDataFromTimeoutsFrame()) - break; - }else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - }else if (ret == `access_log_browse){ - tmp = UI::AskForExistingFile("/var/log", "*", "Access Log"); - if (tmp != nil) - UI::ChangeWidget(`id("access_log"), `Value, tmp); - }else if (ret == `cache_log_browse){ - tmp = UI::AskForExistingFile("/var/log", "*", "Cache Log"); - if (tmp != nil) - UI::ChangeWidget(`id("cache_log"), `Value, tmp); - }else if (ret == `cache_store_log_browse){ - tmp = UI::AskForExistingFile("/var/log", "*", "Cache Store Log"); - if (tmp != nil) - UI::ChangeWidget(`id("cache_store_log"), `Value, tmp); - } - } - - return ret; + ); } -any MiscellaneousDialog() +term MiscellaneousFrameWidget() { - any ret = nil; - term dialog_contents = + return `HVCenter(`Frame(_("Miscellaneous Setting"), `VBox( `ComboBox(`id("error_language"), _("Language of error messages"), @@ -498,28 +232,8 @@ `VSpacing(), `CheckBox(`id("ftp_passive"), _("Use Ftp Pasive Mode")) ))); - - Wizard::SetContentsButtons("Squid - Miscellaneous Setting", dialog_contents, HELPS["miscellaneous"]:"", - Label::BackButton(), Label::FinishButton()); - - InitMiscellaneousDialog(); - - while (true){ - ret = UI::UserInput(); - - y2debug("BaseDialog(): ret == %1",ret); - - if (ret == `next || ret == `back){ - if (StoreDataFromMiscellaneousDialog()) - break; - }else if (ret == `abort || ret == `cancel){ - if (reallyAbort()) break; - continue; - } - } - - return ret; } + /* EOF */ } /* vim: set sw=4 ts=4 et ft=ycp : */ Added: trunk/squid/src/handlers.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/handlers.ycp?rev=40529&... ============================================================================== --- trunk/squid/src/handlers.ycp (added) +++ trunk/squid/src/handlers.ycp Tue Aug 28 12:56:04 2007 @@ -0,0 +1,231 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may find + * current contact information at www.novell.com. + * ------------------------------------------------------------------------------ + */ + +/** + * File: include/squid/handlers.ycp + * Package: Configuration of squid + * Summary: Handle functions to CWM + * Authors: Daniel Fiser <dfiser@suse.cz> + * + * $Id: wizards.ycp 27914 2006-02-13 14:32:08Z locilka $ + */ + +{ + +textdomain "squid"; + +include "squid/inits.ycp"; +include "squid/store_del.ycp"; +include "squid/dialogs.ycp"; +include "squid/popup_dialogs.ycp"; + +symbol HandleHttpPortsTable(string widget_id, map event_map) +{ + any ui = event_map["ID"]:nil; + integer id_item = nil; + + y2debug("HandleHttpPortsTable: widget_id: %1, event_map: %2", widget_id, event_map); + + if (ui == `add){ + if (AddEditHttpPortDialog(nil)) + InitHttpPortsTable(""); + }else if (ui == `edit || ui == "http_port"){ + id_item = (integer)UI::QueryWidget(`id("http_port"), `CurrentItem); + if (AddEditHttpPortDialog(id_item)){ + InitHttpPortsTable(""); + UI::ChangeWidget(`id("http_port"), `CurrentItem, id_item); + } + }else if (ui == `del){ + id_item = DelFromHttpPortsTable((integer)UI::QueryWidget(`id("http_port"), `CurrentItem)); + InitHttpPortsTable(""); + UI::ChangeWidget(`id("http_port"), `CurrentItem, id_item); + }else{ + return (symbol)ui; + } + + return nil; +} + + +symbol HandleRefreshPatternsTable(string widget_id, map event_map) +{ + any ui = event_map["ID"]:nil; + integer id_item = nil; + + if (ui == `add){ + if (AddEditRefreshPatternDialog(nil)) + InitRefreshPatternsTable(""); + }else if (ui == `edit || ui == "refresh_patterns"){ + id_item = (integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem); + if (AddEditRefreshPatternDialog(id_item)){ + InitRefreshPatternsTable(""); + UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); + } + }else if (ui == `del){ + id_item = DelFromRefreshPatternsTable((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); + InitRefreshPatternsTable(""); + UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); + }else if (ui == `up){ + id_item = MoveUpRefreshPattern((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); + if (id_item != nil){ + InitRefreshPatternsTable(""); + UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); + } + }else if (ui == `down){ + id_item = MoveDownRefreshPattern((integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem)); + if (id_item != nil){ + InitRefreshPatternsTable(""); + UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); + } + }else{ + return (symbol)ui; + } + + return nil; +} + + +symbol HandleCache2Dialog(string widget_id, map event_map) +{ + any ui = event_map["ID"]:nil; + string cache_dir = ""; + any tmp = nil; + any tmp2 = nil; + + if (ui == `browse_cache_dir){ + cache_dir = UI::AskForExistingDirectory((string)UI::QueryWidget(`id("cache_dir"), `Value), "Cache Directory"); + if (cache_dir != nil){ + UI::ChangeWidget(`id("cache_dir"), `Value, cache_dir); + } + + //cache_min_object_size <= cache_max_object_size + }else if (ui == "cache_min_object_size" || ui == "cache_min_object_size_units"){ + tmp = (integer)UI::QueryWidget(`id("cache_min_object_size"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); + tmp2 = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); + if ((integer)tmp > (integer)tmp2){ + UI::ChangeWidget(`id("cache_max_object_size"), `Value, UI::QueryWidget(`id("cache_min_object_size"), `Value)); + UI::ChangeWidget(`id("cache_max_object_size_units"), `Value, UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); + } + }else if (ui == "cache_max_object_size" || ui == "cache_max_object_size_units"){ + tmp = (integer)UI::QueryWidget(`id("cache_min_object_size"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_min_object_size_units"), `Value)); + tmp2 = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); + if ((integer)tmp > (integer)tmp2){ + UI::ChangeWidget(`id("cache_min_object_size"), `Value, UI::QueryWidget(`id("cache_max_object_size"), `Value)); + UI::ChangeWidget(`id("cache_min_object_size_units"), `Value, UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); + } + + //cache_swap_low <= cache_swap_high + }else if (ui == "cache_swap_low"){ + tmp = UI::QueryWidget(`id("cache_swap_low"), `Value); + if ((integer)tmp > (integer)UI::QueryWidget(`id("cache_swap_high"), `Value)) + UI::ChangeWidget(`id("cache_swap_high"), `Value, tmp); + }else if (ui == "cache_swap_high"){ + tmp = UI::QueryWidget(`id("cache_swap_high"), `Value); + if ((integer)UI::QueryWidget(`id("cache_swap_low"), `Value) > (integer)tmp) + UI::ChangeWidget(`id("cache_swap_low"), `Value, tmp); + }else{ + return (symbol)ui; + } + + return nil; +} + +symbol HandleAccessControlDialog(string widget_id, map event_map) +{ + any ui = event_map["ID"]:nil; + integer id_item = nil; + + if (ui == `add_acl){ + if (AddEditACLDialog(nil)){ + InitACLGroupsTable(""); + } + }else if (ui == `edit_acl || ui == "acl"){ + id_item = (integer)UI::QueryWidget(`id("acl"), `CurrentItem); + if (AddEditACLDialog(id_item)){ + InitACLGroupsTable(""); + UI::ChangeWidget(`id("acl"), `CurrentItem, id_item); + } + }else if (ui == `del_acl){ + id_item = DelFromACLGroupsTable((integer)UI::QueryWidget(`id("acl"), `CurrentItem)); + InitACLGroupsTable(""); + UI::ChangeWidget(`id("acl"), `CurrentItem, id_item); + }else if (ui == `add_http_access){ + if (AddEditHttpAccessDialog(nil)){ + InitHttpAccessTable(""); + } + }else if (ui == `edit_http_access || ui == "http_access"){ + id_item = (integer)UI::QueryWidget(`id("http_access"), `CurrentItem); + if (AddEditHttpAccessDialog(id_item)){ + InitHttpAccessTable(""); + UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); + } + }else if (ui == `del_http_access){ + id_item = DelFromHttpAccessTable((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); + InitHttpAccessTable(""); + UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); + }else if (ui == `up_http_access){ + id_item = MoveUpHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); + if (id_item != nil){ + InitHttpAccessTable(""); + UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); + } + }else if (ui == `down_http_access){ + id_item = MoveDownHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem)); + if (id_item != nil){ + InitHttpAccessTable(""); + UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); + } + }else{ + return (symbol)ui; + } + + return nil; +} + + +symbol HandleLoggingFrame(string widget_id, map event_map) +{ + any ui = event_map["ID"]:nil; + string tmp = nil; + + if (ui == `access_log_browse){ + tmp = UI::AskForExistingFile("/var/log", "*", "Access Log"); + if (tmp != nil) + UI::ChangeWidget(`id("access_log"), `Value, tmp); + }else if (ui == `cache_log_browse){ + tmp = UI::AskForExistingFile("/var/log", "*", "Cache Log"); + if (tmp != nil) + UI::ChangeWidget(`id("cache_log"), `Value, tmp); + }else if (ui == `cache_store_log_browse){ + tmp = UI::AskForExistingFile("/var/log", "*", "Cache Store Log"); + if (tmp != nil) + UI::ChangeWidget(`id("cache_store_log"), `Value, tmp); + }else{ + return (symbol)ui; + } + + return nil; +} + +} Modified: trunk/squid/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/helps.ycp?rev=40529&r1=... ============================================================================== --- trunk/squid/src/helps.ycp (original) +++ trunk/squid/src/helps.ycp Tue Aug 28 12:56:04 2007 @@ -129,11 +129,12 @@ </p>"), - /* Access Control Dialog */ - "access_control" : + /* ACL Groups */ + "acl_groups" : _("<p>Access to Squid server can be controlled via <b>ACL Groups</b>.</p>") + _("<p><b>ACL Group</b> has various types and description of ACL Group depends -on them.</p>") + +on them.</p>"), + "http_access" : _("<p>In <b>Access Control</b> table can be denied or allowed ACL Groups. If there is more ACL Groups in one line it means that access will be allowed or denied for those who are from all ACL Groups at the same time.</p>") + @@ -142,7 +143,7 @@ /* Logging and Timeouts Dialog */ - "logging_timeouts" : + "logging" : _("<p><b>Access Log</b> defines the file where client activities are logged.</p>") + _("<p><b>Cache Log</b> defines the file where general informations about your cache's behavior is logged.</p>") + @@ -150,7 +151,8 @@ objects that are stored in the object store, as well as the time when the object get deleted. This option can be leaved empty.</p>") + _("<p><b>Emulate Httpd Log</b> allows you to specify that Squid write its -<b>Access Log</b> in HTTPD common log file format.</p>") + +<b>Access Log</b> in HTTPD common log file format.</p>"), + "timeouts" : _("<p><b>Connection Timeout</b> is an option to force Squid to close connections after a specified time.</p>") + _("<p><b>Client Lifetime</b> defines the maximum amount of time that a client Modified: trunk/squid/src/inits.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/inits.ycp?rev=40529&r1=... ============================================================================== --- trunk/squid/src/inits.ycp (original) +++ trunk/squid/src/inits.ycp Tue Aug 28 12:56:04 2007 @@ -60,7 +60,7 @@ /******************** HTTP_PORT *****************/ -void InitHttpPortsTable() +void InitHttpPortsTable(string key) { list items = []; integer i = 0; @@ -97,7 +97,7 @@ /***************** REFRESH_PATTERNS *************/ -void InitRefreshPatternsTable() +void InitRefreshPatternsTable(string key) { list items = []; integer i = 0; @@ -142,7 +142,7 @@ /***************** CACHE DIALOG *****************/ -void InitCache2Dialog() +void InitCache2Dialog(string key) { map<string, list> set = (map<string, list>)Squid::GetSettings(); simpleInit($[ @@ -161,12 +161,19 @@ "l1dirs" : tointeger((set["cache_dir"]:[])[3]:""), "l2dirs" : tointeger((set["cache_dir"]:[])[4]:"") ]); + UI::ChangeWidget(`id("cache_max_object_size"), `Notify, true); + UI::ChangeWidget(`id("cache_min_object_size"), `Notify, true); + UI::ChangeWidget(`id("cache_max_object_size_units"), `Notify, true); + UI::ChangeWidget(`id("cache_min_object_size_units"), `Notify, true); + + UI::ChangeWidget(`id("cache_swap_low"), `Notify, true); + UI::ChangeWidget(`id("cache_swap_high"), `Notify, true); } /***************** CACHE DIALOG END *************/ /***************** ACL **************************/ -void InitACLGroupsTable() +void InitACLGroupsTable(string key) { list items = []; integer i = 0; @@ -205,7 +212,7 @@ /***************** HTTP_ACCESS ******************/ -void InitHttpAccessTable() +void InitHttpAccessTable(string key) { list items = []; integer i = 0; @@ -272,7 +279,7 @@ /********** LOGGING AND TIMETOUS DIALOG *********/ -void InitLoggingFrame() +void InitLoggingFrame(string key) { map<string, list> set = (map<string, list>)Squid::GetSettings(); simpleInit($[ @@ -284,7 +291,7 @@ ]); } -void InitTimeoutsFrame() +void InitTimeoutsFrame(string key) { map<string, list> set = (map<string, list>)Squid::GetSettings(); simpleInit($[ @@ -297,7 +304,7 @@ /********** LOGGING AND TIMETOUS DIALOG END *****/ -void InitMiscellaneousDialog() +void InitMiscellaneousFrame(string key) { simpleInit($[ "cache_mgr" : (Squid::GetSetting("cache_mgr"))[0]:"", Modified: trunk/squid/src/store_del.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/store_del.ycp?rev=40529... ============================================================================== --- trunk/squid/src/store_del.ycp (original) +++ trunk/squid/src/store_del.ycp Tue Aug 28 12:56:04 2007 @@ -41,8 +41,6 @@ import "SquidACL"; import "SquidErrorMessages"; - -include "squid/helps.ycp"; include "squid/helper_functions.ycp"; /***************** HTTP_PORT ********************/ @@ -155,51 +153,55 @@ /************** CACHE DIALOG ********************/ -boolean StoreDataFromCache2Dialog() +boolean ValidateCache2Dialog(string widget_id, map event) { boolean ok = true; - list squid_cache_dir = Squid::GetSetting("cache_dir"); - string cache_dir = (string)UI::QueryWidget(`id("cache_dir"), `Value); - if (size(cache_dir) == 0){ - ok = false; - Report::Error(_("Cache directory must not be empty.")); - }else if (!FileUtils::CheckAndCreatePath(cache_dir)){ - ok = false; - }else{ - integer cache_mem = (integer)UI::QueryWidget(`id("cache_mem"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_mem_units"), `Value)); - integer cache_dir_mbytes = (integer)UI::QueryWidget(`id("mbytes"), `Value) * 1024 * 1024; - integer max_obj_size = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * - unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); + if (event["ID"]:nil != `abort){ + string cache_dir = (string)UI::QueryWidget(`id("cache_dir"), `Value); - if (max_obj_size > cache_mem + cache_dir_mbytes){ + if (size(cache_dir) == 0){ ok = false; - Report::Error( _("Cache Memory + Size of Cache Directory\nmust be more than Max Object Size.")); - } - } + Report::Error(_("Cache directory must not be empty.")); + }else if (!FileUtils::CheckAndCreatePath(cache_dir)){ + ok = false; + }else{ + integer cache_mem = (integer)UI::QueryWidget(`id("cache_mem"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_mem_units"), `Value)); + integer cache_dir_mbytes = (integer)UI::QueryWidget(`id("mbytes"), `Value) * 1024 * 1024; + integer max_obj_size = (integer)UI::QueryWidget(`id("cache_max_object_size"), `Value) * + unitToMultiple((string)UI::QueryWidget(`id("cache_max_object_size_units"), `Value)); - if (ok){ - Squid::SetSetting("cache_dir", - [squid_cache_dir[0]:"", - cache_dir, - tostring(UI::QueryWidget(`id("mbytes"), `Value)), - tostring(UI::QueryWidget(`id("l1dirs"), `Value)), - tostring(UI::QueryWidget(`id("l2dirs"), `Value))]); - Squid::SetSetting("cache_mem", [tostring(UI::QueryWidget(`id("cache_mem"), `Value)), - UI::QueryWidget(`id("cache_mem_units"), `Value)]); - Squid::SetSetting("maximum_object_size", [tostring(UI::QueryWidget(`id("cache_max_object_size"), `Value)), - UI::QueryWidget(`id("cache_max_object_size_units"), `Value)]); - Squid::SetSetting("minimum_object_size", [tostring(UI::QueryWidget(`id("cache_min_object_size"), `Value)), - UI::QueryWidget(`id("cache_min_object_size_units"), `Value)]); - Squid::SetSetting("cache_swap_low", [tostring(UI::QueryWidget(`id("cache_swap_low"), `Value))]); - Squid::SetSetting("cache_swap_high", [tostring(UI::QueryWidget(`id("cache_swap_high"), `Value))]); - Squid::SetSetting("cache_replacement_policy", [UI::QueryWidget(`id("cache_replacement_policy"), `Value)]); - Squid::SetSetting("memory_replacement_policy", [UI::QueryWidget(`id("memory_replacement_policy"), `Value)]); + if (max_obj_size > cache_mem + cache_dir_mbytes){ + ok = false; + Report::Error( _("Cache Memory + Size of Cache Directory\nmust be more than Max Object Size.")); + } + } } return ok; } +void StoreDataFromCache2Dialog(string widget_id, map event) +{ + list squid_cache_dir = Squid::GetSetting("cache_dir"); + + Squid::SetSetting("cache_dir", + [squid_cache_dir[0]:"", + (string)UI::QueryWidget(`id("cache_dir"), `Value), + tostring(UI::QueryWidget(`id("mbytes"), `Value)), + tostring(UI::QueryWidget(`id("l1dirs"), `Value)), + tostring(UI::QueryWidget(`id("l2dirs"), `Value))]); + Squid::SetSetting("cache_mem", [tostring(UI::QueryWidget(`id("cache_mem"), `Value)), + UI::QueryWidget(`id("cache_mem_units"), `Value)]); + Squid::SetSetting("maximum_object_size", [tostring(UI::QueryWidget(`id("cache_max_object_size"), `Value)), + UI::QueryWidget(`id("cache_max_object_size_units"), `Value)]); + Squid::SetSetting("minimum_object_size", [tostring(UI::QueryWidget(`id("cache_min_object_size"), `Value)), + UI::QueryWidget(`id("cache_min_object_size_units"), `Value)]); + Squid::SetSetting("cache_swap_low", [tostring(UI::QueryWidget(`id("cache_swap_low"), `Value))]); + Squid::SetSetting("cache_swap_high", [tostring(UI::QueryWidget(`id("cache_swap_high"), `Value))]); + Squid::SetSetting("cache_replacement_policy", [UI::QueryWidget(`id("cache_replacement_policy"), `Value)]); + Squid::SetSetting("memory_replacement_policy", [UI::QueryWidget(`id("memory_replacement_policy"), `Value)]); +} /************** CACHE DIALOG END ****************/ @@ -394,86 +396,102 @@ /******** LOGGING AND TIMEOUTS DIALOG ***********/ -boolean StoreDataFromLoggingFrame() +boolean ValidateLoggingFrame(string widget_id, map event) +{ + if (event["ID"]:nil != `abort){ + boolean ok = true; + string message = ""; + string access_log = (string)UI::QueryWidget(`id("access_log"), `Value); + string cache_log = (string)UI::QueryWidget(`id("cache_log"), `Value); + string cache_store_log = (string)UI::QueryWidget(`id("cache_store_log"), `Value); + string emulate_httpd_log = ((boolean)UI::QueryWidget(`id("emulate_httpd_log"), `Value) + ? "on" : "off"); + + if (size(access_log) == 0){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Access Log must not be empty."); + } + if (size(cache_log) == 0){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Cache Log must not be empty."); + } + if (size(access_log) > 0 && !isCorrectPathnameOfLogFile(access_log)){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Access Log field."); + } + if (size(cache_log) > 0 && !isCorrectPathnameOfLogFile(cache_log)){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Cache Log field."); + } + if (size(cache_store_log) > 0 && !isCorrectPathnameOfLogFile(cache_store_log)){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Cache Store Log field."); + } + /* + if (size(cache_store_log) == 0){ + ok = false; + message = message + (size(message)>0 ? "\n" : "") + _("Cache Store Log must not be empty."); + } + */ + + if (!ok){ + Report::Error(message); + } + + return ok; + } + return true; +} +void StoreDataFromLoggingFrame(string widget_id, map event) { - boolean ok = true; - string message = ""; string access_log = (string)UI::QueryWidget(`id("access_log"), `Value); string cache_log = (string)UI::QueryWidget(`id("cache_log"), `Value); string cache_store_log = (string)UI::QueryWidget(`id("cache_store_log"), `Value); string emulate_httpd_log = ((boolean)UI::QueryWidget(`id("emulate_httpd_log"), `Value) ? "on" : "off"); - if (size(access_log) == 0){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Access Log must not be empty."); - } - if (size(cache_log) == 0){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Cache Log must not be empty."); - } - if (size(access_log) > 0 && !isCorrectPathnameOfLogFile(access_log)){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Access Log field."); - } - if (size(cache_log) > 0 && !isCorrectPathnameOfLogFile(cache_log)){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Cache Log field."); - } - if (size(cache_store_log) > 0 && !isCorrectPathnameOfLogFile(cache_store_log)){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Incorrect pathname in Cache Store Log field."); - } - /* - if (size(cache_store_log) == 0){ - ok = false; - message = message + (size(message)>0 ? "\n" : "") + _("Cache Store Log must not be empty."); - } - */ - - if (ok){ - list<string> tmp = Squid::GetSetting("access_log"); - Squid::SetSetting("access_log", prepend(remove(tmp, 0), access_log)); - Squid::SetSetting("cache_log", [cache_log]); - Squid::SetSetting("cache_store_log", [cache_store_log]); - Squid::SetSetting("emulate_httpd_log", [emulate_httpd_log]); - }else{ - Report::Error(message); - } - - return ok; + list<string> tmp = Squid::GetSetting("access_log"); + Squid::SetSetting("access_log", prepend(remove(tmp, 0), access_log)); + Squid::SetSetting("cache_log", [cache_log]); + Squid::SetSetting("cache_store_log", [cache_store_log]); + Squid::SetSetting("emulate_httpd_log", [emulate_httpd_log]); } -boolean StoreDataFromTimeoutsFrame() +void StoreDataFromTimeoutsFrame(string widget_id, map event) { Squid::SetSetting("connect_timeout", [tostring(UI::QueryWidget(`id("connect_timeout"), `Value)), (string)UI::QueryWidget(`id("connect_timeout_units"), `Value)]); Squid::SetSetting("client_lifetime", [tostring(UI::QueryWidget(`id("client_lifetime"), `Value)), (string)UI::QueryWidget(`id("client_lifetime_units"), `Value)]); - return true; } /******** LOGGING AND TIMEOUTS DIALOG END *******/ +boolean ValidateMiscellaneousFrame(string widget_id, map event) +{ + if (event["ID"]:nil != `abort){ + boolean ok = true; + string cache_mgr = (string)UI::QueryWidget(`id("cache_mgr"), `Value); -boolean StoreDataFromMiscellaneousDialog() + if (regexpmatch(cache_mgr, "[ \t\n]")){ + ok = false; + Report::Error( _("Administrator's E-mail must not contain any white spaces.")); + } + + return ok; + } + return true; +} +void StoreDataFromMiscellaneousFrame(string widget_id, map event) { - boolean ok = true; string error_language = (string)UI::QueryWidget(`id("error_language"), `Value); string cache_mgr = (string)UI::QueryWidget(`id("cache_mgr"), `Value); string ftp_passive = (boolean)UI::QueryWidget(`id("ftp_passive"), `Value) ? "on" : "off"; - if (regexpmatch(cache_mgr, "[ \t\n]")){ - ok = false; - Report::Error( _("Administrator's E-mail must not contain any white spaces.")); - } + Squid::SetSetting("error_directory",[SquidErrorMessages::GetPath(error_language)]); + Squid::SetSetting("cache_mgr", [cache_mgr]); + Squid::SetSetting("ftp_passive", [ftp_passive]); +} - if (ok){ - Squid::SetSetting("error_directory",[SquidErrorMessages::GetPath(error_language)]); - Squid::SetSetting("cache_mgr", [cache_mgr]); - Squid::SetSetting("ftp_passive", [ftp_passive]); - } - return ok; -} } /* vim: set sw=4 ts=4 et ft=ycp : */ Modified: trunk/squid/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/wizards.ycp?rev=40529&r... ============================================================================== --- trunk/squid/src/wizards.ycp (original) +++ trunk/squid/src/wizards.ycp Tue Aug 28 12:56:04 2007 @@ -33,53 +33,25 @@ import "Sequencer"; import "Wizard"; +import "Label"; include "squid/complex.ycp"; -include "squid/dialogs.ycp"; + + /** * Main workflow of the squid configuration * @return sequence result */ -any MainSequence() { - - map aliases = $[ - "http_ports" : ``(HttpPortsDialog()), - "cache" : ``(CacheDialog()), - "cache2" : ``(Cache2Dialog()), - "access" : ``(AccessControlDialog()), - "logging_and_timeouts" : ``(LoggingAndTimeoutsDialog()), - "miscellaneous" : ``(MiscellaneousDialog()) - ]; - +any MainSequence(boolean start_up_dialog) { + map aliases = $[ "main" : ``(MainDialog(start_up_dialog))]; map sequence = $[ - "ws_start" : "http_ports", - "http_ports" : $[ - `abort : `abort, - `next : "cache" - ], - "cache" : $[ - `abort : `abort, - `next : "cache2" - ], - "cache2" : $[ - `abort : `abort, - `next : "access" - ], - "access" : $[ - `abort : `abort, - `next : "logging_and_timeouts" - ], - "logging_and_timeouts" : $[ - `abort : `abort, - `next : "miscellaneous" - ], - "miscellaneous" : $[ - `abort : `abort, - `next : `next - ] + "ws_start" : "main", + "main" : $[ + `abort : `abort, + `next : `next + ] ]; - any ret = Sequencer::Run(aliases, sequence); return ret; @@ -93,7 +65,7 @@ map aliases = $[ "read" : [ ``( ReadDialog() ), true ], - "main" : ``( MainSequence() ), + "main" : ``( MainSequence(true) ), "write" : [ ``( WriteDialog() ), true ] ]; @@ -137,7 +109,7 @@ Wizard::SetContentsButtons(caption, contents, "", Label::BackButton(), Label::NextButton()); - any ret = MainSequence(); + any ret = MainSequence(false); UI::CloseDialog(); return ret; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
dfiser@svn.opensuse.org