From: Chuck Hagenbuch Date: Fri, 24 Sep 2010 15:59:45 +0000 (-0400) Subject: Initial experiment with sticky-note style for notes. Link directly to stickies.php... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f968eed86e5f7b555ca539c7bd437dd21cb59ff2;p=horde.git Initial experiment with sticky-note style for notes. Link directly to stickies.php to see it. --- diff --git a/mnemo/stickies.php b/mnemo/stickies.php new file mode 100644 index 000000000..9c63d6e97 --- /dev/null +++ b/mnemo/stickies.php @@ -0,0 +1,85 @@ +setValue('sortby', Horde_Util::getFormData('sortby')); +} +if (Horde_Util::getFormData('sortdir') !== null) { + $prefs->setValue('sortdir', Horde_Util::getFormData('sortdir')); +} + +/* Get the full, sorted notepad. */ +$memos = Mnemo::listMemos($prefs->getValue('sortby'), + $prefs->getValue('sortdir')); + +/* Page variables. */ +$title = _("My Notes"); + +switch ($actionID) { +case 'search_memos': + /* If we're searching, only list those notes that match the search + * result. */ + $search_pattern = Horde_Util::getFormData('search_pattern'); + $search_type = Horde_Util::getFormData('search_type'); + $search_desc = ($search_type == 'desc'); + $search_body = ($search_type == 'body'); + + if (!empty($search_pattern) && ($search_body || $search_desc)) { + $search_pattern = '/' . preg_quote($search_pattern, '/') . '/i'; + $search_result = array(); + foreach ($memos as $memo_id => $memo) { + if (($search_desc && preg_match($search_pattern, $memo['desc'])) || + ($search_body && preg_match($search_pattern, $memo['body']))) { + $search_result[$memo_id] = $memo; + } + } + + /* Reassign $memos to the search result. */ + $memos = $search_result; + $title = _("Search Results"); + } + break; +} + +require MNEMO_TEMPLATES . '/common-header.inc'; +echo Horde::menu(); +$notification->notify(); +require MNEMO_TEMPLATES . '/list/header.inc'; + +if (count($memos)) { + $cManager = new Horde_Prefs_CategoryManager(); + $colors = $cManager->colors(); + $fgcolors = $cManager->fgColors(); + $sortby = $prefs->getValue('sortby'); + $sortdir = $prefs->getValue('sortdir'); + $showNotepad = $prefs->getValue('show_notepad'); + + $baseurl = 'list.php'; + if ($actionID == 'search_memos') { + $baseurl = Horde_Util::addParameter( + $baseurl, + array('actionID' => 'search_memos', + 'search_pattern' => $search_pattern, + 'search_type' => $search_type)); + } + + require MNEMO_TEMPLATES . '/stickies.html.php'; +} else { + require MNEMO_TEMPLATES . '/list/empty.inc'; +} + +require MNEMO_TEMPLATES . '/panel.inc'; +require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/mnemo/templates/stickies.html.php b/mnemo/templates/stickies.html.php new file mode 100644 index 000000000..77553e87d --- /dev/null +++ b/mnemo/templates/stickies.html.php @@ -0,0 +1,111 @@ + + + + +
+ +
diff --git a/mnemo/themes/categoryCSS.php b/mnemo/themes/categoryCSS.php index baffc29f4..00c81b8a5 100644 --- a/mnemo/themes/categoryCSS.php +++ b/mnemo/themes/categoryCSS.php @@ -28,4 +28,17 @@ foreach ($colors as $category => $color) { . 'color: ' . (isset($fgColors[$category]) ? $fgColors[$category] : $fgColors['_default_']) . '; ' . 'background: ' . $color . '; ' . "padding: 0 4px; }\n"; + + $hex = str_replace('#', '', $color); + if (strlen($hex) == 3) { + $r = hexdec(substr($hex, 0, 1)); + $g = hexdec(substr($hex, 1, 1)); + $b = hexdec(substr($hex, 2, 1)); + } else { + $r = hexdec(substr($hex, 0, 2)); + $g = hexdec(substr($hex, 2, 2)); + $b = hexdec(substr($hex, 4, 2)); + } + echo "div.mnemo-stickies ul li a$class { color: black; " + . "background: rgba($r, $g, $b, 0.5); }"; }