Skip to content

Commit

Permalink
Item1918: first release of the jquery frontend
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@4883 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OliverKrueger authored and OliverKrueger committed Sep 14, 2009
1 parent 8624b7d commit 4906e40
Show file tree
Hide file tree
Showing 27 changed files with 816 additions and 161 deletions.
93 changes: 52 additions & 41 deletions data/System/TagsPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1211031581" format="1.1" version="1.6"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252888172" format="1.1" reprev="1.3" version="1.3"}%
---+!! !TagsPlugin
<!--
One line description, required for extensions repository catalog.
Expand All @@ -8,72 +8,84 @@ One line description, required for extensions repository catalog.

%TOC%

---++ Usage
TagsPlugin allows users to tag resources of differing types - and so the TML used to access the
tags specifies this information too.
---++ For Administrators
---+++ Installation Instructions
1 configure various TagsPlugin toggles in [[%SCRIPTURL{configure}%][configure]] (section Extensions, TagsPlugin)
1 setup your database (currently only tested using !MySQL)
1 create the database in !MySQL server and add the user with permission to create tables
1 set ={DbiContrib}{DBI_dsn}=, ={DbiContrib}{DBI_username}= and ={DbiContrib}{DBI_password}=
1 *initialise the tag database*
* %SCRIPTURL{rest}%/TagsPlugin/initialiseDatabase to automatically create the database tables and to add initial values
1 choose between the two flavors of the TagsPlugin and alter your SKIN variable
* %GRAY%classic flavor:%ENDCOLOR% Set SKIN = tagsplugin, pattern
* %GRAY%jquery flavor:%ENDCOLOR% Set SKIN = tagspluginjquery, pattern

