Mailinglist Archive: yast-commit (503 mails)

< Previous Next >
[yast-commit] r40846 - in /trunk/squid/src: complex.ycp dialogs.ycp handlers.ycp helps.ycp inits.ycp store_del.ycp
  • From: dfiser@xxxxxxxxxxxxxxxx
  • Date: Tue, 11 Sep 2007 11:42:50 -0000
  • Message-id: <20070911114250.EC1ED2B029@xxxxxxxxxxxxxxxx>
Author: dfiser
Date: Tue Sep 11 13:42:50 2007
New Revision: 40846

URL: http://svn.opensuse.org/viewcvs/yast?rev=40846&view=rev
Log:
Cache Setting dialog splitted into two dialogs: Cache Setting and Cache Directory Setting.
Changed order and place of widgets in Cache Setting bacause of ncurses 80x25 - before it looks overcrowded.

Modified:
    trunk/squid/src/complex.ycp
    trunk/squid/src/dialogs.ycp
    trunk/squid/src/handlers.ycp
    trunk/squid/src/helps.ycp
    trunk/squid/src/inits.ycp
    trunk/squid/src/store_del.ycp

Modified: trunk/squid/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/complex.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/complex.ycp (original)
+++ trunk/squid/src/complex.ycp Tue Sep 11 13:42:50 2007
@@ -156,6 +156,17 @@
             "help" : HELPS["cache2"]:""
         ],
 
