Extending the use of tags
Hi xwiki developers! My employer (the University of Oslo, Norway) just asked me to implement the following in xwiki for use in a research project: - When viewing a blog entry, show a list of it's tags along with a link to that tags page. - On a tag page (/xwiki/bin/view/Main/Tags?tag=hotdog), make an input field that will be used for defining that tag, along with the list of the other docs with the same tag. - While editing a blog entry, enable the editing of tags at the same time. So my questions are: 1. I've done the first part writing veolcity code and an xwiki-plugin code. How can I ensure that this list is displayed for all blog entries, new and old? 2. How can I enable the editing of tags along with the editing of the actual text of a blog entry? 3. What kind of persistence (the xwiki db, some other db, xml etc) would be good to use for storing the definition of a tag? 4. It would be nice if I could somehow configure in these changes so I don't have to change so much of the actual xwiki source code and thus make updating to a newer version a lot harder. How can I go about doing this? Any help on this subject would be greatly appreciated! cheers :-) Thomas
Hi Thomas, On May 15, 2007, at 12:51 PM, Thomas Drevon wrote:
Hi xwiki developers!
My employer (the University of Oslo, Norway) just asked me to implement the following in xwiki for use in a research project:
- When viewing a blog entry, show a list of it's tags along with a link to that tags page.
- On a tag page (/xwiki/bin/view/Main/Tags?tag=hotdog), make an input field that will be used for defining that tag, along with the list of the other docs with the same tag.
- While editing a blog entry, enable the editing of tags at the same time.
So my questions are: 1. I've done the first part writing veolcity code and an xwiki- plugin code. How can I ensure that this list is displayed for all blog entries, new and old?
Edit the ArticleClassSheet page to display the tags.
2. How can I enable the editing of tags along with the editing of the actual text of a blog entry?
Same. Edit the ArticleClassSheet page to provide form inputs to add tags and add some JS code to add the tags on save.
3. What kind of persistence (the xwiki db, some other db, xml etc) would be good to use for storing the definition of a tag?
Just edit the Tag class and add a definition property.
4. It would be nice if I could somehow configure in these changes so I don't have to change so much of the actual xwiki source code and thus make updating to a newer version a lot harder. How can I go about doing this?
See above. Sorry I don't have the time to research this topic to tell you exactly what to do but these should put you in the right directions. Thanks -Vincent
Any help on this subject would be greatly appreciated!
cheers :-) Thomas
Vincent Massol wrote:
1. I've done the first part writing veolcity code and an xwiki-plugin code. How can I ensure that this list is displayed for all blog entries, new and old?
Edit the ArticleClassSheet page to display the tags.
Thanks for the tip! I've solved part of the problem now :)
2. How can I enable the editing of tags along with the editing of the actual text of a blog entry?
Same. Edit the ArticleClassSheet page to provide form inputs to add tags and add some JS code to add the tags on save.
Hm, ok. Is copying code from tagedit.vm a good way to go about it?
3. What kind of persistence (the xwiki db, some other db, xml etc) would be good to use for storing the definition of a tag?
Just edit the Tag class and add a definition property.
How do I do that?
Sorry I don't have the time to research this topic to tell you exactly what to do but these should put you in the right directions.
No worries. I'm very grateful for all the help I can get! cheers :-) Thomas
Hi Thomas, On May 18, 2007, at 2:50 PM, Thomas Drevon wrote:
Vincent Massol wrote:
1. I've done the first part writing veolcity code and an xwiki- plugin code. How can I ensure that this list is displayed for all blog entries, new and old? Edit the ArticleClassSheet page to display the tags.
Thanks for the tip! I've solved part of the problem now :)
2. How can I enable the editing of tags along with the editing of the actual text of a blog entry? Same. Edit the ArticleClassSheet page to provide form inputs to add tags and add some JS code to add the tags on save.
Hm, ok. Is copying code from tagedit.vm a good way to go about it?
yes
3. What kind of persistence (the xwiki db, some other db, xml etc) would be good to use for storing the definition of a tag? Just edit the Tag class and add a definition property.
How do I do that?
http://localhost:8080/xwiki/bin/edit/XWiki/TagClass?editor=class
Sorry I don't have the time to research this topic to tell you exactly what to do but these should put you in the right directions.
No worries. I'm very grateful for all the help I can get!
cheers :-) Thomas
-Vincent
Thomas Drevon wrote:
Vincent Massol wrote:
2. How can I enable the editing of tags along with the editing of the actual text of a blog entry?
Same. Edit the ArticleClassSheet page to provide form inputs to add tags and add some JS code to add the tags on save.
Ok, I've added the following two lines in ArticleClassSheet when in inline mode: <dt>Tags:</dt> <dd><input type="text" id="tags" name="tags" size="60" value="$!tdoc.tags"/></dd> ..and these lines when in view mode: Tags: #foreach($tag in $doc.getTagList()) <a href="$xwiki.getURL("Main.Tags", "view", "tag=$tag")")">$tag</a> #end But I now experience something strange: The tags that I add to a blog entry will only stick (added to the database, that is) if I have done a shutdown and startup of tomcat after the creation of the blog entry. So it seems that only "old" blog entrys may get tags added to them in the way I've implemented this. Kinda strange. You mentioned that I could use a javascript to save the tags. Where should such a script be invoked? Also, I've been browsing the xwiki api for a doc.setTags-like method, but I can't find seem to find one. Is there anyone that can point me in the right direction? Thanks, and best regards from Thomas :-)
participants (2)
-
Thomas Drevon -
Vincent Massol