Skip to content

Commit

Permalink
Item8445: Rename some files, use JQueryPlugin Makefile for compressio…
Browse files Browse the repository at this point in the history
…n/minification, add some comments, switch back to original queryobject jq plugin, Foswiki:Main.ContributorName the change history somewhat. TODO: actually implement create-missing-tag-on-submit feature, as documented.

git-svn-id: http://svn.foswiki.org/trunk/TagMePlugin@6270 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Feb 11, 2010
1 parent 9932ff4 commit 89c7012
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 38 deletions.
5 changes: 2 additions & 3 deletions data/System/TagMeAjaxHelper.txt
Expand Up @@ -12,8 +12,8 @@
text="<meta name='foswiki.TagMePlugin.jquitags'
content='%TAGME{tpaction="%URLPARAM{"tpaction" default="showalltags"}%"
tag="%URLPARAM{"tptag"}%" web="%BASEWEB%" topic="%BASETOPIC%" separator=","}%'
/><script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/%TOPIC%/jqui.js'></script>
<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/TagMeAjaxHelper/jqui.css'
/><script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/%TOPIC%/jquery.tagmeui.js'></script>
<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/TagMeAjaxHelper/jquery.tagmeui.css'
type='text/css' media='all'/>"
requires="JQUERYPLUGIN::TEXTBOXLIST, JQUERYPLUGIN::AUTOCOMPLETE, JQUERYPLUGIN::SIMPLEMODAL, JQUERYPLUGIN::HOVERINTENT, JQUERYPLUGIN::QUERYOBJECT"
}%<div id='tagmejqcontainer'><span id="tagmejqtagstatus">&nbsp;</span>
Expand All @@ -29,7 +29,6 @@
then="%MAKETEXT{"all webs"}%"
else="%MAKETEXT{"[[[_1].WebHome][[_1]]] web" args="%URLPARAM{"tpweb"}%"}%"
}%
<br/>
<form id="tagmeWebSelect" method="post" action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%">
<input type="checkbox" id="tagmeCheckboxJustThisWeb" name="tpweb"\
value="%URLPARAM{"tpweb"}%" %IF{"'%URLPARAM{"tpweb"}%'=''" then="checked='checked'"}%\
Expand Down
60 changes: 36 additions & 24 deletions data/System/TagMePlugin.txt
Expand Up @@ -59,20 +59,32 @@ will see:

<div class="foswikiImage"><img src="%ATTACHURLPATH%/topictags_styleblog_open.gif" alt="Screenshot of tags on a topic, style=blog" width="489" height="464" /></div>

---++++ "ajax" option
---++++ "jqui"
An experimental interactive user interface is also provided, implemented using the latest version of JQueryPlugin in TagMeAjaxHelper.

All features work without having to re-load the topic:
* Auto-complete tag names. Saves newly selected tags immediately
* If auto-complete fails to match the entered tag and the user submits
it, the tag is immediately created and applied
* Access tag cloud in a modal dialogue at the click of a button. Check-box
toggles are applied immediately (show cloud for just this web/all webs,
just my tags/all tags)
* Clicking a tag from the topic's tag list or tag cloud takes you to
the TagMeSearch topic, where the tag cloud will still be generated
from the originating web (avoids reliance on browser back button
when exploring a web via tag cloud)

Include it into your WebTopBar (See WebTopBarExample) or any part of your skin that has horizontal space to spare, as follows:
<verbatim class="tml">%INCLUDE{"%SYSTEMWEB%.TagMeAjaxHelper" section="jqui"}%</verbatim>

<div class="foswikiImage"><img src="%ATTACHURLPATH%/jqui.png" alt="Screenshot of experimental jQuery UI" width="522" height="156" /></div>
<div class="foswikiImage"><img src="%ATTACHURLPATH%/jquery.tagmeui.png" alt="Screenshot of experimental jQuery UI" width="522" height="156" /></div>

Dependencies:
* JQueryPlugin
* =textboxlist=
* =simplemodal=
* =autocomplete=
* =hoverintent=
* [[JQueryTextboxList][textboxlist]]
* [[JQuerySimpleModal][simplemodal]]
* [[JQueryAutocomplete][autocomplete]]
* [[JQueryQueryObject][queryobject]]
* FilterPlugin

