Initial experiment with sticky-note style for notes. Link directly to stickies.php...
authorChuck Hagenbuch <chuck@horde.org>
Fri, 24 Sep 2010 15:59:45 +0000 (11:59 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 24 Sep 2010 15:59:45 +0000 (11:59 -0400)
mnemo/stickies.php [new file with mode: 0644]
mnemo/templates/stickies.html.php [new file with mode: 0644]
mnemo/themes/categoryCSS.php

diff --git a/mnemo/stickies.php b/mnemo/stickies.php
new file mode 100644 (file)
index 0000000..9c63d6e
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * $Horde: mnemo/list.php,v 1.58 2009/11/29 18:37:52 chuck Exp $
+ *
+ * Copyright 2001-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file LICENSE for license information (ASL). If you
+ * did not receive this file, see http://www.horde.org/licenses/asl.php.
+ */
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('mnemo');
+
+/* Get the current action ID. */
+$actionID = Horde_Util::getFormData('actionID');
+
+/* Sort out the sorting values. */
+if (Horde_Util::getFormData('sortby') !== null) {
+    $prefs->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 (file)
index 0000000..77553e8
--- /dev/null
@@ -0,0 +1,111 @@
+<style>
+div.mnemo-stickies {
+    font-family:arial,sans-serif;
+    font-size:100%;
+    color:#fff;
+}
+div.mnemo-stickies ul, li {
+    list-style: none;
+}
+div.mnemo-stickies ul {
+    overflow: hidden;
+}
+div.mnemo-stickies ul li a {
+    text-decoration: none;
+    display: block;
+    height: 10em;
+    width: 10em;
+    padding: 1em;
+    overflow: hidden;
+    -moz-box-shadow:5px 5px 7px rgba(99,99,99,1);
+    -webkit-box-shadow: 5px 5px 7px rgba(99,99,99,.7);
+    box-shadow: 5px 5px 7px rgba(99,99,99,.7);
+    -moz-transition:-moz-transform .15s linear;
+    -o-transition:-o-transform .15s linear;
+    -webkit-transition:-webkit-transform .15s linear;
+}
+div.mnemo-stickies ul li {
+    margin: 1em;
+    float: left;
+}
+div.mmemo-stickies ul li h2 {
+    font-family: 'Nobile', arial, sans-serif;
+    font-size: 140%;
+    font-weight: bold;
+    padding-bottom: 10px;
+}
+div.mnemo-stickies ul li p {
+    font-family: 'Nobile', arial, sans-serif;
+    font-size: 100%;
+}
+div.mnemo-stickies ul li:nth-child(even) a {
+  -o-transform:rotate(2deg);
+  -webkit-transform:rotate(2deg);
+  -moz-transform:rotate(2deg);
+  position:relative;
+  top:5px;
+}
+div.mnemo-stickies ul li:nth-child(3n) a {
+  -o-transform:rotate(-1deg);
+  -webkit-transform:rotate(-1deg);
+  -moz-transform:rotate(-1deg);
+  position:relative;
+  top:-5px;
+}
+div.mnemo-stickies ul li:nth-child(5n) a {
+  -o-transform:rotate(3deg);
+  -webkit-transform:rotate(3deg);
+  -moz-transform:rotate(3deg);
+  position:relative;
+  top:-10px;
+}
+div.mnemo-stickies ul li a:hover, div.stickies ul li a:focus{
+  -moz-box-shadow:10px 10px 7px rgba(66,66,66,.7);
+  -webkit-box-shadow: 10px 10px 7px rgba(66,66,66,.7);
+  box-shadow:10px 10px 7px rgba(66,66,66,.7);
+  -webkit-transform: scale(1.25);
+  -moz-transform: scale(1.25);
+  -o-transform: scale(1.25);
+  position:relative;
+  z-index:5;
+}
+</style>
+
+<link href="//fonts.googleapis.com/css?family=Nobile:regular,bold&subset=latin" rel="stylesheet" type="text/css">
+
+<div class="mnemo-stickies">
+<ul>
+<?php
+foreach ($memos as $memo_id => $memo) {
+    $viewurl = Horde_Util::addParameter(
+        'view.php',
+        array('memo' => $memo['memo_id'],
+              'memolist' => $memo['memolist_id']));
+
+    $memourl = Horde_Util::addParameter(
+        'memo.php', array('memo' => $memo['memo_id'],
+                          'memolist' => $memo['memolist_id']));
+    try {
+        $share = $GLOBALS['mnemo_shares']->getShare($memo['memolist_id']);
+        $notepad = $share->get('name');
+    } catch (Horde_Share_Exception $e) {
+        $notepad = $memo['memolist_id'];
+    }
+
+    if ($share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+    }
+
+    $preview = ($memo['body'] != $memo['desc']) ? Mnemo::getNotePreview($memo) : '';
+    $preview = trim(substr($preview, strlen($memo['desc'])));
+?>
+  <li>
+    <a href="#" class="category<?php echo md5($memo['category']) ?>">
+      <h2><?php echo htmlspecialchars($memo['desc']) ?></h2>
+      <p><?php echo htmlspecialchars($preview) ?></p>
+    </a>
+  </li>
+<?php
+}
+?>
+</ul>
+</div>
index baffc29..00c81b8 100644 (file)
@@ -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); }";
 }