[dev] patch for horde/portal_edit.php

Amith Varghese amith at xalan.com
Mon Sep 29 06:11:33 PDT 2003


If you have no portal layout defined (i.e. the prefname portal_layout isn't
saved as one of your preferences) a couple of warnings are printed out when you
try to define a layout.  I would have thought that the default prefs from
config/prefs.php are read in, but it doesn't seem like that (on my setup
portal_layout is NULL).  If this is the intended behaviour then this patch
fixes those warnings.

Amith
-------------- next part --------------
Index: portal_edit.php
===================================================================
RCS file: /repository/horde/portal_edit.php,v
retrieving revision 1.14
diff -u -r1.14 portal_edit.php
--- portal_edit.php	16 Sep 2003 23:03:15 -0000	1.14
+++ portal_edit.php	29 Sep 2003 13:18:34 -0000
@@ -224,7 +224,10 @@
 
 // Load layout from preferences
 $layout = array();
-$layout_pref = unserialize($prefs->getValue('portal_layout'));
+$pref_value = $prefs->getValue('portal_layout');
+if (isset($pref_value)) {
+    $layout_pref = unserialize($pref_value);
+}
 
 // Handle requested actions
 switch ($action) {
@@ -622,25 +625,28 @@
 }
 
 // Save changes.
-$prefs->setValue('portal_layout', serialize($layout_pref));
+if (isset($layout_pref)) {
+    $prefs->setValue('portal_layout', serialize($layout_pref));
+}
 
-// Create all the blocks for display.
-foreach ($layout_pref as $row_num => $row) {
-    foreach ($row as $col_num => $item) {
-        if (is_array($item)) {
-            $layout[$row_num][$col_num] = $registry->callByPackage($item['app'], 'block', $item['params']);
-            if (isset($item['height'])) {
-                $layout[$row_num][$col_num]->setHeight($item['height']);
-            }
-            if (isset($item['width'])) {
-                $layout[$row_num][$col_num]->setWidth($item['width']);
+if (isset($layout_pref)) {
+    // Create all the blocks for display.
+    foreach ($layout_pref as $row_num => $row) {
+        foreach ($row as $col_num => $item) {
+            if (is_array($item)) {
+                $layout[$row_num][$col_num] = $registry->callByPackage($item['app'], 'block', $item['params']);
+                if (isset($item['height'])) {
+                    $layout[$row_num][$col_num]->setHeight($item['height']);
+                }
+                if (isset($item['width'])) {
+                    $layout[$row_num][$col_num]->setWidth($item['width']);
+                }
+            } else {
+                $layout[$row_num][$col_num] = null;
             }
-        } else {
-            $layout[$row_num][$col_num] = null;
         }
     }
 }
-
 // Create block selection options.
 $blockselectoptions = '';
 foreach ($blocks as $app => $appblocks) {


More information about the dev mailing list