B) On my test site I have installed the blog package and I have a different issue:
The adding of tags works, the cmstags database table looks good with keys and values - but my tag values are node specific - in other words - I dont see tag values entered in for other nodes using the same tags data type (same Tag Group)
So I am a bit confused. This tags data type is perfect for what I need to do but only if it works :(
So I have 2 basic questions:
1) Can someone clarify how the tags data type is "supposed" to work? My understanding is that any node using the tag with the same Tag Group should see the existing tags in the group when you go create a new node of that type so you you would just check off the approp tags if what you have there is good, or optionally create a new new tag which would be automatically available to any other node in that Tag Group.
2) I've seen a number of posts about having to install the blog package to get tags working (which you shouldn't have to). - is this the official work around?
My current work around is to create a drop down datatype of categories for my users to group events by, but tags would be the real solution since it would put my users in charge of their own destinty.
This is such a cool feature it's killing me that it doesnt work as I would hope.
Hopefully I am being stupid and there is some switch or something I forgot to flip to make this work :)
OK so I went into the code - downloade the source and it is very easy to see what the problem is... according to me anyways.
There is this sql code that inits the tag data type of the form and displays the tags that are associated to the node using this code to pull the nodes from the DB
SELECT * FROM cmsTags
INNER JOIN cmsTagRelationship ON cmsTagRelationShip.tagId = cmsTags.id
WHERE cmsTags.[group] = @group AND cmsTagRelationship.nodeid = @nodeid
Now.. if we were to change this slightly and do just the following:
SELECT * FROM cmsTags
INNER JOIN cmsTagRelationship ON cmsTagRelationShip.tagId = cmsTags.id
WHERE cmsTags.[group] = @group
Everything would begin to work as I would like ... that all tags for a group show on nodes that belonging to the group so you can take your pick from the litter .
But we would still need to change what is selected etc in the checkbox list something like:
while (rr.Read())
{
ListItem li = new ListItem( rr.GetString("tag"), rr.GetInt("id").ToString());
li.Selected = (nodeid == rr.GetInt("nodeId"));
tagCheckList.Items.Add(li);
}
This would show all the tags in the applicable node group but only pre-check those that are currently stapled to the current node etc...
Still no idea what is going on with the error up top on my real site but this fixed the behavior on my test site so now my tag data types actually work properly ... ie. grouping all tag groups like they should on my nodes so I just have to pick off what makes sense on any given node from the selection available - according to me again :)
I even tested adding new ones and they start showing up unchecked on all my nodes that share the same tag group...
OK - there was a sql error... I had to fix since the code there was pulling back duplicates and if you selected a dup when you were adding a new tag to a node you would get a constraint violation etc
New SQL looks like this --- sorts nice too :)
SELECT distinct cmsTags.id, cmsTags.tag, ISNULL(cmsTagRelationship.nodeId,0) as nodeId
FROM cmsTags left JOIN cmsTagRelationship ON cmsTagRelationship.tagId = cmsTags.id AND cmsTagRelationship.nodeid = @nodeid
WHERE cmsTags.[group] = 'default' order by cmsTags.tag
As a complete hack, to fix the as of yet unsolved issue with upload control (very weird if you ask me that I put a tags data type on a document and the upload now blows up when you try to add a tag - someone with much more knowldge of umbraco internals probably has an answer) I implemented the following code in the umbraco.editorControls.uploadField class by wrapping the thing in a try catch:
I should mention the final sql above is implemented in SQL server - the isnull function will probably hose VistaDB I'll bet.unless they miraculously have the same function.
Tags Not Working Right
I have NOT installed the blog package.
I am running 4.02.1
I want to create events and have my users associate tags to them to group them to enhance the event searching experience of our visitors.
I've added the appropriate reference to the tags data type in xsltconfig file.
B) On my test site I have installed the blog package and I have a different issue:
The adding of tags works, the cmstags database table looks good with keys and values - but my tag values are node specific - in other words - I dont see tag values entered in for other nodes using the same tags data type (same Tag Group)
So I am a bit confused. This tags data type is perfect for what I need to do but only if it works :(
So I have 2 basic questions:
1) Can someone clarify how the tags data type is "supposed" to work? My understanding is that any node using the tag with the same Tag Group should see the existing tags in the group when you go create a new node of that type so you you would just check off the approp tags if what you have there is good, or optionally create a new new tag which would be automatically available to any other node in that Tag Group.
2) I've seen a number of posts about having to install the blog package to get tags working (which you shouldn't have to). - is this the official work around?
My current work around is to create a drop down datatype of categories for my users to group events by, but tags would be the real solution since it would put my users in charge of their own destinty.
This is such a cool feature it's killing me that it doesnt work as I would hope.
Hopefully I am being stupid and there is some switch or something I forgot to flip to make this work :)
OK so I went into the code - downloade the source and it is very easy to see what the problem is... according to me anyways.
There is this sql code that inits the tag data type of the form and displays the tags that are associated to the node using this code to pull the nodes from the DB
SELECT * FROM cmsTags INNER JOIN cmsTagRelationship ON cmsTagRelationShip.tagId = cmsTags.id WHERE cmsTags.[group] = @group AND cmsTagRelationship.nodeid = @nodeid
Now.. if we were to change this slightly and do just the following:
SELECT * FROM cmsTags INNER JOIN cmsTagRelationship ON cmsTagRelationShip.tagId = cmsTags.id WHERE cmsTags.[group] = @group
Everything would begin to work as I would like ... that all tags for a group show on nodes that belonging to the group so you can take your pick from the litter .
But we would still need to change what is selected etc in the checkbox list something like:
This would show all the tags in the applicable node group but only pre-check those that are currently stapled to the current node etc...
Am I missing something?
Works like a champ...!
I modified the umbraco.editorControls.tags.DataEditor class
Sql code was the same as above but the reader code had to look like this:
while (rr.Read())
{
ListItem li = new ListItem( rr.GetString("tag"), rr.GetInt("id").ToString());
li.Selected = (rr.GetInt("nodeId").ToString() == pageId);
tagCheckList.Items.Add(li);
}
Still no idea what is going on with the error up top on my real site but this fixed the behavior on my test site so now my tag data types actually work properly ... ie. grouping all tag groups like they should on my nodes so I just have to pick off what makes sense on any given node from the selection available - according to me again :)
I even tested adding new ones and they start showing up unchecked on all my nodes that share the same tag group...
Does this make sense to anyone?
OK - there was a sql error... I had to fix since the code there was pulling back duplicates and if you selected a dup when you were adding a new tag to a node you would get a constraint violation etc
New SQL looks like this --- sorts nice too :)
SELECT distinct cmsTags.id, cmsTags.tag, ISNULL(cmsTagRelationship.nodeId,0) as nodeId
FROM cmsTags left JOIN cmsTagRelationship ON cmsTagRelationship.tagId = cmsTags.id AND cmsTagRelationship.nodeid = @nodeid
WHERE cmsTags.[group] = 'default' order by cmsTags.tag
Seems to work perfectly now.
As a complete hack, to fix the as of yet unsolved issue with upload control (very weird if you ask me that I put a tags data type on a document and the upload now blows up when you try to add a tag - someone with much more knowldge of umbraco internals probably has an answer) I implemented the following code in the umbraco.editorControls.uploadField class by wrapping the thing in a try catch:
try
{
string tempText = Text;
bool isEmpty = String.IsNullOrEmpty(this.PostedFile.FileName);
// checkbox, if it's used the file will be deleted and we should throw a validation error
if (Page.Request[this.ClientID + "clear"] != null && Page.Request[this.ClientID + "clear"].ToString() != "")
return "";
else if (!isEmpty)
return this.PostedFile.FileName;
else if (!String.IsNullOrEmpty(tempText))
return tempText;
else
return "";
}
catch
{
return "";
}
I should mention the final sql above is implemented in SQL server - the isnull function will probably hose VistaDB I'll bet.unless they miraculously have the same function.
is working on a reply...