Click here to register.
      
Bazaar


     Discuss > Etcetera

Shortcut to Collaboration Post

User jstokes
Date 3/3/2006 2:09 pm
Views 2542
Rating 2    Rate [
|
]
Previous · Next
User Message
jstokes

I'm using a collaboration system for "upcoming events", but I'd like to put a shortcut to the most recent event on our home page. Is there a function for this, or do I have to use a SQL Report?

 Thanks

--- (Edited on 3/ 3/2006 2:09 pm [GMT-0600] by jstokes) ---



Back to Top
Rate [
|
]
 
 
xdanger

this ain't gonna be pretty ;)

select  assetData.title,assetData.url,UNIX_TIMESTAMP(Post.userDefined1) as newstime,assetData.synopsis,assetData.revisionDate as revisionDate
from Thread
left join asset on Thread.assetId=asset.assetId
left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate

inner join asset parent on asset.parentId = parent.assetId
left join assetData parentdata on parent.assetId = parentdata.assetId
where  parentdata.url = 'en/news' and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and (assetData.status='approved' or (assetData.ownerUserId='3' and assetData.ownerUserId<>'1') or assetData.tagId=NULL or assetData.status='pending') and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId)
group by assetData.assetId order by Thread.isSticky desc, userDefined1 desc LIMIT 3

 change parentdata.url to point to your CS and set limit to 1.. And maybe UNIX_TIMESTAMP(Post.userDefined1) as newstime to assetData.startDate and the same change to order by section

--- (Edited on 3/ 8/2006 03:19 [GMT-0600] by xdanger) ---



Back to Top
Rate [
|
]
 
 
jstokes

*cough* thanks? *choke*
--- (Edited on 3/ 8/2006 10:43 am [GMT-0600] by jstokes) ---



Back to Top
Rate [
|
]
 
 
jstokes

 

I managed to pull off what I need. Here's the query I used:

SELECT DISTINCT SUBSTRING(Post.content, 1, 250) AS "" FROM Post JOIN Collaboration ON Post.AssetID=Collaboration.lastPostID WHERE Collaboration.assetID LIKE "(Here I cheated and looked up the Asset ID for the Collaboration system in question)" ORDER BY Post.DateUpdated DESC LIMIT 1; 

 I used the "lastPostID" field to determine which post to display, and assumed the posts were in chronological order, so I did an ORDER BY descending and took the top post.

 Still a nasty query, but not quite as ugly as the first one :) Couldn't have done it without the first one as a jumping off point, though. Thanks!

 

--- (Edited on 3/14/2006 1:55 pm [GMT-0600] by jstokes) ---



Back to Top
Rate [
|
]
 
 
xdanger

You should really use where assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) so that you get the latest version of the asset, and then you don't have to use distinct. And there is a automatic way to have a little preview of the message, it's in the synopsis column.
--- (Edited on 3/14/2006 15:03 [GMT-0600] by xdanger) ---



Back to Top
Rate [
|
]
 
 
     Discuss > Etcetera



Recent Discussions Color Key

Design:

Development:

Et Cetera:

Install/Upgrade:  

Smoketest:

Template Group:


Re: Navigation links by rogier - Fri @ 04:06pm

Re: Navigation links by techwriter - Fri @ 03:23pm

Re: Best way to make files available to webgui comunity by bernd - Fri @ 02:50pm

Re: User event history by knowmad - Fri @ 02:02pm

Re: Best way to make files available to webgui comunity by lctn2 - Fri @ 01:55pm

Re: Strategic Roadmap by JT - Fri @ 01:55pm

Re: Navigation links by rogier - Fri @ 01:55pm

Re: 2009 Presidents Meeting by JT - Fri @ 01:10pm

Re: navigation new window by rogier - Fri @ 01:03pm

Re: navigation new window by rogier - Fri @ 12:53pm

Re: WUC 2009 by JT - Fri @ 12:50pm

Re: Best way to make files available to webgui comunity by preaction - Fri @ 12:35pm

Re: Pagination markup by rogier - Fri @ 12:35pm

Re: Best way to make files available to webgui comunity by kristi - Fri @ 12:29pm