---+++ Create, Rename, Delete tags
Expand Down Expand Up @@ -361,25 +373,25 @@ topic. Use the standard preference setting topics, such as
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 31 Jan 2010: | [[Main.PaulHarvey][Paul Harvey]]: Added an interactive user interface implemented with JQuery |
| 31 Jan 2010: | Foswiki:Main.PaulHarvey: Added an interactive user interface implemented with JQuery |
| 11 Jun 2009: | Foswiki port, and moved settings out of this topic |
| 30 Aug 2008: | Colas Nahaboo: enhancements to the "blog" style: Bundles, count of known tags, option to delete tags |
| 28 Aug 2008: | Colas Nahaboo: prefix & suffix options renamed as header & footer. New parameter style to TAGME to be able to define different UI style for the default "show" action of TAGME. Implemented a first one, "blog" for the simpler case of authors managing the same tags |
| 26 Aug 2008: | Colas Nahaboo: prefix & suffix options to TAGME |
| 16 Oct 2007: | Arthur Clemens: added backward compatible example template. |
| 30 Aug 2008: | Foswiki:Main.ColasNahaboo: enhancements to the "blog" style: Bundles, count of known tags, option to delete tags |
| 28 Aug 2008: | Foswiki:Main.ColasNahaboo: prefix & suffix options renamed as header & footer. New parameter style to TAGME to be able to define different UI style for the default "show" action of TAGME. Implemented a first one, "blog" for the simpler case of authors managing the same tags |
| 26 Aug 2008: | Foswiki:Main.ColasNahaboo: prefix & suffix options to TAGME |
| 16 Oct 2007: | Foswiki:Main.ArthurClemens: added backward compatible example template. |
| 26 Sep 2007: | Foswiki:Main.CrawfordCurrie Item4728 fixed incorrect cloud font sizes to reflect relative importance of tags actually being displayed |
| 11 Sep 2007: | Arthur Clemens: updated example template to TWiki template convention. |
| 11 Jun 2007: | Arthur Clemens: fixed sizing of tags with the same tag count; fixed CSS class for select box; updated documentation with "How to put tags on every page". |
| 07 Jun 2007: | Arthur Clemens: removed dependency on (unreleased) TWiki 4.2. |
| 21 May 2007: | TWiki:Main.WillNorris: added =view.tagme.tmpl= and updated installation instructions. |
| 30 Apr 2007: | Arthur Clemens: fixed calculation of sizes in tag cloud; if =mincount= is passed only the shown tags are calculated. |
| 18 Apr 2007: | Arthur Clemens: added permissions for rename and delete; added TagMeChangeRequests. |
| 17 Apr 2007: | TWiki:Main.CrawfordCurrie for [[http://www.escapestudios.co.uk/][Escape Studios]]: contributed support for incremental refinement of tag searches. |
| 12 Apr 2007: | TWiki:Main.CrawfordCurrie contributed ability to search for multiple tags. TWiki:Main.SvenDowideit for [[http://www.escapestudios.co.uk/][Escape Studios]]: added parameters needed for custom search result display. |
| 05 Apr 2007: | Arthur Clemens: The "topic tags" select box is now created with Javascript to prevent the tag options getting indexed by search engines. The former select box is used for noscript fallback. |
| 02 Apr 2007: | Arthur Clemens: Added "Delete Tag" interface. Added tabbed interface for Create, Rename, Delete tags. |
| 30 Mar 2007: | Arthur Clemens: Added "Rename Tag" interface. |
| 22 Mar 2007: | Arthur Clemens: Added option =NORMALIZE_TAG_INPUT= (to be set to 0) to allow any word as tag name (including upper case, punctuation characters and spaces). Moved "Create New Tag" to dedicated page. Created CSS styles in =tagme.css=. Added =mincount= parameter to =TAGME{tpaction="showalltags"}=. |
| 11 Sep 2007: | Foswiki:Main.ArthurClemens: updated example template to TWiki template convention. |
| 11 Jun 2007: | Foswiki:Main.ArthurClemens: fixed sizing of tags with the same tag count; fixed CSS class for select box; updated documentation with "How to put tags on every page". |
| 07 Jun 2007: | Foswiki:Main.ArthurClemens: removed dependency on (unreleased) TWiki 4.2. |
| 21 May 2007: | Foswiki:Main.WillNorris: added =view.tagme.tmpl= and updated installation instructions. |
| 30 Apr 2007: | Foswiki:Main.ArthurClemens: fixed calculation of sizes in tag cloud; if =mincount= is passed only the shown tags are calculated. |
| 18 Apr 2007: | Foswiki:Main.ArthurClemens: added permissions for rename and delete; added TagMeChangeRequests. |
| 17 Apr 2007: | Foswiki:Main.CrawfordCurrie for [[http://www.escapestudios.co.uk/][Escape Studios]]: contributed support for incremental refinement of tag searches. |
| 12 Apr 2007: | Foswiki:Main.CrawfordCurrie contributed ability to search for multiple tags. TWiki:Main.SvenDowideit for [[http://www.escapestudios.co.uk/][Escape Studios]]: added parameters needed for custom search result display. |
| 05 Apr 2007: | Foswiki:Main.ArthurClemens: The "topic tags" select box is now created with Javascript to prevent the tag options getting indexed by search engines. The former select box is used for noscript fallback. |
| 02 Apr 2007: | Foswiki:Main.ArthurClemens: Added "Delete Tag" interface. Added tabbed interface for Create, Rename, Delete tags. |
| 30 Mar 2007: | Foswiki:Main.ArthurClemens: Added "Rename Tag" interface. |
| 22 Mar 2007: | Foswiki:Main.ArthurClemens: Added option =NORMALIZE_TAG_INPUT= (to be set to 0) to allow any word as tag name (including upper case, punctuation characters and spaces). Moved "Create New Tag" to dedicated page. Created CSS styles in =tagme.css=. Added =mincount= parameter to =TAGME{tpaction="showalltags"}=. |
| 14 Nov 2006: | Fix IE browser crash issue on print (forms can't be named "tags"; debug by TWiki:Main.KevinKalmbach) |
| 14 Oct 2006: | Fix show default problem introduced by version 07 Oct 2006 (contributed by TWiki:Main.ChristianSuenkel) |
| 07 Oct 2006: | nostatus="on" parameter for add/remove tag (contributed by TWiki:Main.FredMorris) |
Expand All @@ -401,7 +413,7 @@ topic. Use the standard preference setting topics, such as

__Related Topics:__ %SYSTEMWEB%.TagMeViewAllTags, %SYSTEMWEB%.TagMeViewMyTags, %SYSTEMWEB%.TagMeSearch, %SYSTEMWEB%.TagMeDebugViewTags, %SYSTEMWEB%.TagMeDebugSearch, %SYSTEMWEB%.TagMeAjaxHelper, [[%SYSTEMWEB%.Plugins][Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences

%META:FILEATTACHMENT{name="jqui.png" attr="h" comment="Screenshot of experimental jQuery UI" date="1264982400" path="jqui.png" size="16289" user="ProjectContributor" version="1.1"}%
%META:FILEATTACHMENT{name="jquery.tagmeui.png" attr="h" comment="Screenshot of experimental jQuery UI" date="1264982400" path="jquery.tagmeui.png" size="16289" user="ProjectContributor" version="1.1"}%
%META:FILEATTACHMENT{name="tag_add.gif" attr="h" comment="Button: add tag" date="1141691885" path="tag_add.gif" size="857" user="ProjectContributor" version="1.1"}%
%META:FILEATTACHMENT{name="tag_remove.gif" attr="h" comment="Button: remove tag" date="1141697484" path="tag_remove.gif" size="862" user="ProjectContributor" version="1.1"}%
%META:FILEATTACHMENT{name="alltagcloud.gif" attr="h" comment="Screenshot of view all tags tag cloud" date="1141693726" path="alltagcloud.gif" size="8087" user="ProjectContributor" version="1.1"}%
Expand Down
6 changes: 6 additions & 0 deletions pub/System/TagMeAjaxHelper/Makefile
@@ -0,0 +1,6 @@
FOSWIKI_ROOT=~/foswiki/trunk/core
TARGET= \
jquery.tagmeui.js \
jquery.tagmeui.css

-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include
1 change: 1 addition & 0 deletions pub/System/TagMeAjaxHelper/jquery.tagmeui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added pub/System/TagMeAjaxHelper/jquery.tagmeui.css.gz
Binary file not shown.
17 changes: 17 additions & 0 deletions pub/System/TagMeAjaxHelper/jquery.tagmeui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added pub/System/TagMeAjaxHelper/jquery.tagmeui.js.gz
Binary file not shown.
@@ -1,6 +1,6 @@
#tagmejqcontainer {
#tagmeTagCloud {
padding-top: 1em;
}

#tagmejqtagstatus, #tagmejqtag {
float: left;
}
Expand Down
Expand Up @@ -15,7 +15,7 @@
* more details, published at http://www.gnu.org/copyleft/gpl.html
*
* @author: Paul Harvey <Paul.W.Harvey@csiro.au>
* @date: 2010-02-10
* @date: 2010-02-11
* @see: http://foswiki.org/Extensions/TagMePlugin#jqui
*/

Expand All @@ -24,6 +24,15 @@
jQuery(document).ready(function () {
(function ($) {
$.fn.tagmeui = function (options) {
/* TODO:
* - Prevent multiple instantiations on DOM elements.
* - There isn't much need for this.each/chaining. Re-factor to use
* jquery metadata plugin, and so opts can be extracted from DOM
* element. Eg: $('#myTagMeDivWithMetaData').tagmeui({extra: 'opts'});
* - Modify TagMePlugin itself to support hard removal of tags,
* instead of the bogus vote count subtraction currently
* - There is no meaningful feedback to user if ajax calls fail
* (auth/permissions, etc) */
$(this).each(function () {
var tagmeui = new TagMeUI($(this), options);

Expand All @@ -37,7 +46,7 @@ jQuery(document).ready(function () {
var that = this;

this.caller = caller;
this.urlQuery = $.parsequery(window.location.search);
this.urlQuery = $.query;
this.cloudQuery = this.urlQuery.copy();
this.cloudQuery.SET('skin', 'text');
this.cloudQuery.SET('contenttype', 'text/plain');
Expand Down Expand Up @@ -85,6 +94,7 @@ jQuery(document).ready(function () {
taglistInputField: '#tagmejqinputfield',
tagLinkUrl: foswiki.scriptUrlPath + '/view/' +
foswiki.systemWebName + '/TagMeSearch',
tagLinkTitle: 'Other topics with this tag',
tagPostUrl: foswiki.scriptUrlPath + '/viewauth/' + foswiki.web +
'/' + foswiki.topic,
autocompleteUrl: foswiki.scriptUrlPath + '/view/' +
Expand Down Expand Up @@ -138,7 +148,8 @@ jQuery(document).ready(function () {
var that = this;
$(selector + ' > form > div.jqTextboxListContainer > span:not(.linkified)').each(
function (index, tagSpan) {
var tagQuery = $.parsequery().copy();
var tagQuery = $.query.copy(),
theTag = $(tagSpan).text();

/* There must be an easier way to remove the textNode from a span; but
** I don't know it... yet. .text('') destroys child elements we want to
Expand All @@ -155,20 +166,21 @@ jQuery(document).ready(function () {
return;
}

theTag = $(tagSpan).text();
tagQuery.SET('tag', theTag);
tagQuery.SET('qcallingweb', foswiki.web);
removeTextNodes(tagSpan);
$(tagSpan).append('<a href="' + that.settings.tagLinkUrl +
tagQuery.toString() + '" title="Other topics with this tag">' +
theTag + '</a>');
tagQuery.toString() + '" title="' +
that.settings.tagLinkTitle + '">' + theTag + '</a>');
$(tagSpan).addClass('linkified');
}
);

return;
};


/* Populates a hidden div with the tag cloud and then displays it
* with simplemodal. Some messiness to bind events on the cloud modal */
TagMeUI.prototype.loadCloud = function () {
var that = this;

Expand All @@ -181,6 +193,8 @@ jQuery(document).ready(function () {
}
}

/* Would be nice if simplemodal had more sensible autosizing
* with content. */
if ($('#simplemodal-container').width() > $(document).width() - 50) {
$('#simplemodal-container').width($(document).width() - 50);
}
Expand Down Expand Up @@ -244,7 +258,6 @@ jQuery(document).ready(function () {
},

autocomplete: this.settings.autocompleteUrl,

autocompleteOpts: this.settings.autocompleteOpts
});

Expand All @@ -255,6 +268,8 @@ jQuery(document).ready(function () {
});
};

$.fn.tagmeui();
}(jQuery));

/* Install tagmeui using default options */
$.fn.tagmeui();
});
File renamed without changes

0 comments on commit 89c7012

Please sign in to comment.