<?php
/**
- * $Horde: mnemo/config/prefs.php.dist,v 1.31 2009/07/08 18:29:42 slusarz Exp $
- *
* See horde/config/prefs.php for documentation on the structure of this file.
+ *
+ * $Id$
*/
-// Make sure that constants are defined.
-require_once dirname(__FILE__) . '/../lib/Mnemo.php';
-
$prefGroups['display'] = array(
'column' => _("General Options"),
'label' => _("Display Options"),
'column' => _("General Options"),
'label' => _("Default Notepad"),
'desc' => _("Choose your default Notepad."),
- 'members' => array('notepadselect')
+ 'members' => array('default_notepad')
);
$prefGroups['deletion'] = array(
// show a notepad column in the list view?
$_prefs['show_notepad'] = array(
'value' => 0,
- 'locked' => false,
- 'shared' => false,
'type' => 'checkbox',
'desc' => _("Should the Notepad be shown in its own column in the List view?")
);
// show the notepad options panel?
// a value of 0 = no, 1 = yes
$_prefs['show_panel'] = array(
- 'value' => 1,
- 'locked' => false,
- 'shared' => false,
- 'type' => 'implicit',
+ 'value' => 1
);
// user preferred sorting column
$_prefs['sortby'] = array(
'value' => MNEMO_SORT_DESC,
- 'locked' => false,
- 'shared' => false,
'type' => 'enum',
- 'enum' => array(MNEMO_SORT_DESC => _("Note Text"),
- MNEMO_SORT_CATEGORY => _("Note Category"),
- MNEMO_SORT_NOTEPAD => _("Notepad")),
+ 'enum' => array(
+ MNEMO_SORT_DESC => _("Note Text"),
+ MNEMO_SORT_CATEGORY => _("Note Category"),
+ MNEMO_SORT_NOTEPAD => _("Notepad")
+ ),
'desc' => _("Default sorting criteria:")
);
// user preferred sorting direction
$_prefs['sortdir'] = array(
'value' => 0,
- 'locked' => false,
- 'shared' => false,
'type' => 'enum',
- 'enum' => array(MNEMO_SORT_ASCEND => _("Ascending"),
- MNEMO_SORT_DESCEND => _("Descending")),
+ 'enum' => array(
+ MNEMO_SORT_ASCEND => _("Ascending"),
+ MNEMO_SORT_DESCEND => _("Descending")
+ ),
'desc' => _("Default sorting direction:")
);
// user note categories
$_prefs['memo_categories'] = array(
- 'value' => '',
- 'locked' => false,
- 'shared' => false,
- 'type' => 'implicit'
+ 'value' => ''
);
// category highlight colors
$_prefs['memo_colors'] = array(
- 'value' => '',
- 'locked' => false,
- 'shared' => false,
- 'type' => 'implicit'
+ 'value' => ''
);
-// default notepad selection widget
-$_prefs['notepadselect'] = array('type' => 'special');
-
// default notepad
// Set locked to true if you don't want users to have multiple notepads.
$_prefs['default_notepad'] = array(
'value' => Horde_Auth::getAuth() ? Horde_Auth::getAuth() : 0,
- 'locked' => false,
- 'shared' => false,
- 'type' => 'implicit'
+ 'type' => 'enum',
+ 'desc' => _("Your default notepad:")
);
// store the notepads to diplay
$_prefs['display_notepads'] = array(
- 'value' => 'a:0:{}',
- 'locked' => false,
- 'shared' => false,
- 'type' => 'implicit'
+ 'value' => 'a:0:{}'
);
// preference for delete confirmation dialog.
$_prefs['delete_opt'] = array(
'value' => 1,
- 'locked' => false,
- 'shared' => false,
'type' => 'checkbox',
'desc' => _("Do you want to confirm deleting entries?")
);
* @var string
*/
public $version = 'H4 (3.0-git)';
-
+
/**
* Initialization function.
- *
+ *
* Global variables defined:
* $mnemo_shares - TODO
*/
{
// Set the timezone variable.
Horde_Nls::setTimeZone();
-
+
// Create a share instance.
$GLOBALS['mnemo_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
-
+
Mnemo::initialize();
}
-
+
+ /**
+ * Code to run on init when viewing prefs for this application.
+ *
+ * @param Horde_Core_Prefs_Ui $ui The UI object.
+ */
+ public function prefsInit($ui)
+ {
+ global $conf, $prefs, $registry;
+
+ switch ($ui->group) {
+ case 'share':
+ if (!$prefs->isLocked('default_notepad')) {
+ $notepads = array();
+ foreach (Mnemo::listNotepads() as $key => $val) {
+ $notepads[htmlspecialchars($key)] = htmlspecialchars($val->get('name'));
+ }
+ $ui->override['default_tasklist'] = $notepads;
+ }
+ break;
+ }
+ }
+
/**
* Generate the menu to use on the prefs page.
*
+++ /dev/null
-<?php
-if (!$prefs->isLocked('default_notepad')):
- $notepads = Mnemo::listNotepads();
- if (($default_notepad = $prefs->getValue('default_notepad')) == null ||
- !isset($notepads[$default_notepad])) {
- $default_notepad = Horde_Auth::getAuth();
- }
-?>
-
-<?php echo Horde::label('default_notepad', _("Your default notepad:")) ?><br />
-<select id="default_notepad" name="default_notepad">
-<?php foreach (array_keys($notepads) as $id): ?>
- <option value="<?php echo htmlspecialchars($id) ?>"<?php if ($id == $default_notepad) echo ' selected="selected"' ?>><?php echo htmlspecialchars($notepads[$id]->get('name')) ?></option>
-<?php endforeach; ?>
-</select><br /><br />
-<?php endif; ?>