%GRAY%Optional:%ENDCOLOR%%BR%
If you want to preload the tags database with Country Names, you need to install CPAN:Geo::GeoNames
and click [[%SCRIPTURL{rest}%/TagsPlugin/updateGeoTags][updateGeoTags]] (uses the CC licenced
http://www.geonames.org ([[http://download.geonames.org/export/dump/allCountries.zip][allCountries.zip]]).

TagsPluginViews defines the common Tag widgets that can be re-used via Sectional includes.
%$INSTALL_INSTRUCTIONS%

---++ Tag Filters
step 1: add ?tagfilter=Tag,More+Tags will thus use that filter instead of the web as a context??

---++ For Users
This plugin primarily manages triples: a tag basically has three dimensions:
* the tagname itself (called tag)
* the topic, it is attached to (called topic or item)
* the username, who the tag belongs to (called user or owner)

There are session settable 'Filters' that will reduce the set of topics in a similar way
to 'Webs' - they are _session_ based - at least
until I can work out howto save a filter to a Name, that can be used as a Pseudo-Web.
You can use the following macros to display or alter tags:

---+++ =TAGLIST=
Lists the tags for the requested resource
Lists the tags for the requested resource
---+++ =TAGENTRY=
allows users to add, remove and manipulate tags for a resource
allows users to add, remove and manipulate tags for a resource
---+++ =TAGCLOUD=
(to be filled)
You can disable the <nop>TagsPlugin =TAGCLOUD= macro in =configure=, if you want to
use the =TAGCLOUD= macro from the Foswiki:Extensions.TagCloudPlugin instead. See {TagsPlugin}{EnableTagCloud}.

%INCLUDE{%SYSTEMWEB%.VarTAGSEARCH}%

---+++ SEARCHing
To search for topics that are tagged with (or not tagged with), use a %SYSTEMWEB%.QuerySearch
with the =taggedwith(tagname)= operator
with the =taggedwith(tagname)= operator.

TagsPluginViews defines the common Tag widgets that can be re-used via Sectional includes.

---+++ Preferences (used by the jquery flavor)
Available variables which can be used to change the (default) behaviour of the jquery skin:

| *preference name* | *description* |
| TAGSPLUGIN_WEBSELECTOR_DEFAULT | The default value for the <nop>TagCloud view: Default: the current web. |
| TAGSPLUGIN_USERSELECTOR_DEFAULT | The default value for the <nop>TagCloud view. Default: =all= |
| TAGSPLUGIN_TAGUSER | New tags are created with this user. Default: the current user. |

---+++ Tag Filters (classic flavor only)
(This section needs to be rewritten.)

---++ Examples
---+++ list of all user's tags on the current topic
---+++ Examples
---++++ list of all user's tags on the current topic
%TAGLIST{show="user"}%
---+++ edit (the current user's) the tags on the current topic
---++++ edit (the current user's) the tags on the current topic
%TAGENTRY%
---+++ tag cloud of all user's tags on the current topic
---++++ tag cloud of all user's tags on the current topic
%TAGCLOUD%

---++ Installation Instructions

1 set ={DbiContrib}{DBI_dsn}=, ={DbiContrib}{DBI_username}= and ={DbiContrib}{DBI_password}=
* currently only tested using !MySQL - =dbi:mysql:example_com_tags:localhost=
2 create the database in !MySQL server and add the user with permission to create tables
3 *initialise the tag database* and to tag each topic with the webname it is in, goto
* %SCRIPTURL{rest}%/TagsPlugin/initialiseDatabase

to automatically add a tag entry to each topic, add =tagsplugin= to your skin path

eg Set SKIN=tagsplugin,pattern


If you want to preload the tags database with Country Names, you need to install CPAN:Geo::GeoNames and click
%SCRIPTURL{rest}%/TagsPlugin/updateGeoTags
* uses the CC licenced http://www.geonames.org (http://download.geonames.org/export/dump/allCountries.zip)


%$INSTALL_INSTRUCTIONS%
---++ For Developers
You can access all functions of this plugin via rest handlers. Please consult the inline
documentation of TagsPlugin.pm for HTTP status codes, available handlers and URL
parameters.

---++ Plugin Info
This Plugin uses DbiContrib to store the tagmap in a database for fast querying.
This Plugin uses DbiContrib to store the tagmap in a database for fast querying.

Schema & design inspired from [[http://forge.mysql.com/wiki/TagSchema][MySQL Forge]],
but treating Tags as Items, so that you can tag a tag (creating a heirarchy of tags)
but treating Tags as Items, so that you can tag a tag (creating a hierarchy of tags)


| Plugin Author(s): | Foswiki:Main.SvenDowideit %BR% Foswiki:Main.OliverKrueger |
| Copyright: | &copy; 2008-2009 SvenDowideit@fosiki.com %BR% &copy; 2009 [[mailto:oliver@wiki-one.net][Oliver Krueger]], [[http://wiki-one.net][(wiki-one.net)]] |
| Copyright: | &copy; 2008-2009 SvenDowideit@fosiki.com %BR% &copy; 2009 [[mailto:oliver@wiki-one.net][Oliver Kr&uuml;ger]], [[http://wiki-one.net][(wiki-one.net)]] |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License 3)]] |
| Plugin Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order --> |
Expand All @@ -82,9 +94,8 @@ but treating Tags as Items, so that you can tag a tag (creating a heirarchy of t


__Related Topics:__ %SYSTEMWEB%.InstalledPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory,
%MAINWEB%.SitePreferences
%MAINWEB%.SitePreferences, [[http://faculty.philau.edu/kayk/kkay/articles/Tagging_folksonomy.pdf][Intranet Applications for Tagging and Folksonomies]]

<!-- Do _not_ attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the feedback topic on
foswiki.org instead. -->

* [[http://faculty.philau.edu/kayk/kkay/articles/Tagging_folksonomy.pdf][Intranet Applications for Tagging and Folksonomies]]
10 changes: 10 additions & 0 deletions data/System/TagsPluginAutoCompleteBackend.txt
@@ -0,0 +1,10 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252352642" format="1.1" version="1.5"}%
%META:TOPICPARENT{name="TagsPlugin"}%
<noautolink>
%TAGSEARCH{
query="tag"
tag="%%URLPARAM{"q"}%%"
format="$tag"
sep="$n"
}%
</noautolink>
5 changes: 3 additions & 2 deletions data/System/TagsPluginNoHeaderViewTemplate.txt
@@ -1,4 +1,5 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1251408056" format="1.1" version="1.1"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340188" format="1.1" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
%TMPL:INCLUDE{view}%

%TMPL:DEF{"tagsplugin:header"}%%TMPL:END%
%TMPL:DEF{"tagsplugin:header"}%%TMPL:END%
8 changes: 3 additions & 5 deletions data/System/TagsPluginTagCloud.txt
@@ -1,9 +1,7 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1251706916" format="1.1" reprev="1.7" version="1.7"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252337808" format="1.1" reprev="1.9" version="1.9"}%
%META:TOPICPARENT{name="TagsPlugin"}%
%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"tag\" format=\"$tag:1:$web:$topic:$user\" sep=\",\" web=\"%URLPARAM{"tagweb" default="%TAGWEB%"}%\" user=\"%URLPARAM{"taguser" default="%TAGUSER%"}%\" }$percnt"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style='font-size:$weightpx;line-height:90%;text-decoration:none' title='$5' url='$percntSCRIPTURL{rest}$percnt/TagsPlugin/' class='tagsplugin_tagcloud_tag' item='$3.$4' topic='$4' web='$3' tag='$term' user='$5'>$term</span>"
footer="</div>"
format="<a style='font-size:$weightpx;' class='tagsplugin_tagcloud_tag' href='$percntSCRIPTURL{view}$percnt/$percntSYSTEMWEB$percnt/TagsPluginTagDetails?tag=$term' item='$3.$4' topic='$4' web='$3' tag='$term' user='$5'>$term</a>"
warn="off"
}%

42 changes: 42 additions & 0 deletions data/System/TagsPluginTagDetails.txt
@@ -0,0 +1,42 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340538" format="1.1" version="1.7"}%
%META:TOPICPARENT{name="TagsPlugin"}%
<div style="text-align:left;">
<noautolink>
---++ %MAKETEXT{"Tag Details on"}% %GRAY%%URLPARAM{"tag" default="undef"}%%ENDCOLOR%

---+++ %MAKETEXT{"Topics, tagged with this tag"}%
%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"topic\" tag=\"$percntURLPARAM{\"tag\" default=\"undef\"}$percnt\" format=\"$item:1:$web:$topic:$user\" }$percnt"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style='font-size:$weightpx;line-height:90%'><a href='$percntSCRIPTURL{view}$percnt/$3/$4' style='color:$fadeRGB(104,144,184,0,102,255);text-decoration:none' title='$count'>$term</a></span>"
footer="</div>"
warn="off"
}%

---+++ %MAKETEXT{"Users, who like this tag"}%
%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"user\" tag=\"$percntURLPARAM{\"tag\" default=\"undef\"}$percnt\" format=\"$user:1:$web:$topic\" }$percnt"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style='font-size:$weightpx;line-height:90%'><a href='$percntSCRIPTURL{view}$percnt/$percntUSERSWEB$percnt/$term' style='color:$fadeRGB(104,144,184,0,102,255);text-decoration:none' title='$count'>$term</a></span>"
footer="</div>"
warn="off"
}%

---+++ %MAKETEXT{"List all occurrences of this tag"}%
%TAGSEARCH{
query="topic"
tag="%URLPARAM{"tag" default="undef"}%"
header="|*%MAKETEXT{"Web"}%*|*%MAKETEXT{"Topic"}%*|*%MAKETEXT{"User"}%*|*%MAKETEXT{"Action"}%*|$n"
format="| [[$item][$web]] | [[$item][$topic]] | [[%USERSWEB%.$user][$user]] | <span class='tagsplugin_actions $untaggable'><a href='%SCRIPTURL{rest}%/TagsPlugin/untag?item=$item&tag=$tag&user=$user&redirectto=%SCRIPTURL{view}%/%WEB%/%TOPIC%?tag=$tag' class=''>Untag</a></span> |"
sep="$n"
}%

<!--
* Local ROOT = %ISTAGADMIN%
-->
%IF{"$ ROOT" then="%INCLUDE{%SYSTEMWEB%.TagsPluginTagDetailsAdmin}%"}%

</noautolink>
</div>

%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Local" value="System.TagsPluginNoHeaderViewTemplate"}%
5 changes: 5 additions & 0 deletions data/System/TagsPluginTagDetailsAdmin.txt
@@ -0,0 +1,5 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340581" format="1.1" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
---+++ %MAKETEXT{"Delete this tag completely"}%

---+++ %MAKETEXT{"Merge another tag into this one"}%
28 changes: 28 additions & 0 deletions data/System/TagsPluginTagDetailsSimple.txt
@@ -0,0 +1,28 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252700229" format="1.1" reprev="1.4" version="1.4"}%
%META:TOPICPARENT{name="TagsPlugin"}%
<div style="text-align:left;">
<noautolink>
---+++ %MAKETEXT{"Topics, tagged with this tag"}%
%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"topic\" tag=\"$percntURLPARAM{\"tag\" default=\"undef\"}$percnt\" format=\"$item:1:$web:$topic:$user\" }$percnt"
split="[,]"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style='font-size:$weightpx;line-height:90%'><a href='$percntSCRIPTURL{view}$percnt/$3/$4' style='color:$fadeRGB(104,144,184,0,102,255);text-decoration:none' title='$count'>$4</a></span>"
footer="</div>"
warn="off"
}%

---+++ %MAKETEXT{"Users, who like this tag"}%
%TAGCLOUD{
terms="$percntTAGSEARCH{ query=\"user\" tag=\"$percntURLPARAM{\"tag\" default=\"undef\"}$percnt\" format=\"$user:1:$web:$topic\" }$percnt"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style='font-size:$weightpx;line-height:90%'><a href='$percntSCRIPTURL{view}$percnt/$percntUSERSWEB$percnt/$term' style='color:$fadeRGB(104,144,184,0,102,255);text-decoration:none' title='$count'>$term</a></span>"
footer="</div>"
warn="off"
}%

---+++ %MAKETEXT{"Maintain this tag"}%
%ICON{trash}% <a href='%SCRIPTURL{rest}%/TagsPlugin/untag?tag=%URLPARAM{"tag" default="undef"}%&item=%URLPARAM{"tagitem" default="undef"}%&user=%URLPARAM{"taguser" default="undef"}%' class='tagsplugin_untag_link' tag='%URLPARAM{"tag" default="undef"}%' item='%URLPARAM{"tagitem" default="undef"}%' user='%URLPARAM{"taguser" default="undef"}%'>Remove</a> %URLPARAM{"taguser" default="undef"}%'s <span class='foswikiGrayText'>%URLPARAM{"tag" default="undef"}%</span> tag from this topic.

</noautolink>
</div>
9 changes: 0 additions & 9 deletions data/System/TagsPluginTagEntrySearch.txt

This file was deleted.

9 changes: 5 additions & 4 deletions data/System/TagsPluginTagList.txt
@@ -1,8 +1,9 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1251896891" format="1.1" reprev="1.5" version="1.5"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252679284" format="1.1" version="1.13"}%
%META:TOPICPARENT{name="TagsPlugin"}%
%TAGSEARCH{
query="tag"
web="%URLPARAM{"tagweb" default="%TAGWEB%"}%"
topic="%URLPARAM{"tagtopic" default="%TAGTOPIC%" }%"
format=" <span class='tagsplugin_tag_container'><a class='tagsplugin_tag' href='%SCRIPTURL{view}%/%SYSTEMWEB%/TagsPluginTagDetails?tag=$tag' tag='$tag'>$tag</a><a class='tagsplugin_tag_remove $untaggable' href='%SCRIPTURL{rest}%/%SYSTEMWEB%/TagsPlugin/untag?tag=$tag&item=$item&user=$user' tag='$tag' item='$item' user='$user' style='display:none;'>x</a></span>"
sep=" "
}%
format=" <li class='tagsplugin_tag'><a class='tagsplugin_tag_link' href='%SCRIPTURL{view}%/%SYSTEMWEB%/TagsPluginTagDetails?tag=$tag' tag='$tag' title='Owner: $percntSPACEOUT{\"$user\"}$percnt' item='$item' user='$user'>$percntICON{tag}$percnt $tag</a> <a class='tagsplugin_tag_remove $untaggable' href='%SCRIPTURL{rest}%/TagsPlugin/untag?tag=$tag&item=$item&user=$user' tag='$tag' item='$item' user='$user'>x</a></li>"
sep="$n"
}%
23 changes: 23 additions & 0 deletions data/System/TagsPluginUserSelector.txt
@@ -0,0 +1,23 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252698395" format="1.1" reprev="1.2" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
---++ <nop>TagsPlugin User Selector
This topic is included by the =tagspluginjquery= template.

By default it presents the user two or more links:
* one link for "all",
* one for the user him/herself and
* (optionally) one link for each group the user is member of.

Whenever a tagcloud is requested by the user (by clicking on the selector buttons), the %SYSTEMWEB%.TagsPlugin reads the custom attribute =user= from the html element which is marked with the class =tagsplugin_user_active=.

%X% Make sure, that initially this class is only set on one element.

If you want to customize the "user buttons", this is the right place.

---++ Implementation
<verbatim>
%STARTINCLUDE% <span class='foswikiGrayText'>Users:</span>
<a href='#' class='tagsplugin_user tagsplugin_user_active' user='all'>%ICON{filter}% all</a>
<a href='#' class='tagsplugin_user' user='%WIKINAME%'>%ICON{filter}% %SPACEOUT{"%WIKINAME%"}%</a>
%TAGGROUPS{format=" <a href='#' class='tagsplugin_user' user='$group'>$percntICON{filter}$percnt $percntSPACEOUT{\"$group\"}$percnt</a>" sep="$n" }%%STOPINCLUDE%
</verbatim>
2 changes: 2 additions & 0 deletions data/System/TagsPluginViews.txt
@@ -1,3 +1,5 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340336" format="1.1" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
---+++ list of everyone's tags on the current topic
%TAGLIST{item="%BASEWEB%.%BASETOPIC%" }%
---+++ list of %NOP%%WIKINAME%'s tags on the current topic
Expand Down
5 changes: 3 additions & 2 deletions data/System/TagsPluginViewsTagSearch.txt
@@ -1,4 +1,5 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1250703240" format="1.1" reprev="1.4" version="1.4"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340299" format="1.1" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
<noautolink>

---+++ list of everyone's tags on the current topic
Expand All @@ -23,4 +24,4 @@
format="| $tag | [[$item][$item]] | $user |"
sep="$n"
}%
</noautolink>
</noautolink>
26 changes: 26 additions & 0 deletions data/System/TagsPluginWebSelector.txt
@@ -0,0 +1,26 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1252698596" format="1.1" reprev="1.2" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
---++ <nop>TagsPlugin Web Selector
This topic is included by the =tagspluginjquery= template.

By default it presents the user two or more links:
* one link for "all" and
* one link for each web.
The current web is preselected with =tagsplugin_web_active=.

Whenever a tagcloud is requested by the user (by clicking on the selector buttons), the %SYSTEMWEB%.TagsPlugin reads the custom attribute =web= from the html element which is marked with the class =tagsplugin_web_active=.

%X% Make sure, that initially this class is only set on one element.

If you want to customize the "web buttons", this is the right place.

---++ Implementation
<verbatim>
%STARTINCLUDE% <span class='foswikiGrayText'>Webs:</span>
<a href='#' class='tagsplugin_web %IF{"$ TAGSPLUGIN_WEBSELECTOR_DEFAULT='all'" then="tagsplugin_web_active"}%' web='all'>%ICON{filter}% all</a>
%FLEXWEBLIST{
webs="public, -Trash"
format=" <a href='#' class='tagsplugin_web $percntIF{\"$ TAGSPLUGIN_WEBSELECTOR_DEFAULT='$name'\" then=\"tagsplugin_web_active\"}$percnt' web='$name'>$percntICON{filter}$percnt $name</a>"
separator="$n"
}%%STOPINCLUDE%
</verbatim>
7 changes: 3 additions & 4 deletions data/System/VarTAGSEARCH.txt
@@ -1,5 +1,5 @@
%META:TOPICINFO{author="ProjectContributor" date="1231502400" format="1.1" version="$Rev: 3863 $"}%
%META:TOPICPARENT{name="Macros"}%
%META:TOPICINFO{author="BaseUserMapping_333" date="1252340265" format="1.1" version="1.2"}%
%META:TOPICPARENT{name="TagsPlugin"}%
#VarTAGSEARCH

---+++ TAGSEARCH -- search the tags
Expand Down Expand Up @@ -30,5 +30,4 @@
| =$quot= | Double quote (="=) |
| =$percnt= | Percent sign (=%=) |
| =$dollar= | Dollar sign (=$=) |
* See %SYSTEMWEB%.TagsPluginViewsTagSearch for examples.

* See %SYSTEMWEB%.TagsPluginViewsTagSearch for examples.

0 comments on commit 4906e40

Please sign in to comment.