Forum Discussion

Willem's avatar
Willem
Guide
9 years ago

Showing a custom list of messages

Hi,

 

On the idea page i try to 'group' the status update posts, and put them on top of the comments.

I tried 2 paths, both failing due (my) lack of lithium specific API knowledge.

 So i hope you guys can help me out.

 

Case

 

current situation:
[New idea] 

  [comment #1]

  [comment #2]

  [comment #3]

  [Status update #1] 

  [comment #4]

  [Status update #2] 

prefered situation:

[New idea] 

  [Status update #1] 

  [Status update #2] 

  [comment #1]

  [comment #2]

  [comment #3]

  [comment #4]

 

What did i do so far:

option 1:

<custom component>

 

<#assign results_list_size = 20 />
<#assign rest_query = "select * from messages where conversation.style='idea' and depth>0 and topic.id='${idea_id}' and subject matches 'Status changed' limit "+ results_list_size />
<@component id="forums.widget.message-list-panel" messages="rest_2.0:/search?q="+rest_query?url style="wide" numMessages="conv:"+results_list_size />

 

This works but now i get the status updates nicely in a list panel. I can't seem to find the widget that allows to show a message object to show as a message. Does it even excists?

 

Option 2:

<custom compontent>

 

<#assign statusUpdates = rest("2.0","/search?q=" + "select * from messages where conversation.style='idea' and depth>0 and topic.id='${idea_id}' and subject matches 'Status changed' limit 300"?url)/>
<#if statusUpdates.data?has_content>
	<#list statusUpdates.data.items as thread>
		<#attempt>
			<#assign userRef         	               = thread.author.id/>
			<#assign threadID       	               = thread.id/>
			<#assign body        		               = thread.body!""/>
			<#assign postTimeFrienly 	       = thread.post_time_friendly!""/>
<#assign new_status = ??????/>
<#assign if_edited_original_author = ??????/> <div class="statusUpdates"> ${userRef}-${threadID}-${body}-${postTimeFrienly} </div> </#attempt> </#list> </#if>

The only thing i can find is the CURRENT status of the parent (the original Idea) but not to what status this post it updated to. I guess the status update 'created' a new post, but i can't seem to find how to get the status updated states. 

Does any one know how to achieve this nicely?  ( i can 'extract' it from the message subject, but that wouldnt be a nice solution)
This still leaves me how to get the post/edited history of a message.

 

 

I would prefer to get a solution option 1 style. if that cant do option2  would still be a nice work around.

 

 


  

  • Try this:

     

     

    <#assign results_list_size = 20 />
    <#assign max_image_width = settings.name.get("layout.message_body_image_max_size", "1000") />
    <#assign image_resize_css = "lia-message-body-content" />
    <#assign rest_query = "select * from messages where conversation.style='idea' and depth > 0 and topic.id='${idea_id}' and subject matches 'Status changed' limit "+ results_list_size />
    <#assign statusUpdates = rest("2.0","/search?q=" + "select * from messages where conversation.style='idea' and depth>0 and topic.id='${idea_id}' and subject matches 'Status changed' limit 300"?url)/>
    <#if statusUpdates.data?has_content>
      <#list statusUpdates.data.items as message>
        <#assign rest_call = "rest_2.0:/messages/" + message.id />
        <@component id="forums.widget.comment-message-view" message=rest_call maxWidth=max_image_width resizeCss=image_resize_css />
      </#list>
    </#if>

    Does that work for what you are trying to do?

     

    -Doug

     

  • DougS's avatar
    DougS
    Khoros Oracle

    Try this:

     

     

    <#assign results_list_size = 20 />
    <#assign max_image_width = settings.name.get("layout.message_body_image_max_size", "1000") />
    <#assign image_resize_css = "lia-message-body-content" />
    <#assign rest_query = "select * from messages where conversation.style='idea' and depth > 0 and topic.id='${idea_id}' and subject matches 'Status changed' limit "+ results_list_size />
    <#assign statusUpdates = rest("2.0","/search?q=" + "select * from messages where conversation.style='idea' and depth>0 and topic.id='${idea_id}' and subject matches 'Status changed' limit 300"?url)/>
    <#if statusUpdates.data?has_content>
      <#list statusUpdates.data.items as message>
        <#assign rest_call = "rest_2.0:/messages/" + message.id />
        <@component id="forums.widget.comment-message-view" message=rest_call maxWidth=max_image_width resizeCss=image_resize_css />
      </#list>
    </#if>

    Does that work for what you are trying to do?

     

    -Doug

     

    • Willem's avatar
      Willem
      Guide
      Hi Doug,

      That is exactly what i try to do.
      Cheers!

      To make it myself and you more easy next time.. is there somewhere some documantation of what widgets/OOB components are available and what parameters they do require?

      kind regards,
      Willem
  • DougS's avatar
    DougS
    Khoros Oracle
    I'm not aware of such a list, but would be nice to have one. Perhaps we could add a TKB article with useful/commonly used components.
    • Willem's avatar
      Willem
      Guide

      Hi DougS,

       

      Just a follow up question,

       

      it seems 

      <@component id="forums.widget.comment-message-view" ... />

      Doesnt work (smoothly) for Mobile.

      Can you tell me what widget i have to use for Mobile?

       

      Kind regards,

      Willem