admin posted on April 01, 2009 22:50

Recently in the Active Social forums a question was asked about a way to create a user’s ‘My Links’ tab on the Active Social Profile.
There was a suggestion of utilising the AS “Share A Link” functionality to actually create the links and have some way to provide a summary of those links rather than having to trawl through the user’s journal looking for them.
I suggested making use of the SQLGridSelectedView (SGSV) (see Part 1 for details), well here are a couple of screenshots showing just how easy and versatile integrating AS & SGSV really is.
Here we can see a user sharing some links.
On that user’s profile we can see the ‘My Links’ tab.
After a quick look at the AS tables the following sql was created:
1: SELECT j.Summary, c.Comment,
2: CASE
3: WHEN image = '' THEN ''
4: ELSE '<img src="http://www.yoursite.com/portals/' + @PortalID +'/activesocial/profiles/' + @asuid + '/gallery/' + image + ' border=0 />'
5: END
6: AS 'linkimage'
7: FROM activesocial_Journal j
8: LEFT JOIN activesocial_JournalComments jc ON j.JournalId = jc.JournalId
9: LEFT JOIN activesocial_Comments c ON jc.CommentId = c.Commentid
10: WHERE j.JournalTypeId = 7 -- JournalTypeId 7 = Link
11: AND j.UserId = @asuid
12: AND j.PortalId = @PortalID
13: -- if you don't want to include any shared links from
14: -- Groups that the user belongs to, then exclude them.
15: AND j.JournalId NOT in (select jg.journalid
16: FROM activesocial_JournalGroup jg
17: JOIN activesocial_Groups g ON jg.GroupId = g.GroupId
18: WHERE g.PortalId = @PortalID)
I have only just started using SGSV and couldn’t find a way to test the value of a field, I didn’t want to return an empty value for the image.
The case statement simply returns an empty string when there is no image on the link and returns a full img tag to display the image associated with the link.
The SGSV module didn’t seem to like the use of the case statement in the sql so I had to create a stored procedure which takes the PortalId and ASUID as input parameters.
Then simple templates are used to display the links, in this case in a table.
1: <script language="JavaScript">
2: var columnCount = 0;
3: var columnsDesired = 1;
4: </script>
5: <table border=0 width=100%>
6:
7: <script language="JavaScript">
8: if (columnCount % columnsDesired == 0 ) document.write("<TR>"); 9: </script>
10: <td>[SPSV:Value:LinkImage] [SPSV:Value:Summary]</td>
11: <script language="JavaScript">
12: columnCount++;
13: if (columnCount > 0 && columnCount % columnsDesired ==0 ) { 14: document.write("</TR>"); 15: }
16: </script>
17:
18: <script language="JavaScript">
19: if (columnCount % columnsDesired > 0 ) document.write("</TR>"); 20: </script>
21: </TABLE>
Active Social 3rd Party Module Integration – Part 1