+        "cache_directory" : $[
+            "widget" : `custom,
+            "custom_widget" : CacheDirectoryDialog(),
+            "init" : InitCacheDirectoryDialog,
+            "handle" : HandleCacheDirectoryDialog,
+            "store" : StoreDataFromCacheDirectoryDialog,
+            "validate_type" : `function,
+            "validate_function" : ValidateCacheDirectoryDialog,
+            "help" : HELPS["cache_directory"]:""
+        ],
+
         "acl_groups_table" : $[
             "widget" : `custom,
             "custom_widget" : ACLGroupsTableWidget(),
@@ -201,17 +212,17 @@
 map<string, map<string, any> > screens = $[
         "s1" : $[
             "widget_names" : ["auto_start", "start_stop", "firewall"],
-            "contents" : `HBox(
+            "contents" : `VCenter(`HBox(
                             `HSpacing(3),
-                            `Top(`VBox(
+                            `VBox(
                                 "auto_start",
                                 `VSpacing(),
                                 (Mode::normal() ? "start_stop" : `Empty()),
                                 `VSpacing(),
                                 `Frame(_("Firewall Settings"), "firewall")
-                            )),
+                            ),
                             `HSpacing(3)
-                         ),
+                         )),
             "caption" : main_caption + ": " + _("Start-Up"),
             "tree_item_label" : _("Start-Up")
         ],
@@ -238,6 +249,13 @@
         ],
 
         "s5" : $[
+            "widget_names" : ["cache_directory"],
+            "contents" : `VCenter("cache_directory"),
+            "caption" : main_caption + ": " + _("Cache Directory Setting"),
+            "tree_item_label" : _("Cache Directory")
+        ],
+
+        "s6" : $[
             "widget_names" : ["acl_groups_table", "http_access_table"],
             "contents" : `VBox(
                             "acl_groups_table",
@@ -248,7 +266,7 @@
             "tree_item_label" : _("Access Control")
         ],
 
-        "s6" : $[
+        "s7" : $[
             "widget_names" : ["logging_frame", "timeouts_frame"],
             "contents" : `HBox(`HSpacing(3),
                             `VBox(
@@ -261,7 +279,7 @@
             "tree_item_label" : _("Logging and Timeouts")
         ],
 
-        "s7" : $[
+        "s8" : $[
             "widget_names" : ["miscellaneous_frame"],
             "contents" : `VBox("miscellaneous_frame"),
             "caption" : main_caption + ": " + _("Miscellaneous Setting"),
@@ -269,7 +287,7 @@
         ]
     ];
 
-list<string> ids_order = ["s1", "s2", "s3", "s4", "s5", "s6", "s7"];
+list<string> ids_order = ["s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8"];
 string initial_screen = "s1";
 
 any MainDialog()

Modified: trunk/squid/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/dialogs.ycp (original)
+++ trunk/squid/src/dialogs.ycp Tue Sep 11 13:42:50 2007
@@ -77,66 +77,116 @@
     return
         `HBox(
             `HSpacing(3),
-            `VBox(
-                `VWeight(1, `Frame(_("Cache Setting"),
-                    `HBox(
-                        `HWeight(1,`VBox(
-                            `VWeight(1, `HBox(
-                                `IntField(`id("cache_mem"), _("C&ache Memory"), 1, 99999, 10),
-                                sizeUnitWidget("cache_mem_units")
-                            )),
-                            `VSpacing(0.4),
-                            `VWeight(1, `HBox(
-                                `IntField(`id("cache_max_object_size"), _("Ma&x Object Size"), 0, 99999, 0),
-                                sizeUnitWidget("cache_max_object_size_units")
-                            )),
-                            `VSpacing(0.4),
-                            `VWeight(1, `HBox(
-                                `IntField(`id("cache_swap_low"), _("Swap &Low-Water Mark (in percents)"), 0, 100, 0)
-                            )),
-                            `VSpacing(0.4),
-                            `Left(`VWeight(1, `HBox(
-                                `ComboBox(`id("cache_replacement_policy"),
-                                          _("&Cache Replacement Policy"),
-                                          [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
-                            )))
+            `Frame(_("Cache Setting"),
+                `VBox(
+                    `VWeight(1, `HBox(
+                        `IntField(`id("cache_mem"), _("C&ache Memory"), 1, 99999, 10),
+                        sizeUnitWidget("cache_mem_units")
+                    )),
+                    `VSpacing(0.4),
+                    `VWeight(1, `HBox(
+                        `IntField(`id("cache_max_object_size"), _("Ma&x Object Size"), 0, 99999, 0),
+                        sizeUnitWidget("cache_max_object_size_units")
+                    )),
+                    `VSpacing(0.4),
+                    `VWeight(1, `HBox(
+                        `IntField(`id("cache_min_object_size"), _("M&in Object Size"), 0, 99999, 0),
+                        sizeUnitWidget("cache_min_object_size_units")
+                    )),
+                    `VSpacing(0.4),
+                    `VWeight(1, `HBox(
+                        `IntField(`id("cache_swap_low"), _("Swap &Low-Water Mark (in percents)"), 0, 100, 0)
+                    )),
+                    `VSpacing(0.4),
+                    `VWeight(1, `HBox(
+                        `IntField(`id("cache_swap_high"), _("Swap &High-Water Mark (in percents)"), 0, 100, 0)
+                    )),
+                    `VSpacing(0.4),
+                    `Left(`VWeight(1, `HBox(
+                        `ComboBox(`id("cache_replacement_policy"),
+                                  _("&Cache Replacement Policy"),
+                                  [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
+                    ))),
+                    `VSpacing(0.4),
+                    `Left(`VWeight(1, `HBox(
+                        `ComboBox(`id("memory_replacement_policy"),
+                                  _("&Memory Replacement Policy"),
+                                  [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
+                    )))
+                )
+            ),
+            `HSpacing(3)
+        );
+    /*
+        `HBox(
+            `HSpacing(3),
+            `Frame(_("Cache Setting"),
+                `HBox(
+                    `HWeight(1,`VBox(
+                        `VWeight(1, `HBox(
+                            `IntField(`id("cache_mem"), _("C&ache Memory"), 1, 99999, 10),
+                            sizeUnitWidget("cache_mem_units")
                         )),
-                        `HSpacing(3),
-                        `HWeight(1,`VBox(
-                            `VWeight(1, `HBox(`Empty())),
-                            `VSpacing(0.4),
-                            `VWeight(1, `HBox(
-                                `IntField(`id("cache_min_object_size"), _("M&in Object Size"), 0, 99999, 0),
-                                sizeUnitWidget("cache_min_object_size_units")
-                            )),
-                            `VSpacing(0.4),
-                            `VWeight(1, `HBox(
-                                `IntField(`id("cache_swap_high"), _("Swap &High-Water Mark (in percents)"), 0, 100, 0)
-                            )),
-                            `VSpacing(0.4),
-                            `Left(`VWeight(1, `HBox(
-                                `ComboBox(`id("memory_replacement_policy"),
-                                          _("&Memory Replacement Policy"),
-                                          [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
-                            )))
-                        ))
-                    )
-                )),
-                `VSpacing(),
-                `VWeight(1, `Frame(_("Cache Directory"),
-                    `VBox(
-                        `VSquash(`HBox(
-                            `TextEntry(`id("cache_dir"), _("Cache &Directory"), ""),
-                            `Bottom(`PushButton(`id(`browse_cache_dir), Label::BrowseButton()))
+                        `VSpacing(0.4),
+                        `VWeight(1, `HBox(
+                            `IntField(`id("cache_max_object_size"), _("Ma&x Object Size"), 0, 99999, 0),
+                            sizeUnitWidget("cache_max_object_size_units")
                         )),
                         `VSpacing(0.4),
-                        `IntField(`id("mbytes"), _("&Size (in MB)"), 1, 99999, 1),
+                        `VWeight(1, `HBox(
+                            `IntField(`id("cache_swap_low"), _("Swap &Low-Water Mark (in percents)"), 0, 100, 0)
+                        )),
                         `VSpacing(0.4),
-                        `IntField(`id("l1dirs"), _("L&evel 1 Directories"), 1, 99999, 1),
+                        `Left(`VWeight(1, `HBox(
+                            `ComboBox(`id("cache_replacement_policy"),
+                                      _("&Cache Replacement Policy"),
+                                      [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
+                        )))
+                    )),
+                    `HSpacing(3),
+                    `HWeight(1,`VBox(
+                        `VWeight(1, `HBox(`Empty())),
                         `VSpacing(0.4),
-                        `IntField(`id("l2dirs"), _("Le&vel 2 Directories"), 1, 99999, 1)
-                    )
-                ))
+                        `VWeight(1, `HBox(
+                            `IntField(`id("cache_min_object_size"), _("M&in Object Size"), 0, 99999, 0),
+                            sizeUnitWidget("cache_min_object_size_units")
+                        )),
+                        `VSpacing(0.4),
+                        `VWeight(1, `HBox(
+                            `IntField(`id("cache_swap_high"), _("Swap &High-Water Mark (in percents)"), 0, 100, 0)
+                        )),
+                        `VSpacing(0.4),
+                        `Left(`VWeight(1, `HBox(
+                            `ComboBox(`id("memory_replacement_policy"),
+                                      _("&Memory Replacement Policy"),
+                                      [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")])
+                        )))
+                    ))
+                )
+            ),
+            `HSpacing(3)
+        );
+        */
+}
+
+term CacheDirectoryDialog()
+{
+    return
+        `HBox(
+            `HSpacing(3),
+            `Frame(_("Cache Directory"),
+                `VBox(
+                    `VSquash(`HBox(
+                        `TextEntry(`id("cache_dir"), _("&Directory Name"), ""),
+                        `Bottom(`PushButton(`id(`browse_cache_dir), Label::BrowseButton()))
+                    )),
+                    `VSpacing(0.4),
+                    `IntField(`id("mbytes"), _("&Size (in MB)"), 1, 99999, 1),
+                    `VSpacing(0.4),
+                    `IntField(`id("l1dirs"), _("L&evel 1 Directories"), 1, 99999, 1),
+                    `VSpacing(0.4),
+                    `IntField(`id("l2dirs"), _("Le&vel 2 Directories"), 1, 99999, 1)
+                )
             ),
             `HSpacing(3)
         );

Modified: trunk/squid/src/handlers.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/handlers.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/handlers.ycp (original)
+++ trunk/squid/src/handlers.ycp Tue Sep 11 13:42:50 2007
@@ -99,18 +99,11 @@
 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"){
+    //cache_min_object_size <= cache_max_object_size
+    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) *
@@ -142,6 +135,21 @@
     return nil;
 }
 
+symbol HandleCacheDirectoryDialog(string widget_id, map event_map)
+{
+    any ui = event_map["ID"]:nil;
+    string cache_dir = "";
+
+    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);
+        }
+    }
+
+    return nil;
+}
+
 symbol HandleAccessControlDialog(string widget_id, map event_map)
 {
     any ui = event_map["ID"]:nil;

Modified: trunk/squid/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/helps.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/helps.ycp (original)
+++ trunk/squid/src/helps.ycp Tue Sep 11 13:42:50 2007
@@ -128,6 +128,15 @@
 </table>
 </p>"),
 
+    /* Cache Directory */
+    "cache_directory" :
+_("<p><b>Directory Name</b> defines a top-level directory where cache swap files will be stored.</p>") +
+_("<p><b>Size</b> defines the amount of disk space (in MB) to use under this directory.</p>") +
+_("<p><b>Level 1 Directories</b> defines number of first-level subdirectories which
+will be created under the <b>Directory Name</b> directory.</p>") +
+_("<p><b>Level 2 Directories</b> defines number of second-level subdirectories which will be created
+under each first-level directory.</p>"),
+
 
     /* ACL Groups */
     "acl_groups" :

Modified: trunk/squid/src/inits.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/inits.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/inits.ycp (original)
+++ trunk/squid/src/inits.ycp Tue Sep 11 13:42:50 2007
@@ -155,11 +155,7 @@
         "cache_swap_low" : tointeger((set["cache_swap_low"]:[])[0]:""),
         "cache_swap_high" : tointeger((set["cache_swap_high"]:[])[0]:""),
         "cache_replacement_policy" : (set["cache_replacement_policy"]:[])[0]:"",
-        "memory_replacement_policy" : (set["memory_replacement_policy"]:[])[0]:"",
-        "cache_dir" : (set["cache_dir"]:[])[1]:"",
-        "mbytes" : tointeger((set["cache_dir"]:[])[2]:""),
-        "l1dirs" : tointeger((set["cache_dir"]:[])[3]:""),
-        "l2dirs" : tointeger((set["cache_dir"]:[])[4]:"")
+        "memory_replacement_policy" : (set["memory_replacement_policy"]:[])[0]:""
     ]);
     UI::ChangeWidget(`id("cache_max_object_size"), `Notify, true);
     UI::ChangeWidget(`id("cache_min_object_size"), `Notify, true);
@@ -169,6 +165,17 @@
     UI::ChangeWidget(`id("cache_swap_low"), `Notify, true);
     UI::ChangeWidget(`id("cache_swap_high"), `Notify, true);
 }
+
+void InitCacheDirectoryDialog(string key)
+{
+    map<string, list> set = (map<string, list>)Squid::GetSettings();
+    simpleInit($[
+        "cache_dir" : (set["cache_dir"]:[])[1]:"",
+        "mbytes" : tointeger((set["cache_dir"]:[])[2]:""),
+        "l1dirs" : tointeger((set["cache_dir"]:[])[3]:""),
+        "l2dirs" : tointeger((set["cache_dir"]:[])[4]:"")
+    ]);
+}
 /*****************  CACHE DIALOG END  *************/
 
 

Modified: trunk/squid/src/store_del.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/store_del.ycp?rev=40846&r1=40845&r2=40846&view=diff
==============================================================================
--- trunk/squid/src/store_del.ycp (original)
+++ trunk/squid/src/store_del.ycp Tue Sep 11 13:42:50 2007
@@ -159,6 +159,41 @@
     boolean ok = true;
 
     if (event["ID"]:nil != `abort){
+        integer cache_mem = (integer)UI::QueryWidget(`id("cache_mem"), `Value) *
+                            unitToMultiple((string)UI::QueryWidget(`id("cache_mem_units"), `Value));
+        list<string> cache_dir_str = Squid::GetSetting("cache_dir");
+        integer cache_dir_mbytes = tointeger(cache_dir_str[2]:"0") * 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 (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)
+{
+    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)]);
+}
+
+
+boolean ValidateCacheDirectoryDialog(string widget_id, map event)
+{
+    boolean ok = true;
+
+    if (event["ID"]:nil != `abort){
         string cache_dir = (string)UI::QueryWidget(`id("cache_dir"), `Value);
 
         if (size(cache_dir) == 0){
@@ -167,11 +202,11 @@
         }else if (Mode::normal() && !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));
+            list<string> cache_mem_str = Squid::GetSetting("cache_mem");
+            integer cache_mem = tointeger(cache_mem_str[0]:"0") * unitToMultiple((string)cache_mem_str[1]:"KB");
             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));
+            list<string> max_obj_size_str = Squid::GetSetting("maximum_object_size");
+            integer max_obj_size = tointeger(max_obj_size_str[0]:"0") * unitToMultiple((string)max_obj_size_str[1]:"KB");
 
             if (max_obj_size > cache_mem + cache_dir_mbytes){
                 ok = false;
@@ -182,7 +217,7 @@
 
     return ok;
 }
-void StoreDataFromCache2Dialog(string widget_id, map event)
+void StoreDataFromCacheDirectoryDialog(string widget_id, map event)
 {
     list squid_cache_dir = Squid::GetSetting("cache_dir");
 
@@ -192,16 +227,6 @@
          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  ****************/
 

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

< Previous Next >
This Thread
  • No further messages