Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions config/hooks.php.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Mnemo Hooks configuration file.
*
Expand All @@ -11,31 +10,30 @@
*
* $Id$
*/
if (!class_exists('Mnemo_Hooks')) {
class Mnemo_Hooks
{
/**
* TODO
*/
// public function format_description($text)
// {
// $text = preg_replace('/#(\d+)/', '<a href="http://bugs.horde.org/ticket/\1">\0</a>', $text);
// $text = preg_replace('/(bug|ticket|request|enhancement|issue):\s*#?(\d+)/i', '<a href="http://bugs.horde.org/ticket/\1">\0</a>', $text);
//
// $text = preg_replace_callback('/\[\[note: ?(.*)\]\]/i', function ($m) { return '<a href="/horde/mnemo/notes/?q=' . urlencode($m[1]) . '">' . htmlspecialchars($m[0]) . '</a>'; }, $text);
// $text = preg_replace_callback('/\[\[task: ?(.*)\]\]/i', function ($m) { return '<a href="/horde/nag/tasks/?q=' . urlencode($m[1]) . '">' . htmlspecialchars($m[0]) . '</a>'; }, $text);
//
// return $text;
// }

class Mnemo_Hooks
{
/**
* TODO
*/
// public function format_description($text)
// {
// $text = preg_replace('/#(\d+)/', '<a href="http://bugs.horde.org/ticket/\1">\0</a>', $text);
// $text = preg_replace('/(bug|ticket|request|enhancement|issue):\s*#?(\d+)/i', '<a href="http://bugs.horde.org/ticket/\1">\0</a>', $text);
//
// $text = preg_replace_callback('/\[\[note: ?(.*)\]\]/i', function ($m) { return '<a href="/horde/mnemo/notes/?q=' . urlencode($m[1]) . '">' . htmlspecialchars($m[0]) . '</a>'; }, $text);
// $text = preg_replace_callback('/\[\[task: ?(.*)\]\]/i', function ($m) { return '<a href="/horde/nag/tasks/?q=' . urlencode($m[1]) . '">' . htmlspecialchars($m[0]) . '</a>'; }, $text);
//
// return $text;
// }


/**
* TODO
*/
// public function description_help()
// {
// return '<p>To create a link to a bug, use #123 where 123 is the bug number. To create a link to another task, use [[task: name]], where name is the beginning of the task name. To create a link to a note, use [[note: title]] where title is the beginning of the note title.</p>';
// }
/**
* TODO
*/
// public function description_help()
// {
// return '<p>To create a link to a bug, use #123 where 123 is the bug number. To create a link to another task, use [[task: name]], where name is the beginning of the task name. To create a link to a note, use [[note: title]] where title is the beginning of the note title.</p>';
// }

}
}
9 changes: 4 additions & 5 deletions config/prefs.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* See horde/config/prefs.php for documentation on the structure of this file.
*
Expand Down Expand Up @@ -75,14 +74,14 @@
'type' => 'enum',
'enum' => array(),
'desc' => _("Your default notepad:"),
'on_init' => function ($ui) {
'on_init' => function($ui) {
$enum = array();
foreach (Mnemo::listNotepads(false, Horde_Perms::EDIT) as $key => $val) {
$enum[$key] = Mnemo::getLabel($val);
}
$ui->prefs['default_notepad']['enum'] = $enum;
},
'on_change' => function () {
'on_change' => function() {
$GLOBALS['injector']->getInstance('Mnemo_Factory_Notepads')
->create()
->setDefaultShare($GLOBALS['prefs']->getValue('default_notepad'));
Expand All @@ -108,7 +107,7 @@
'type' => 'multienum',
'enum' => array(),
'desc' => _("Select the notepads that, in addition to the default, should be used for synchronization with external devices:"),
'on_init' => function ($ui) {
'on_init' => function($ui) {
$enum = array();
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_notepads'));
if (empty($sync)) {
Expand All @@ -125,7 +124,7 @@
}
$ui->prefs['sync_notepads']['enum'] = $enum;
},
'on_change' => function () {
'on_change' => function() {
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_notepads'));
$haveDefault = false;
$default = Mnemo::getDefaultNotepad(Horde_Perms::DELETE);
Expand Down