Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Multiple Document Selector Form Control View modes: 
User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/23/2012 2:19:42 PM
   
Multiple Document Selector Form Control
Because it's missing from Kentico for some unknown reason, I have cobbled together a form control that will allow you to select multiple documents and store their nodeid's as a pipe-delimited string in a document or web part field.

You can even drag and drop to sort them.

Download it from MediaFire here.

I've only tested this in Firefox and it works fine. It should work in other browsers.

Kentico Folks - Please take this as an example of what many of us have wanted and make a form control that ships with Kentico 7 or 8. Thank you.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/24/2012 5:40:45 AM
   
RE:Multiple Document Selector Form Control
Hello,


Thank you. You can also submit the control to the marketplace: http://devnet.kentico.com/Marketplace.aspx. I have sent a suggestion to our developers as well.


Best regards,
Helena Grulichova

User avatar
Member
Member
jeff.magill-fleishman - 8/2/2012 10:01:25 PM
   
RE:Multiple Document Selector Form Control
@Kentico This is something that I would really be interested in as well.

@Jiveabillion Is this the final version you are using? I installed it in my instance and there is a pretty major bug - it doesn't delete documents from database when you remove them from the <ul id="SelectedDocuments">. In other words, I can add documents to the list but I can never remove them. It looks like the IDs are being removed from hfIDs but the txtIDs is the control being bound to the database. Not really sure what is going on with those two but guidance would be appreciated.

Also, if it isnt too much to ask, can you also provide a working example on how to get this out of the database as a transformation or a web part?

Kentico, let's get an official version of a "multiple document selector!" :)

User avatar
Member
Member
jeff.magill-fleishman - 8/2/2012 10:38:00 PM
   
RE:Multiple Document Selector Form Control
It appears to be working again, though I dont think I changed anything. I'll keep an eye out but the "major bug" is gone for the moment. A working example would still be nice though ;)

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/6/2012 4:52:17 PM
   
RE:Multiple Document Selector Form Control
This is by no means a final version. In fact, I just threw it together as a proof of concept. Feel free to modify it if needed.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/6/2012 5:02:03 PM
   
RE:Multiple Document Selector Form Control
As far as getting it out of the database in a transformation, you would have to use a custom macro method.

You can get the files stored in the field any way you want by following the example here
http://www.kenticosolutions.com/Developer-Tips/Tip/May-2011/Many-to-Many-relationships-in-the-Kentico-CMS-Cont.aspx

or by accessing the property and splitting the value in a string array to iterate through and query the document tree.

You can make a custom macro method that takes the field's values as an argument and returns a TreeNodeDataSet that you can apply text transformations to or something.

In short, there are a lot of ways you can use the data stored. It's up to you.

In all honesty, I think the devs at Kentico need to create a form control that utilizes the Document Relationships feature in a controlled manner where we can specify the settings for the control to assign a specific relationship name and set it as the left or right document. If I have the time, I will try to cobble a proof of concept together for that as well. I do think that I will have trouble with it though because there is no way to order the documents in the relationship as far as I know.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/6/2012 5:13:07 PM
   
RE:Multiple Document Selector Form Control
If one were to change the way the IDS were stored to something like this "|12|23|4|"
where it has a leading and a trailing pipe (|) symbol, then you could query the database like this:

Select * from View_CMS_Tree_Joined TJ INNER JOIN
View_Custom_YourDocumentType_Jouned YJ on YJ.ColumnWithIDS like '%|' + Convert(varchar(50),TJ.NodeID) + '|%'
WHERE YJ.NodeID = 123

--OR make a where condition in a databound web part like this

WHERE = " '{%CurrentDocument.ColumWithIDs%}' Like '%|' + Convert(varchar(50),NodeID) + '|%'


Adding the extra pipe symbols would give us what we need to prevent "12|23|4" from selecting Nodes with NodeIDs 1,2, or 3.

Do you follow me?

User avatar
Member
Member
Peter-geckonm - 9/28/2012 11:40:41 AM
   
RE:Multiple Document Selector Form Control
This is something that i have been searching out for a while and it has confused me as to why its not been available.

I have just put into version 7 and it doesn't seem to work. I know it has been made for version 6 but is there any chance of a quick fix?

User avatar
Member
Member
adween - 3/20/2013 10:04:31 AM
   
RE:Multiple Document Selector Form Control
@Jiveabillion Really cool, exactly what i was after. Thanks :D

@Peter-geckonm I've just installed in kentico 7 and it is working. For others experiencing problems in 7, the only thing i had to change was the using statements at the top to the following.

using TreeNode = CMS.DocumentEngine.TreeNode;
using CMS.Controls;
using CMS.DocumentEngine;