allow multienums to be optionally populated from *_Application::initPrefs() the same...
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 31 Jan 2010 20:01:05 +0000 (15:01 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 31 Jan 2010 20:01:05 +0000 (15:01 -0500)
horde/templates/prefs/multienum.inc
turba/lib/Application.php

index 726f0c1..010c2b7 100644 (file)
@@ -1,6 +1,6 @@
 <?php echo Horde::label($pref, $_prefs[$pref]['desc']) ?>&nbsp;<?php echo $helplink ?><br />
 <select id="<?php echo $pref ?>" multiple="multiple" size="<?php echo min(4, count($_prefs[$pref]['enum'])) ?>" name="<?php echo $pref ?>[]">
-<?php $selected = @unserialize($prefs->getValue($pref)); if (!$selected) $selected = array(); foreach ($_prefs[$pref]['enum'] as $key => $val): ?>
+<?php $selected = @unserialize($prefs->getValue($pref)); if (!$selected) $selected = array(); if (empty($_prefs[$pref]['enum'])) $_prefs[$pref]['enum'] = Horde_Util::nonInputVar($pref . '_options'); foreach ($_prefs[$pref]['enum'] as $key => $val): ?>
 <option<?php echo in_array($key, $selected) ? ' selected="selected" ' : '' ?> value="<?php echo htmlspecialchars($key) ?>"><?php echo htmlspecialchars($val) ?></option>
 <?php endforeach ?>
 </select>
index 709e21c..4f84c36 100644 (file)
@@ -176,12 +176,13 @@ class Turba_Application extends Horde_Registry_Application
             }
         }
 
+        $out['sync_books_options'] = array();
         foreach (Turba::getAddressBooks() as $key => $curSource) {
             if (empty($curSource['map']['__uid'])) {
                 continue;
             }
             if (!empty($curSource['browse'])) {
-                $GLOBALS['_prefs']['sync_books']['enum'][$key] = $curSource['title'];
+                $out['sync_books_options'][$key] = $curSource['title'];
             }
             $sync_books = @unserialize($GLOBALS['prefs']->getValue('sync_books'));
             if (empty($sync_books)) {