Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

Subscribe to document button in Template View
Last Post 09/04/2009 1:21 PM by Peter Donker. 18 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Laurence Neville
New Member
New Member
Posts:56


--
06/24/2009 11:57 PM

I show all documents to end users through a custom template view, either by category or by folder. Up until now my custom template view has been a stripped down version of TemplateView.ascx that shows only a list of hyperlinks and no buttons at all. Now I want to all end users to subscribe & unsubscribe to documents by putting buttons next to each item. However it doesn't seem to work. Here is my ItemTemplate.Text

< tr class="entryItem" >
 < td >
  < img src="[dmxmodule:rooturl][entry:icon16]" border="0" / >
 < /td >
 < td >
  < a href="[dmxmodule:url]EntryId=[entry:entryid]&Command=Core_Download&Method=attachment" style="display:[entry:isfile|block;none]" >[entry:title]< /a >
  < a href="[entry:entry]" style="display:[entry:ishyperlink|block;none]" target="_blank" >[entry:title]< /a >
 < /td >
 < td style="display:[button:subscribe_visible|block;none];text-align:center" >
  < a href="[button:subscribe_url]" >
   < img src="[dmxmodule:imageurl]Menu/document_heart.png" border="0" alt="[button:subscribe_text]" / >
  < /a >
 < /td >
 < td style="display:[button:unsubscribe_visible|block;none];text-align:center" >
  < a href="[button:unsubscribe_url]" >
   < img src="[dmxmodule:imageurl]Menu/document_heart.png" border="0" alt="[button:unsubscribe_text]" / >
  < /a >
 < /td >
< /tr >

The button URLs are all the same down the list I notice. Is it possible to do what I am trying to do?

 

Laurence Neville
New Member
New Member
Posts:56


--
06/25/2009 12:01 AM
I have DMX 5.0.6 by the way.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
06/30/2009 11:19 PM
Hi Laurence,

You're on the right track. The [button:subscribe_url] is for the general Entry however, not for the list item. So you need to add the construct as follows:

a href="[dmxmodule:url]EntryId=[entry:collectionid]&cmd=subscribe&sel=[entry:entryid]"

Note the 'cmd=' querystring parameter. Let me know if that still doesn't work.

Peter
Laurence Neville
New Member
New Member
Posts:56


--
07/07/2009 11:10 PM
Thanks, that works great.

Another couple of questions about subscribe buttons in template views:

Now I am able to create subscribe/unsubscrive buttons per document, I would like to create create subscribe/unsubscribe buttons for a collection.

I have a template view to show the entries in a collection, and have put a href="[button:subscribe_url]" and a href="[button:unsubscribe_url]" in the PageTemplate to create subscribe/unsubscrive buttons for the whole collection. However, when I used the following snippets from the default TemplateView.ascx.resx the result is always style="display:none"

style="display:[button:subscribe_visible|block;none];text-align:center"
style="display:[button:unsubscribe_visible|block;none];text-align:center"

The documentation says "‘Visible’ returns true or false depending on whether the user can perform the action", so why is it always false? I have "Show My Subscriptions" on in the module settings.

I would like the subscribe/unsubscribe buttons to show/hide themselves depending on whether the user is already subscribed. Is this what the above is intended to achieve or is there another way?

Is there any way to only list files in the collection, and not sub-collections?

Last question - the site administrator would really like to be able to subscribe users to entries himself, or even better entire roles to entries. Is there any way to do this?
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/08/2009 9:03 PM
Hi Laurence,
Are you using the host account? Hosts are not part of a portal so they can't subscribe.
Peter
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/08/2009 9:04 PM
About delegating subscription: this is not part of the central distribution. But it is not very hard to make as a custom addon. It's all about how you want to have it. Basically you're managing DMX_Subscriptions in SQL.
Laurence Neville
New Member
New Member
Posts:56


--
07/08/2009 11:52 PM
Re: using host account - no, I was just using a basic registered user. Here is my PageTemplate in case you can see anything:






[button:subscribe_text]



[button:unsubscribe_text]




[entrylist|view|collection]

[pager|view|collection]


Laurence Neville
New Member
New Member
Posts:56


--
07/08/2009 11:54 PM
Here it is again!

