Marklets
Description
Many of us work on multiple computers and use PmWiki to track essential information. However, we still need a way to quickly and easily manage bookmarks. Marklets improves the similar approach in Cookbook:AddLinkBookmarklet by giving the user two ways to add categorical bookmarks to a wiki site---manual mode and "hurry mode," and by providing a mechanism to remove unwanted bookmarks. The impact is an easy-to-use bookmark management system accessible whenever you are on the Internet. This should help you track the sites that are important to you.
Notes
Setup
There are two phases to setting up this recipe. I use Mozilla Firefox, so this should work for the various contemporary versions of Mozilla. I have not tested this recipe on IE, so please comment as to your success. The first phase prepares the server to use the marklets. The second phase prepares your web client to add bookmarks. The "marklet" links provided by this recipe are javascript codelets that grab information from a focused web page (i.e., the page you are viewing when the javascript is activated).
Phase One: Server Preparation.
- Download Attach:marklets-0.9.2.phpΔ to your web server and place in the
/cookbook
directory. - Add the script to your
local/config.php
by addinginclude_once("$FarmC/marklets-0-9.php");
(where $FarmC is the path-to-cookbook). - Via the browser, add the
(:marklet-codelets:)
markup to pages where you want bookmarks added. I created a group "Bookmarks" and added the markup toBookmarks/GroupFooter
. Then, to create categories, I would create a page "Bookmarks/Bookmarks-Technical
." With the page name, it is important that categories are hyphen delimited (e.g.Bookmarks-Technical
). I will explain this in greater detail below. - Verify the marklet markup works. Look at the page where you added the markup. You should see two links, one of which has a "hurry mode."
Phase Two: Client Preparation.
- I use the bookmark toolbar, so I will show this approach.
- Add a Folder (right-clicking the toolbar) to the bookmark toolbar. I named my folder "Marklets"
- Visit the page on your wiki where you want your marklet to save the bookmarks.
- Add a Bookmark (right-clicking the new folder) to the bookmark toolbar.
- Give it a name, I like to use the category.
- Copy the link location for the "hurry mode" link.
- Save the snippet to the Bookmark location.
- Repeat for each "hurry" bookmark.
After adding the "hurry" marklets, let's add a normal marklet.
- Go to the group's main page (e.g.
Bookmarks/Bookmarks
). - Add a Bookmark to the Marklet folder
- Give it a pithy name like "Manual Marklet"
- Copy the link location for the non-hurry mode link.
- Save the snippet to the Bookmark location.
Managing Bookmarks
There are two ways to add a bookmark: manually and "hurry." We will now explore each in turn. There are two terms worth mentioning here to reduce confusion. First, the "focused" web page is the page you are viewing and of which you want to create a bookmark. The "targeted" web page is the bookmark category page you where you want the bookmark to be added. In both methods below, the date the marklet was added will be timestamped.
Adding Manual Marklets. To create a bookmark manually, visit the page you want bookmarked. Assuming you've followed the phases above, you will have a "Manual Marklet" in a "Marklet" folder on the Mozilla bookmark toolbar. Click open the Folder, then click the "Manual Marklet" bookmark. This will grab the focused page's address and title, and feed this information to a form on your PmWiki site.
The form has a few fields that we should discuss briefly. As mentioned above, the title and address are pre-loaded, but you can edit them. There is also a "description" field that allows you to provide a terse description of the site. There is also a "category" pulldown list and a "add category" field. The "category" pulldown contains the category pages (e.g. Bookmarks-Technical
, Bookmarks-Productivity
become Technical and Productivity categories, respectively). So, if you want to add the link to an already-existing page, select the respective category. However, if you want to create a new page, then you will add the category name (e.g. Business, which will become Bookmarks-Business
) in the "add category" field. This field preempts any selected category in the pulldown, so leave this field blank if you want to add to an existing category. Submit the form, which creates the marklet. The browser window will display the targeted page when the marklet is added.
Adding Hurry Marklets. This is a lot easier. While on the focused web page, open the marklet bookmark as discussed above (e.g. Bookmark-Technical, which is the "targeted" page). This will grab the web page's address and title, and automatically create a link on the targeted page. The browser window will display the targeted page when the marklet is added.
Deleting Marklets. Deleting marklets should be intuitive, but I will briefly mention it here. When looking at the PmWiki category page, click the "Delete" link. This link only appears when the user is logged into the system and has the ability to edit the page.
Categories. This system provides categories to help the user
organize his bookmarks. The page category follows the hyphen (-). For
example, links on the Bookmarks.Bookmarks-Example
page belong to the
"Example" category. This is site-customizeable, using the
$MarkletSplitPoint
varable.
Some administrators may prefer to have the category be an integral part
of the page name, such as Bookmarks.BookmarksExample
for the Example
category. To use this category structure, set $MarkletSplitPoint
to
".Bookmarks"---the leading period is important.
Alternatively, a site administrator may prefer the category name be the page name itself. For example, Bookmarks.Example
for "Example," or even Bookmarks.BookmarksExample
for "BookmarksExample." Set $MarkletSplitPoint
to '\.' to use this structure.
Finally, in an effor to empower the site administator, the
$MarkletCategories
variable provides a configurable list of
categories. This can either be a static array. There is also the
$MarkletCategoriesFunction
, which allows the site-administrator to
create a function to create a dynamic list instead of the default
behavior.
Variables
- $MarkletAddText
- This is the bookmark link text.
- $MarkletAddTextToEnd
- By default, this recipe adds new bookmarks to the top of the list. By setting this variable to a non-zero value, the bookmarks will be appended to the bottom of the list.
- $MarkletCategories
- Provides a configurable list of categories. This can either be a static array, or the array-based output of a site-administrator function.
- $MarkletCategoriesFunction
- allows the site-administrator to create a function to create a dynamic list instead of the default behavior. Default value is the default category-generating formula.
- $MarkletDateFmt
- This is the date format appended to the end of a bookmark link. Default format is '[-[%b %e, %Y (%I:%M %p)]-]';
- $MarkletDeleteText
- This varable allows the site administrator to change the default delete link text from 'Delete.'
- $MarkletDuplicateMark
- (Default: %red% (duplicate)) Allows the site administrator to alter the duplicate link indicator. If this value is set to '', then the indicators will disappear. This does not affect links created prior to 0.9.2.
- $MarkletEnableReturn
- The default behavior of this recipe is as described above---when the bookmark is added, the browser remains on the targeted page. By enabling this variable (i.e. set to a non-zero value), then the
(:marklet-codelet:)
markup will produce javascript codelets that will return the browser window to the page being bookmarked. This can be a little unnerving as the targeted page is not displayed. You can set this value by editing the java codelet in the Bookmark location bar by adding '&return=1' within the quotes. - $MarkletRedirectDelay
- When redirecting is enabled, this variable sets the time the targetted page is displayed before returning to the focused page. Default is 4 seconds;
- $MarkletSplitPoint
- The default behavior of this recipe is to create categories by using a hyphen (-). This variable allows site administrators to alter this behavior, as explained in the "Categories" paragraph in the "Managing Bookmarks" sub-section above.
Release Notes
- v.0.9 - August 2, 2006 BenWilson Initial public release.
- v.0.9.1 - August 3, 2006 BenWilson Public reaction.
- Bug: Fixed problem with delete tag code.
- Bug: Fixed non-functioning $MarkletAddTextToEnd behavior.
- Feature: Delete appears only when user can edit the page.
- Feature: Added $MarkletSplitPoint functionality.
- v.0.9.2 - August 3, 2006 (PM) BenWilson Public reaction, round two.
- Bug: Fixed dup bug.
- Feature: $MarkletCategories, which allows a static list of categories.
- Feature: $MarkletCategoriesFunction, which allows site-admin to code
own dynamic routine for listing categories.
- Feature: Duplicate warning configurable ($MarkletDuplicateMark).
- Feature: Duplicate warning toggleable.
Comments
Please discuss any questions, comments or issues on this recipe's Cookbook:Marklets-Talk page.
See Also
Contributors
- BenWilson original author.
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.