English (United States) English (United Kingdom)
Wednesday, March 10, 2010
archives

categories

articles
01

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.

image

 

On that user’s profile we can see the ‘My Links’ tab.

image

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]&nbsp;[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

Comments

cliff
# cliff
Thursday, April 02, 2009 12:54 AM
Thanks for the example. Looks like the possibilities are truly limitless with ActiveSocial.
woohaee
# woohaee
Thursday, June 11, 2009 5:46 PM
Um - this looks amazing - and exactly what I need - but I have downloaded everything you have suggested - even the Mike Hollas stuff

which gives you the SQL and then the TXT file for the extension - but how do I actually call the SQL from the template - there doesn't seem to be any reference point - I'm probably (definitely) missing something very simple here

I have created an ascx file with your template code in which I call from the ProfileView.ascx page using:

[AM:CONTROLS:TAB:MyStuff]
runat="server" />
[/AM:CONTROLS:TAB:MyStuff]

And all I get back is: [SGSV:Value:LinkImage] [SGSV:Value:Summary]

I know why because I haven't linked the SQL in - but I don't know how

Sorry for the ramble - I hope all this makes sense

Post Comment

Only registered users may post comments.

Copyright 2010 fatgeorge