Mailinglist Archive: yast-commit (815 mails)

< Previous Next >
[yast-commit] r40061 - in /trunk/squid: src/Makefile.am src/Squid.ycp src/complex.ycp src/dialogs.ycp src/popup_dialogs.ycp testsuite/tests/Squid-Read.out testsuite/tests/Squid.out
  • From: dfiser@xxxxxxxxxxxxxxxx
  • Date: Tue, 07 Aug 2007 14:28:38 -0000
  • Message-id: <20070807142838.78CB8CDF69@xxxxxxxxxxxxxxxx>
Author: dfiser
Date: Tue Aug  7 16:28:37 2007
New Revision: 40061

URL: http://svn.opensuse.org/viewcvs/yast?rev=40061&view=rev
Log:
Added handling for Miscellaneous Dialog and Logging and Timeouts Dialog.
Added module SquidErrorMessages which has to know which languages of error messages are present in system a where to find them.
Deleted support for option cache_swap_log, because it's recommended in documentation to do *not* change this option.

Modified:
    trunk/squid/src/Makefile.am
    trunk/squid/src/Squid.ycp
    trunk/squid/src/complex.ycp
    trunk/squid/src/dialogs.ycp
    trunk/squid/src/popup_dialogs.ycp
    trunk/squid/testsuite/tests/Squid-Read.out
    trunk/squid/testsuite/tests/Squid.out

Modified: trunk/squid/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Makefile.am?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/src/Makefile.am (original)
+++ trunk/squid/src/Makefile.am Tue Aug  7 16:28:37 2007
@@ -21,7 +21,8 @@
 module_DATA =                  \
        Squid.ycp               \
        Squid2.pm \
-    SquidACL.ycp
+    SquidACL.ycp \
+    SquidErrorMessages.ycp
 
 # create a symlink for local build, #145327
 squid:

Modified: trunk/squid/src/Squid.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Squid.ycp?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/src/Squid.ycp (original)
+++ trunk/squid/src/Squid.ycp Tue Aug  7 16:28:37 2007
@@ -120,7 +120,6 @@
     "access_log" : ["/var/log/squid/access.log"],
     "cache_log" : ["/var/log/squid/cache.log"],
     "cache_store_log" : ["/var/log/squid/store.log"],
-    "cache_swap_log" : ["none"],
     "emulate_httpd_log" : ["off"],
 
     "connect_timeout" : ["2", "minutes"],

Modified: trunk/squid/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/complex.ycp?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/src/complex.ycp (original)
+++ trunk/squid/src/complex.ycp Tue Aug  7 16:28:37 2007
@@ -40,6 +40,7 @@
 
 import "Squid";
 import "SquidACL";
+import "SquidErrorMessages";
 
 
 include "squid/helps.ycp";
@@ -315,7 +316,6 @@
         "access_log" : (set["access_log"]:[])[0]:"",
         "cache_log" : (set["cache_log"]:[])[0]:"",
         "cache_store_log" : (set["cache_store_log"]:[])[0]:"",
-        "cache_swap_log" : (set["cache_swap_log"]:[])[0]:"",
 
         "emulate_httpd_log" : ((set["emulate_httpd_log"]:[])[0]:"" == "on" ? true : false)
     ]);
@@ -331,6 +331,19 @@
         "client_lifetime_units" : (set["client_lifetime"]:[])[1]:""
     ]);
 }
+
+
+void InitMiscellaneousDialog()
+{
+    simpleInit($[
+        "cache_mgr" : (Squid::GetSetting("cache_mgr"))[0]:"",
+        "ftp_passive" : (Squid::GetSetting("ftp_passive"))[0]:"" == "on" ? true : false
+    ]);
+    UI::ChangeWidget(`id("error_language"), `Items, SquidErrorMessages::GetLanguagesToComboBox());
+    UI::ChangeWidget(`id("error_language"), `Value, SquidErrorMessages::GetLanguageFromPath(
+                                                        (Squid::GetSetting("error_directory"))[0]:""
+                                                    ));
+}
 /*********************   INITS END  ****************/
 
 
@@ -587,7 +600,7 @@
 
             if (contains(affected_options, "http_access")){
                 //Report::Error( _("This ACL Group can't be deleted.\nIt's used in Access Control table."));
-                Report::Error( _("You can not delete this ACL Group, because \nit's used in Access Control table."));
+                Report::Error( _("You must not delete this ACL Group, because \nit's used in Access Control table."));
             }else{
                 string message = _("If you delete this ACL Group these options might be affected: \n")
                                  + "    " + mergestring(affected_options, ",\n    ") + ".\n";// +
@@ -616,8 +629,64 @@
 
 
 
+//TODO: Here must be control, if is possible to create each log file (if it's not
+//      possible it causes breakdown of squid).
 boolean StoreDataFromLoggingFrame()
 {
+    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(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;
+}
+
+boolean StoreDataFromTimeoutsFrame()
+{
+    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;
+}
+
+
+boolean StoreDataFromMiscellaneousDialog()
+{
+    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";
+
+    Squid::SetSetting("error_directory",[SquidErrorMessages::GetPath(error_language)]);
+    Squid::SetSetting("cache_mgr", [cache_mgr]);
+    Squid::SetSetting("ftp_passive", [ftp_passive]);
+
     return true;
 }
 /********************* STORING + DELETING END ********************/

Modified: trunk/squid/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/src/dialogs.ycp (original)
+++ trunk/squid/src/dialogs.ycp Tue Aug  7 16:28:37 2007
@@ -367,7 +367,6 @@
                     `TextEntry(`id("access_log"), _("Access Log") , ""),
                     `TextEntry(`id("cache_log"), _("Cache Log"), ""),
                     `TextEntry(`id("cache_store_log"), _("Cache Store Log"), ""),
