Added ability to set default ordering of bookmarks to modified date
authorBart Lantz <bartlantz@gmail.com>
Sat, 17 Dec 2011 02:01:02 +0000 (19:01 -0700)
committerBart Lantz <bartlantz@gmail.com>
Sat, 17 Dec 2011 03:15:32 +0000 (20:15 -0700)
This allows you to set default bookmark ordering to be last modified
date, so if you bookmark a URL and it is already bookmarked and you
save it again, then it will appear with most recent bookmarks, instead
of three years ago, for instance. Set this option in config.inc.php.

config.inc.php.example
services/bookmarkservice.php

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 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;

Benjamin Mako Hill || Want to submit a patch?