Author: dfiser Date: Fri Aug 17 12:21:46 2007 New Revision: 40328 URL: http://svn.opensuse.org/viewcvs/yast?rev=40328&view=rev Log: All tables now react on double-click. All checkboxs under text areas are aligned to left. Cache 2 Setting dialog has better aligned widgets. Setting of permissions to cache directory (cache_dir) is moved from Store.. function to Squid::Write function. Modified: trunk/squid/src/Squid.ycp trunk/squid/src/SquidACL.ycp trunk/squid/src/SquidACL_local_functions.ycp trunk/squid/src/dialogs.ycp trunk/squid/src/popup_dialogs.ycp trunk/squid/src/store_del.ycp Modified: trunk/squid/src/Squid.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Squid.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/Squid.ycp (original) +++ trunk/squid/src/Squid.ycp Fri Aug 17 12:21:46 2007 @@ -41,6 +41,7 @@ import "Message"; import "Service"; import "Summary"; +import "FileUtils"; /** * Defines path used in SCR::Read/Write functions @@ -209,6 +210,28 @@ return ret; } + + +/** + * Function which sets permissions 'chmod 750' and 'chown squid:root' + * to directory dir if exists. + * If dir does not exist, function returns true; + */ +boolean setWritePremissionsToCacheDir(string dir) +{ + if (!FileUtils::IsDirectory(dir)){ + y2debug("Squid::checkWritePremissionsCacheDir() - '%1' is not directory", dir); + return true; + } + + if ((integer)SCR::Execute(.target.bash, "chown squid:root " + dir) != 0 || + (integer)SCR::Execute(.target.bash, "chmod 750 " + dir) != 0){ + return false; + //return (Popup::ContinueCancel(sformat(_("Unable to set correct permissions to directory %1."), dir))); + } + + return true; +} /***************** HELP FUNCTIONS END ***********/ @@ -1113,13 +1136,26 @@ return ok; } +boolean writePermissions() +{ + string cache_dir = (settings["cache_dir"]:[])[1]:""; + boolean ok = true; + + if (!setWritePremissionsToCacheDir(cache_dir)) + ok = false; + return ok; +} + boolean writeAllSettings() { + boolean ok = true; + + if (!writePermissions()) ok = false; + if (!GetModified()){ y2debug("Squid::Write - no setting to write, because nothing's changed"); - return true; + return ok; } - boolean ok = true; y2milestone("Squid::writeAllSettings started"); Modified: trunk/squid/src/SquidACL.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/SquidACL.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/SquidACL.ycp (original) +++ trunk/squid/src/SquidACL.ycp Fri Aug 17 12:21:46 2007 @@ -225,7 +225,7 @@ `VBox( `TextEntry(`id("acl_header_name"), _("Header Name"), ""), `TextEntry(`id("acl_regexp"), _("Regular Expression(s)"), ""), - `CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false) + `Left(`CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false)) ) ), "widget_init" : headerWidgetInit, @@ -238,7 +238,7 @@ `VBox( `TextEntry(`id("acl_header_name"), _("Header Name"), ""), `TextEntry(`id("acl_regexp"), _("Regular Expression(s)"), ""), - `CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false) + `Left(`CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false)) ) ), "widget_init" : headerWidgetInit, Modified: trunk/squid/src/SquidACL_local_functions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/SquidACL_local_functions.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/SquidACL_local_functions.ycp (original) +++ trunk/squid/src/SquidACL_local_functions.ycp Fri Aug 17 12:21:46 2007 @@ -226,7 +226,7 @@ return `Frame( frame_title, `VBox( `TextEntry(`id("acl_regexp"), _("Regular Expression"), ""), - `CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false) + `Left(`CheckBox(`id("acl_regexp_case_insensitive"), _("Case Insensitive"), false)) ) ); } Modified: trunk/squid/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/dialogs.ycp (original) +++ trunk/squid/src/dialogs.ycp Fri Aug 17 12:21:46 2007 @@ -79,7 +79,7 @@ term dialog_contents = `VBox( `Left(`Label( _("HTTP Ports"))), - `Table(`id("http_port"), `header(_("Host"), _("Port"), _("Options"))), + `Table(`id("http_port"), `opt(`notify), `header(_("Host"), _("Port"), _("Options"))), `HBox( `PushButton(`id(`add), Label::AddButton()), `PushButton(`id(`del), Label::DeleteButton()), @@ -106,7 +106,7 @@ }else if (ret == `add){ if (AddEditHttpPortDialog(nil)) InitHttpPortsTable(); - }else if (ret == `edit){ + }else if (ret == `edit || ret == "http_port"){ id_item = (integer)UI::QueryWidget(`id("http_port"), `CurrentItem); if (AddEditHttpPortDialog(id_item)){ InitHttpPortsTable(); @@ -131,7 +131,7 @@ `VBox( `Left(`Label( _("Refresh Patterns"))), `HBox( - `Table(`id("refresh_patterns"), `opt(`keepSorting), + `Table(`id("refresh_patterns"), `opt(`keepSorting, `notify), `header(_("Regular Expression"), _("Min"), _("Precent"), _("Max")/*, _("Options")*/)), `VBox( `PushButton(`id(`up), Label::UpButton()), @@ -163,7 +163,7 @@ }else if (ret == `add){ if (AddEditRefreshPatternDialog(nil)) InitRefreshPatternsTable(); - }else if (ret == `edit){ + }else if (ret == `edit || ret == "refresh_patterns"){ id_item = (integer)UI::QueryWidget(`id("refresh_patterns"), `CurrentItem); if (AddEditRefreshPatternDialog(id_item)){ InitRefreshPatternsTable(); @@ -195,52 +195,62 @@ any Cache2Dialog(){ any ret = nil; string cache_dir = ""; + term dialog_contents = - `VBox( - `Top(`Left( - `VBox( - `HBox( - `HSquash(`IntField(`id("cache_mem"), _("Cache Memory"), 1, 99999, 10)), - sizeUnitWidget("cache_mem_units"), - `HStretch() - ), - `VSpacing(), - `HBox( - `HSquash(`IntField(`id("cache_max_object_size"), _("Max Object Size"), 0, 99999, 0)), - sizeUnitWidget("cache_max_object_size_units"), - `HSpacing(3), - `HSquash(`IntField(`id("cache_min_object_size"), _("Min Object Size"), 0, 99999, 0)), - sizeUnitWidget("cache_min_object_size_units"), - `HStretch() - ), - `VSpacing(), - `VSquash(`HBox( - `HSquash(`IntField(`id("cache_swap_low"), _("Swap Low-Water Mark"), 0, 100, 0)), - `Bottom(`Label("%")), - `HSpacing(3), - `HSquash(`IntField(`id("cache_swap_high"), _("Swap High-Water Mark"), 0, 100, 0)), - `Bottom(`Label("%")), - `HStretch() - )), - `VSpacing(), - `Left(`HBox( - `ComboBox(`id("cache_replacement_policy"), - _("Cache Replacement Policy"), - [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]), - `HSpacing(3), - `ComboBox(`id("memory_replacement_policy"), - _("Memory Replacement Policy"), - [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]) + `Top(`Left(`VBox( + `VBox( + `HBox( + `HWeight(1,`VBox( + `VWeight(1, `HBox( + `IntField(`id("cache_mem"), _("Cache Memory"), 1, 99999, 10), + sizeUnitWidget("cache_mem_units") + )), + `VSpacing(), + `VWeight(1, `HBox( + `IntField(`id("cache_max_object_size"), _("Max Object Size"), 0, 99999, 0), + sizeUnitWidget("cache_max_object_size_units") + )), + `VSpacing(), + `VWeight(1, `HBox( + `IntField(`id("cache_swap_low"), _("Swap Low-Water Mark"), 0, 100, 0), + `Bottom(`Label("%")) + )), + `VSpacing(), + `Left(`VWeight(1, `HBox( + `ComboBox(`id("cache_replacement_policy"), + _("Cache Replacement Policy"), + [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]) + ))) )), - `VSpacing(), - `VSquash(`HBox( - `TextEntry(`id("cache_dir"), _("Cache Directory"), ""), - `Bottom(`PushButton(`id(`browse_cache_dir), Label::BrowseButton())), - `Bottom(`PushButton(`id(`cache_dir), "Advanced Setting")) + `HSpacing(3), + `HWeight(1,`VBox( + `VWeight(1, `HBox(`Empty())), + `VSpacing(), + `VWeight(1, `HBox( + `IntField(`id("cache_min_object_size"), _("Min Object Size"), 0, 99999, 0), + sizeUnitWidget("cache_min_object_size_units") + )), + `VSpacing(), + `VWeight(1, `HBox( + `IntField(`id("cache_swap_high"), _("Swap High-Water Mark"), 0, 100, 0), + `Bottom(`Label("%")) + )), + `VSpacing(), + `Left(`VWeight(1, `HBox( + `ComboBox(`id("memory_replacement_policy"), + _("Memory Replacement Policy"), + [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]) + ))) )) - ) - )) - ); + ), + `VSpacing(), + `VSquash(`HBox( + `TextEntry(`id("cache_dir"), _("Cache Directory"), ""), + `Bottom(`PushButton(`id(`browse_cache_dir), Label::BrowseButton())), + `Bottom(`PushButton(`id(`cache_dir), "Advanced Setting")) + )) + ) + ))); Wizard::SetContentsButtons("Squid - Cache Setting 2", dialog_contents, HELPS["cache2"]:"", Label::BackButton(), Label::NextButton()); @@ -279,7 +289,7 @@ term dialog_contents = `VBox( `Left(`Label(_("ACL Groups"))), - `Table(`id("acl"), `header(_("Name"), _("Type"), _("Description"))), + `Table(`id("acl"), `opt(`notify), `header(_("Name"), _("Type"), _("Description"))), `HBox( `PushButton(`id(`add_acl), Label::AddButton()), `PushButton(`id(`del_acl), Label::DeleteButton()), @@ -291,7 +301,7 @@ `Left(`Label(_("Access Control"))), `HBox( - `Table(`id("http_access"), `opt(`keepSorting), `header(_("Allow/Deny"), _("ACL Groups"))), + `Table(`id("http_access"), `opt(`keepSorting, `notify), `header(_("Allow/Deny"), _("ACL Groups"))), `HSquash(`VBox( `HWeight(1, `PushButton(`id(`up_http_access), Label::UpButton())), `HWeight(1, `PushButton(`id(`down_http_access), Label::DownButton())) @@ -324,7 +334,7 @@ if (AddEditACLDialog(nil)){ InitACLGroupsTable(); } - }else if (ret == `edit_acl){ + }else if (ret == `edit_acl || ret == "acl"){ id_item = (integer)UI::QueryWidget(`id("acl"), `CurrentItem); if (AddEditACLDialog(id_item)){ InitACLGroupsTable(); @@ -339,7 +349,7 @@ if (AddEditHttpAccessDialog(nil)){ InitHttpAccessTable(); } - }else if (ret == `edit_http_access){ + }else if (ret == `edit_http_access || ret == "http_access"){ id_item = (integer)UI::QueryWidget(`id("http_access"), `CurrentItem); if (AddEditHttpAccessDialog(id_item)){ InitHttpAccessTable(); @@ -374,8 +384,8 @@ any ret = nil; string tmp = nil; term dialog_contents = - `Top(`VBox( - `Left(`Frame(_("Logging"), + `Left(`Top(`VBox( + `Frame(_("Logging"), `VBox( `VSquash(`HBox( `TextEntry(`id("access_log"), _("Access Log") , ""), @@ -391,11 +401,11 @@ )), `Left(`CheckBox(`id("emulate_httpd_log"), _("Emulate Httpd Log?"))) ) - )), + ), `VSpacing(), - `Left(`Frame(_("Timeouts"), + `Frame(_("Timeouts"), `VBox( `HBox( `IntField(`id("connect_timeout"), _("Connection timeout"), 0, 99999, 0), @@ -406,10 +416,10 @@ timeUnitWidget("client_lifetime_units") ) ) - )) - )); + ) + ))); - Wizard::SetContentsButtons("Squid - Logging + Timeouts Setting", dialog_contents, HELPS["logging_timeouts"]:"", + Wizard::SetContentsButtons("Squid - Logging and Timeouts Setting", dialog_contents, HELPS["logging_timeouts"]:"", Label::BackButton(), Label::NextButton()); InitLoggingFrame(); Modified: trunk/squid/src/popup_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/popup_dialogs.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/popup_dialogs.ycp (original) +++ trunk/squid/src/popup_dialogs.ycp Fri Aug 17 12:21:46 2007 @@ -53,9 +53,7 @@ `TextEntry(`id("host"), _("Host"), ""), `TextEntry(`id("port"), _("Port"), ""), `Frame(_("Options"), - `VBox( `CheckBox(`id("transparent"), "Transparent", false) - ) ), `VSpacing(), `VStretch(), @@ -245,7 +243,7 @@ //`VSpacing(), `MinSize(25, 7, - `Table(`id("acls"), `header(" ", _("ACL")), []) + `Table(`id("acls"), `opt(`notify), `header(" ", _("ACL")), []) ), `Left(`HBox( `PushButton(`id(`del), Label::DeleteButton()), @@ -296,7 +294,7 @@ id_acl = delItemFromAddEditHttpAccessDialog((integer)UI::QueryWidget(`id("acls"), `CurrentItem)); InitAddEditHttpAccessDialog(nil); UI::ChangeWidget(`id("acls"), `CurrentItem, id_acl); - }else if (ui == `opposite){ + }else if (ui == `opposite || ui == "acls"){ id_acl = (integer)UI::QueryWidget(`id("acls"), `CurrentItem); tmp_term = (term)UI::QueryWidget(`id("acls"), `Item(id_acl)); Modified: trunk/squid/src/store_del.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/store_del.ycp?rev=40328&r1=40327&r2=40328&view=diff ============================================================================== --- trunk/squid/src/store_del.ycp (original) +++ trunk/squid/src/store_del.ycp Fri Aug 17 12:21:46 2007 @@ -35,6 +35,7 @@ import "Report"; import "FileUtils"; import "Popup"; +import "FileUtils"; import "Squid"; import "SquidACL"; @@ -43,6 +44,18 @@ include "squid/helps.ycp"; +/****** help functions **********/ +boolean isCorrectPathnameOfLogFile(string str) +{ + boolean ok = regexpmatch(str, "^/([^/]+/)*[^/]+$"); + if (ok){ + list<string> dir = regexptokenize(str, "^(.+)/[^/]+$"); + if (!FileUtils::IsDirectory(dir[0]:"/")) + ok = false; + } + return ok; +} +/****** help functions END ******/ /***************** HTTP_PORT ********************/ boolean StoreDataFromAddEditHttpPortDialog(integer id_item) @@ -154,25 +167,6 @@ return true; } -/** - * Function which sets permissions 'chmod 750' and 'chown squid:root' - * to directory dir if exists. - * If dir does not exist, function returns true; - */ -boolean setWritePremissionsToCacheDir(string dir) -{ - if (!FileUtils::IsDirectory(dir)){ - y2debug("store_del::checkWritePremissionsCacheDir() - '%1' is not directory", dir); - return true; - } - - if ((integer)SCR::Execute(.target.bash, "chown squid:root " + dir) != 0 || - (integer)SCR::Execute(.target.bash, "chmod 750 " + dir) != 0){ - return (Popup::ContinueCancel(sformat(_("Unable to set correct permissions to directory %1."), dir))); - } - - return true; -} boolean StoreDataFromCache2Dialog() { @@ -187,10 +181,6 @@ ok = false; } - if (ok && !setWritePremissionsToCacheDir(cache_dir)){ - ok = false; - } - if (ok){ Squid::SetSetting("cache_dir", [squid_cache_dir[0]:"", cache_dir, squid_cache_dir[2]:"", squid_cache_dir[3]:"", squid_cache_dir[4]:""]); @@ -420,6 +410,18 @@ 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; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org