< p >< table >< tr >
< td style="display:[button:subscribe_visible|block;none];text-align:center" >
< a href="[button:subscribe_url]" >
< img src="[dmxmodule:imageurl]Menu/document_heart.png" border="0" alt="[button:subscribe_text]" / >
< /a >
< /td >
< td style="display:[button:unsubscribe_visible|block;none];text-align:center" >
< a href="[button:unsubscribe_url]" >
< img src="[dmxmodule:imageurl]Menu/document_heart.png" border="0" alt="[button:unsubscribe_text]" / >
< /a >
< /td >
< /tr >< /table >< /p >
< div style="display:[entry:iscollection|block;none]" >
< table cellspacing="0" cellpadding="0" border="0" class="EntryList" summary="[entry:name]" >
[entrylist|view|collection]
< /table >
< p style="margin-top:20px;" >[pager|view|collection]< /p >
< /div >
Laurence Neville
New Member
New Member
Posts:56


--
07/08/2009 11:55 PM
My other question was this:
If I use a template view pointed at a collection, and the collection contains "sub-collections", they show up in the entry list. Is there any way to suppress these and just show the files/hyperlinks?
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
07/09/2009 9:33 PM
Hi Laurence,

For the second question: the ItemTemplate renders a table row. You could use a visiblity on that tr and use the iscollection boolean to set it to hide or show.

For former issue: I'll go and paste the first in a template here and hope to have an answer soon.

Peter

Laurence Neville
New Member
New Member
Posts:56


--
08/21/2009 8:44 AM
Thanks for your help with this. Everything is working except this one issue I raised above:

I have a template view to show the entries in a collection, and have put a href="[button:subscribe_url]" and a href="[button:unsubscribe_url]" in the PageTemplate to create subscribe/unsubscrive buttons for the whole collection. However, when I used the following snippets from the default TemplateView.ascx.resx the result is always style="display:none"

style="display:[button:subscribe_visible|block;none]text-align:center"
style="display:[button:unsubscribe_visible|block;none]text-align:center"

The documentation says "‘Visible’ returns true or false depending on whether the user can perform the action", so why is it always false? I have "Show My Subscriptions" on in the module settings.

I would like the subscribe/unsubscribe buttons to show/hide themselves depending on whether the user is already subscribed. Is this what the above is intended to achieve or is there another way?

My DMX version is 5.1.2.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/21/2009 2:23 PM
Hi Laurence,

It's the same problem as before. The 'button' object comes from the entry being viewed, not from the list item that you want in the row. The only object you have at your disposal there is 'entry'. This does not include the desired function. Currently you can't get at the subscription status of the current user for an entry in the list. But if the user is authenticated he/she is allowed to subscribe. So the best you can do is test that and offer both buttons.

On another note: the template view UI was never designed to fully replace the Ajax UI. The design goal was to offer a fast querystring based UI that was simple to adapt.

In future releases more UIs will be added. Specifically in this case a 'plain ascx' UI would come in handy. That way you can do some processing.

Peter
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/21/2009 2:41 PM
What I can look into in the short term (i.e. DMX 5.2) is about adding 'issubscribed' as attribute.

Peter
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/21/2009 3:41 PM
OK ok. I'll do it now. In the about to be released 05.01.03 you'll find new default templates with the code to include a un/subscribe button.

Peter
Laurence Neville
New Member
New Member
Posts:56


--
08/21/2009 7:09 PM
Hi Peter,
Thanks for being so responsive! However, I think you have misunderstood what I was saying.

I was saying that button:subscribe_visible and button:unsubscribe_visible always returned false when used in the PageTemplate and I assume then they are linked to the collection specified in the module settings. I was not trying to use them in the ItemTemplate for child entries. Is is however very nice if I can now do that!

So, should I be able to get accurate results for button:subscribe_visible and button:unsubscribe_visible in the PageTemplate?
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/24/2009 8:23 PM
Hi Laurence,

I'll make a note. I didn't look at that. I'd be surprised though as I've used un/subscribe in the PageTemplate and only one button shows and this changes per item selected. And that logic uses those tokens.

Peter
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
08/24/2009 8:30 PM
Just as a PS: the result is always false for both if the user is not logged in.
Laurence Neville
New Member
New Member
Posts:56


--
08/30/2009 1:39 PM
I think I see the source of the confusion:

The standard TemplateView.ascx.resx does use button:subscribe_visible and button:unsubscribe_visible in the PageTemplate, and these do work when you click into an entry and view it's details (meta data, versions, log etc).

However, I am trying to use it in a different way - I want to create a subscribe/unsubscribe button for the collection that is specified in the module settings. In other words, when the module first loads and you are looking at a collection and its contents, I want a button in the header that allows subscribing/unsubscribing to that collection.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
09/04/2009 1:21 PM
Hi Laurence,

I'd need to check, but operations on the root are limited. And if the root is the absolute root, then almost nothing is possible as it doesn't really exist.

Peter
You are not authorized to post a reply.