-                    `TextEntry(`id("cache_swap_log"), _("Cache Swap Log"), ""),
                     `Left(`CheckBox(`id("emulate_httpd_log"), _("Emulate Httpd Log?")))
                 )
             )),
@@ -400,7 +399,7 @@
         y2debug("BaseDialog(): ret == %1",ret);
 
         if (ret == `next || ret == `back){
-            if(StoreDataFromLoggingFrame())
+            if(StoreDataFromLoggingFrame() && StoreDataFromTimeoutsFrame())
                 break;
         }else if (ret == `abort || ret == `cancel){
             //if (Popup::ReallyAbort(true)) break;
@@ -424,19 +423,23 @@
                  `VSpacing(),
                  `Left(`TextEntry(`id("cache_mgr"), _("Administrator's e-mail"), "")),
                  `VSpacing(),
-                 `Left(`CheckBox(`id("ftp_pasive_mode"), _("Use Ftp Pasive Mode")))
+                 `Left(`CheckBox(`id("ftp_passive"), _("Use Ftp Pasive Mode")))
         ));
 
     Wizard::SetContentsButtons("Squid - Miscellaneous Setting", dialog_contents, "help",
         Label::BackButton(), Label::FinishButton());
 
+    InitMiscellaneousDialog();
+
     while (true){
         ret = UI::UserInput();
 
         y2debug("BaseDialog(): ret == %1",ret);
 
-        if (ret == `next || ret == `back) break;
-        else if (ret == `abort || ret == `cancel){
+        if (ret == `next || ret == `back){
+            if (StoreDataFromMiscellaneousDialog())
+                break;
+        }else if (ret == `abort || ret == `cancel){
             //if (Popup::ReallyAbort(true)) break;
             break;
             continue;

Modified: trunk/squid/src/popup_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/popup_dialogs.ycp?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/src/popup_dialogs.ycp (original)
+++ trunk/squid/src/popup_dialogs.ycp Tue Aug  7 16:28:37 2007
@@ -30,6 +30,8 @@
 {
 
 textdomain "squid";
+import "Label";
+import "SquidACL";
 
 /*****************  HTTP PORT  ********************/
 /**
@@ -225,6 +227,7 @@
     string acl = "";
     boolean not = false;
     any tmp = nil;
+    term tmp_term = nil;
     integer id_acl = 0;
     string label = (id_item == nil ? _("Add New HTTP Access")
                                    : _("Edit HTTP Access"));
@@ -233,25 +236,28 @@
             `Label(label),
             `VSpacing(0.5),
 
-            `Left(`ComboBox(`id("allow_deny"), _("Allow/Deny"),
-                [`item(`id("allow"), "allow"), `item(`id("deny"), "deny")])),
+            `ComboBox(`id("allow_deny"), _("Allow/Deny"),
+                [`item(`id("allow"), "allow"), `item(`id("deny"), "deny")]),
 
             //`VSpacing(),
 
             `MinSize(25, 7,
                 `Table(`id("acls"), `header("   ", _("ACL")), [])
             ),
-            `Left(`PushButton(`id(`del), Label::DeleteButton())),
+            `Left(`HBox(
+                `PushButton(`id(`del), Label::DeleteButton()),
+                `PushButton(`id(`opposite), _("O&pposite"))
+            )),
 
-            //`VSpacing(),
+            `VSpacing(0.5),
 
-            `Frame( _("Add ACL"),
+            `MinWidth(25, `Frame( _("Add ACL"),
                 `VSquash(`HBox(
                     `Bottom(`CheckBox(`id("acl_not"), _("not"))),
-                    `ComboBox(`id("acl"), "ACL", []),
+                    `MinWidth(15, `ComboBox(`id("acl"), "ACL", [])),
                     `Bottom(`PushButton(`id(`add), Label::AddButton()))
                 ))
-            ),
+            )),
 
             `VStretch(),
 
@@ -287,6 +293,15 @@
             id_acl = delItemFromAddEditHttpAccessDialog((integer)UI::QueryWidget(`id("acls"), `CurrentItem));
             InitAddEditHttpAccessDialog(nil);
             UI::ChangeWidget(`id("acls"), `CurrentItem, id_acl);
+        }else if (ui == `opposite){
+            id_acl = (integer)UI::QueryWidget(`id("acls"), `CurrentItem);
+            tmp_term = (term)UI::QueryWidget(`id("acls"), `Item(id_acl));
+
+            if (tmp_term[1]:"" == "not"){
+                UI::ChangeWidget(`id("acls"), `Item(id_acl, 0), "");
+            }else{
+                UI::ChangeWidget(`id("acls"), `Item(id_acl, 0), "not");
+            }
         }
     }
 

Modified: trunk/squid/testsuite/tests/Squid-Read.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/testsuite/tests/Squid-Read.out?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/testsuite/tests/Squid-Read.out (original)
+++ trunk/squid/testsuite/tests/Squid-Read.out Tue Aug  7 16:28:37 2007
@@ -31,7 +31,6 @@
 Read   .squid."cache_replacement_policy" ["lru"]
 Read   .squid."cache_store_log" ["/var/log/squid/store.log"]
 Read   .squid."cache_swap_high" ["95"]
-Read   .squid."cache_swap_log" ["none"]
 Read   .squid."cache_swap_low" ["90"]
 Read   .squid."client_lifetime" ["1 day"]
 Read   .squid."connect_timeout" ["2 minutes"]
@@ -43,7 +42,7 @@
 Read   .squid."minimum_object_size" ["0 KB"]
 Return true
 Dump   Squid::settings
-Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
+Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
 Dump   ------------------------------
 Dump   Squid::Read()
 Read   .squid."http_port" ["localhost:3128", "80 transparent"]
@@ -58,7 +57,6 @@
 Read   .squid."cache_replacement_policy" ["lru"]
 Read   .squid."cache_store_log" ["/var/log/squid/store.log"]
 Read   .squid."cache_swap_high" ["95"]
-Read   .squid."cache_swap_log" ["none"]
 Read   .squid."cache_swap_low" ["90"]
 Read   .squid."client_lifetime" ["1 day"]
 Read   .squid."connect_timeout" ["2 minutes"]
@@ -70,7 +68,7 @@
 Read   .squid."minimum_object_size" ["0 KB"]
 Return true
 Dump   Squid::settings
-Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
+Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
 Dump   Squid::acls
 Return [$["name":"QUERY", "options":["cgi-bin \\?"], "type":"urlpath_regex"], $["name":"apache", "options":["Server", "^Apache"], "type":"rep_header"], $["name":"all", "options":["0.0.0.0/0.0.0.0"], "type":"src"], $["name":"manager", "options":["cache_object"], "type":"proto"], $["name":"localhost", "options":["127.0.0.1/255.255.255.255"], "type":"src"], $["name":"localhost_public", "options":["10.20.1.241/255.255.255.255"], "type":"src"], $["name":"to_localhost", "options":["127.0.0.0/8"], "type":"dst"], $["name":"SSL_ports", "options":["443"], "type":"port"], $["name":"Safe_ports", "options":["80"], "type":"port"], $["name":"Safe_ports", "options":["21"], "type":"port"], $["name":"Safe_ports", "options":["443"], "type":"port"], $["name":"Safe_ports", "options":["70"], "type":"port"], $["name":"Safe_ports", "options":["210"], "type":"port"], $["name":"Safe_ports", "options":["1025-65535"], "type":"port"], $["name":"Safe_ports", "options":["280"], "type":"port"], $["name":"Safe_ports", "options":["488"], "type":"port"], $["name":"Safe_ports", "options":["591"], "type":"port"], $["name":"Safe_ports", "options":["777"], "type":"port"], $["name":"CONNECT", "options":["CONNECT"], "type":"method"]]
 Dump   Squid::refresh_patterns
@@ -94,7 +92,6 @@
 Read   .squid."cache_replacement_policy" ["lru"]
 Read   .squid."cache_store_log" ["/var/log/squid/store.log"]
 Read   .squid."cache_swap_high" ["95"]
-Read   .squid."cache_swap_log" ["none"]
 Read   .squid."cache_swap_low" ["90"]
 Read   .squid."client_lifetime" ["1 day"]
 Read   .squid."connect_timeout" ["2 minutes"]

Modified: trunk/squid/testsuite/tests/Squid.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/testsuite/tests/Squid.out?rev=40061&r1=40060&r2=40061&view=diff
==============================================================================
--- trunk/squid/testsuite/tests/Squid.out (original)
+++ trunk/squid/testsuite/tests/Squid.out Tue Aug  7 16:28:37 2007
@@ -10,7 +10,6 @@
 Read   .squid."cache_replacement_policy" ["lru"]
 Read   .squid."cache_store_log" ["/var/log/squid/store.log"]
 Read   .squid."cache_swap_high" ["95"]
-Read   .squid."cache_swap_log" ["none"]
 Read   .squid."cache_swap_low" ["90"]
 Read   .squid."client_lifetime" ["1 day"]
 Read   .squid."connect_timeout" ["2 minutes"]
@@ -129,7 +128,7 @@
 Dump   ==================================================
 Dump   
 Dump   GetSettings()
-Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
+Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_low":["90"], "client_lifetime":["1", "days"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
 Dump   
 Dump   GetSetting("cache_dir")
 Return ["ufs", "/var/cache/squid", "100", "16", "256"]

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages