Merge branch 'autocomplete-tags'
authorBenjamin Mako Hill <mako@atdot.cc>
Sun, 8 Apr 2012 19:21:20 +0000 (15:21 -0400)
committerBenjamin Mako Hill <mako@atdot.cc>
Sun, 8 Apr 2012 19:21:20 +0000 (15:21 -0400)
14 files changed:
api/posts_all.php
api/posts_get.php
api/posts_recent.php
config.inc.php.example
import.php
includes/db/mysql4.php
readme.txt
scuttle.css
services/bookmarkservice.php
tables.sql
templates/bookmarks.tpl.php
templates/editbookmark.tpl.php
templates/toolbar.inc.php
templates/top.inc.php

index 4f05d39e94e7f66069000d45a5fd60ca39395994..747741a695b94f0bf28f01a419a7976fa1f67335 100644 (file)
@@ -8,6 +8,9 @@
 require_once 'httpauth.inc.php';
 require_once '../header.inc.php';
 
+// set user as logged in so private bookmarks are exported
+$loggedon = true;
+
 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
 $userservice     =& ServiceFactory::getServiceInstance('UserService');
 
@@ -42,8 +45,14 @@ foreach($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in the database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) . ($row['bStatus'] ? '" shared="no' : '') .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
index d54f86a4ca06f4cb9d11de46033243a4539a0e72..2c875ecdaaf770d3d56753c9738add43c1240ea6 100644 (file)
@@ -54,8 +54,14 @@ foreach ($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'"  shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
index 476eecb3133ed89004c6ec3670f89621e593e4ff..38124d258d88d548d86e045dfe13b871707f955f 100644 (file)
@@ -1,3 +1,4 @@
+
 <?php
 // Implements the del.icio.us API request for a user's recent posts, optionally filtered by
 // tag and/or number of posts (default 15, max 100, just like del.icio.us).
@@ -55,8 +56,14 @@ foreach ($bookmarks['bookmarks'] as $row) {
     } else {
         $taglist = 'system:unfiled';
     }
+    // The privacy setting in scuttle is to set bStatus to 2 in the database.
+    if(trim($row['bStatus']) == '2') {
+        $shared = "no";
+    } else {
+        $shared = "yes";
+    }
 
-    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+    echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" shared="' . $shared . '" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
 }
 
 echo '</posts>';
index 9d52a2fb3fda85683046b7da92a7e778394e76f7..f690aee8e8e510fb308ecf911585ef8587cf90cc 100644 (file)
@@ -64,14 +64,18 @@ $adminemail = 'admin@example.org';
 #                       be considered recent.
 # defaultOrderBy:   The default order in which bookmarks will appear.
 #                   Possible values are:
-#                   date_desc   - By date of entry descending.
-#                                 Latest entry first. (Default)
-#                   date_asc    - By date of entry ascending.
-#                                 Earliest entry first.
-#                   title_desc  - By title, descending alphabetically.
-#                   title_asc   - By title, ascending alphabetically.
-#                   url_desc    - By URL, descending alphabetically.
-#                   url_asc     - By URL, ascending alphabetically.
+#                   date_desc     - By date of entry descending.
+#                                   Latest entry first. (Default)
+#                   date_asc      - By date of entry ascending.
+#                                   Earliest entry first.
+#                   mod_date_desc - By modification date descending.
+#                                   Latest modified entry first.
+#                   mod_date_asc  - By modification date ascending.
+#                                   Earliest modified entry first.
+#                   title_desc    - By title, descending alphabetically.
+#                   title_asc     - By title, ascending alphabetically.
+#                   url_desc      - By URL, descending alphabetically.
+#                   url_asc       - By URL, ascending alphabetically.
 # TEMPLATES_DIR: The directory where the template files should be
 #                loaded from (the *.tpl.php files)
 # root         : Set to NULL to autodetect the root url of the website
index 9f2972859b2dbe0168e980aacbcf1ff7acf11fd4..5f0c5eeadbb8104a9818a7890db12b18b43f6eec 100644 (file)
@@ -80,6 +80,9 @@ function startElement($parser, $name, $attrs) {
                 case 'TIME':
                     $bDatetime = $attrVal;
                     break;
+                case 'PRIVATE':
+                    $bStatus = (strcasecmp('yes', $attrVal) == 0) ? 2 : $status ;
+                    break;
                 case 'TAG':
                     $tags = strtolower($attrVal);
                     break;
@@ -96,7 +99,7 @@ function startElement($parser, $name, $attrs) {
                 $bDatetime = gmdate('Y-m-d H:i:s');
             }
 
-            if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $tags, $bDatetime, true, true))
+            if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bStatus, $tags, $bDatetime, true, true))
                 $tplVars['msg'] = T_('Bookmark imported.');
             else
                 $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
index 063951816d23adb9c02a07722d450da0d02d390c..f074e19e76be93b649e37e2cc8950d9430833f19 100644 (file)
@@ -44,6 +44,8 @@ class sql_db
                {
                        if (@mysql_select_db($this->dbname))
                        {
+                               #Set utf-8
+                               mysql_query('SET CHARACTER SET utf8', $this->db_connect_id);
                                return $this->db_connect_id;
                        }
                }
index 58a703b74d8496090d2b3ee6d705c75b5ebe2621..faf788e4ab22975036ea651e790358158757d3e3 100644 (file)
@@ -1,7 +1,9 @@
-Scuttle 0.9.0
+Scuttle (Development Snapshot)
 http://scuttle.org/
 
 Copyright (C) 2004 - 2010 Marcus Campbell
+Copyright (C) 2011 Thomas Niepraschk
+Copyright (C) 2011 Benjamin Mako Hill
 Available under the GNU General Public License
 
 ============
@@ -12,4 +14,4 @@ INSTALLATION
 
 * Edit config.inc.php.example and save the changes as a new config.inc.php file in the same directory.
 
-* Set the CHMOD permissions on the /cache/ subdirectory to 777
\ No newline at end of file
+* Set the CHMOD permissions on the /cache/ subdirectory to 777
index fba69334dfe08a46b5a4c341e4d286110978ff3d..57b1ae093319930030738cd4a763af227d6ca5a5 100644 (file)
@@ -181,6 +181,14 @@ div.meta {
 div.meta span {
   color: #F00;
 }
+/* bookmark date fields: updated and created */
+div.meta span#date-updated {
+    color: #285;
+}
+div.meta span#date-original {
+    background: #eee;
+    color: #aaa;
+}
 li.xfolkentry {
   border-bottom: 1px solid #DDD;
   margin-bottom: 0;
index 2a8fb0d53b70f1c8495037310c5e4898483fa126..3d532f647ce2797ca4aac2bfbfe4ea77bc81adab 100644 (file)
@@ -276,6 +276,12 @@ class BookmarkService {
           case 'date_asc':
               $query_5 = ' ORDER BY B.bDatetime ASC ';
               break;
+          case 'mod_date_desc':
+              $query_5 = ' ORDER BY B.bModified DESC ';
+              break;
+          case 'mod_date_asc':
+              $query_5 = ' ORDER BY B.bModified ASC ';
+              break;
           case 'title_desc':
               $query_5 = ' ORDER BY B.bTitle DESC ';
               break;
index 578fa0670986a4e1dcf87cf65013ed61e0910ff5..84cf153a652708715c49997d554fca8b5c30b453 100644 (file)
@@ -11,7 +11,7 @@ CREATE TABLE `sc_bookmarks` (
   `bModified` datetime NOT NULL default '0000-00-00 00:00:00',
   `bTitle` varchar(255) NOT NULL default '',
   `bAddress` text NOT NULL,
-  `bDescription` varchar(255) default NULL,
+  `bDescription` varchar(1000) default NULL,
   `bHash` varchar(32) NOT NULL default '',
   PRIMARY KEY  (`bId`),
   KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`),
@@ -65,4 +65,4 @@ CREATE TABLE `sc_watched` (
   `watched` int(11) NOT NULL default '0',
   PRIMARY KEY  (`wId`),
   KEY `sc_watched_uId` (`uId`)
-);
\ No newline at end of file
+);
index c79655ea229d87fb2c6e2ed31423275583beaf19..a53559074d03f57f9a69358a7b52dabd3113d601 100644 (file)
@@ -100,7 +100,11 @@ if (count($bookmarks) > 0) {
         if ($row['bDescription'] != '') {
             echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
         }
-        echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
+        if ($row['bDatetime'] == $row['bModified']) {
+            echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
+        } else {
+            echo '<div class="meta"><span id="date-updated">updated: '. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . '</span>, <span id="date-original">original: '. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . "</span>" . $cats . $copy . $edit ."</div>\n";
+        }
         echo "</li>\n";
     }
     ?>
index 16b56c7fd0ad47274ad852bcc850e50843ea47ec..2304134db607bc64ca20448a9846c1cec54648d4 100644 (file)
@@ -31,7 +31,7 @@ switch ($row['bStatus']) {
 </tr>
 <tr>
     <th align="left"><?php echo T_('Description'); ?></th>
-    <td><input type="text" name="description" size="75" maxlength="255" value="<?php echo filter($row['bDescription'], 'xml'); ?>" /></td>
+    <td><textarea name="description" cols="74" rows="5" maxlength="1000"><?php echo filter($row['bDescription'], 'xml'); ?></textarea></td>
     <td></td>
 </tr>
 <tr>
@@ -69,7 +69,7 @@ switch ($row['bStatus']) {
 </form>
 <script type="text/javascript">
 $(function() {
-  $("#address").focus();
+  $("#tags").focus();
 });
 </script>
 
@@ -108,4 +108,4 @@ document.write('<\/ul>');
 <?php
 }
 $this->includeTemplate($GLOBALS['bottom_include']); 
-?>
\ No newline at end of file
+?>
index 2eb56ac60e50e133d56545ca7cefefc4b570d7e0..023ed3bcb8f3d850cfdc55b726494e7295a50f7d 100644 (file)
@@ -10,6 +10,7 @@ if ($userservice->isLoggedOn()) {
         <li><a href="<?php echo createURL('watchlist', $cUsername); ?>"><?php echo T_('Watchlist'); ?></a></li>
         <li><a href="<?php echo createURL('bookmarks', $cUsername . '?action=add'); ?>"><?php echo T_('Add a Bookmark'); ?></a></li>
         <li class="access"><a href="<?php echo $GLOBALS['root']; ?>?action=logout"><?php echo T_('Log Out'); ?></a></li>
+        <li class="access"><a href="<?php echo createURL('profile', $cUsername); ?>"><?php echo $cUsername; ?></a></li>
     </ul>
 
 <?php
index d7a6731cef34dc2ec310e1ad1957f9e04050e262..6a1bdb8e9fa8440e2b7accb28354c72b7fac3006 100644 (file)
@@ -39,7 +39,11 @@ if (isset($_GET['popup'])) {
 
 <?php
 if (isset($subtitle)) {
-    echo '<h2>'. $subtitle ."</h2>\n";
+    echo '<h2>'. $subtitle;
+    if (isset($total)) {
+        echo " (" . $total . ")";
+    }
+    echo "</h2>\n";
 }
 if (isset($error)) {
     echo '<p class="error">'. $error ."</p>\n";

Benjamin Mako Hill || Want to submit a patch?