Guest User

Untitled

a guest
Feb 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. <div class="zen">
  2. <div class="zen-pts" data-chatter-widget="subscribeBtn" data-sfdc-entity-id="{!task.projectTask.Id}" data-sfdc-network-id="000000000000000" onclick="SfdcApp.Chatter.SubscribeButton.onClick(event);" data-uidsfdc="340">
  3. <span class="zen-media zen-mediaExt" data-chatter-subscribe="1" style="display: {!IF(task.isFollowed, 'none', 'inline')};">
  4. <a href="javascript:void(0);" class="zen-mrs zen-img">
  5. <img src="/s.gif" alt="Follow this task to receive updates in your feed." width="12" height="1" class="chatter-icon chatter-followIcon" style="margin-right: 0.25em;" title="Follow this task to receive updates in your feed." />
  6. </a>
  7. <span class="zen-mediaBody">
  8. <a href="javascript:void(0);" title="Follow this task to receive updates in your feed.">
  9. Follow
  10. </a>
  11. </span>
  12. </span>
  13. <span class="zen-media zen-mediaExt"
  14. onblur="SfdcApp.Chatter.SubscribeButton.onHover(event, false)"
  15. onfocus="SfdcApp.Chatter.SubscribeButton.onHover(event, true)"
  16. onmouseout="SfdcApp.Chatter.SubscribeButton.onHover(event, false)"
  17. onmouseover="SfdcApp.Chatter.SubscribeButton.onHover(event, true)"
  18. data-uidsfdc="341"
  19. style="display: {!IF(task.isFollowed, 'inline', 'none')};">
  20.  
  21. <img src="/s.gif"
  22. alt="Stop following this task to stop receiving updates in your feed."
  23. width="12"
  24. height="1"
  25. class="chatter-icon zen-mrs chatter-checkedIcon zen-img"
  26. style="margin-right: 0.25em;"
  27. title="Stop following this task to stop receiving updates in your feed." />
  28.  
  29. <span class="zen-mediaBody">
  30. Following
  31. <a href="javascript:void(0);" class="zen-mls zen-imgExt" data-chatter-subscribe="0" title="Stop following this task to stop receiving updates in your feed.">
  32. <img src="/s.gif"
  33. alt="Stop following this task to stop receiving updates in your feed."
  34. width="12"
  35. height="1"
  36. class="chatter-icon chatter-unfollowIcon"
  37. style="margin-right: 0.25em;"
  38. title="Stop following this task to stop receiving updates in your feed." />
  39. </a>
  40. </span>
  41. </span>
  42. </div>
  43. </div>
  44.  
  45. function unfollowHandler(item){
  46. Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.ctrlMetro.unFollowItem}', item.id, userId, unfollowReturnHandler);
  47. return false;
  48. }
  49.  
  50. function followHandler(item){
  51. Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.ctrlMetro.followItem}', item.id, userId, followReturnHandler);
  52. return false;
  53. }
  54.  
  55. <img id='imgFollow' onClick="followHandler(this); return false;" title="click to follow" style="height:16px; width:16px; display:none;" src="{!URLFOR($Resource.StatusIcons,'error_icon.png')}"/>
  56. <img id='imgUnfollow' onClick="unfollowHandler(this); return false;" title="Following: click to unfollow" style="height:16px; width:16px; display:none;" src="{!URLFOR($Resource.StatusIcons,'check_icon.png')}"/>
  57.  
  58. @RemoteAction
  59. global static string unFollowItem(string itemId, string userId){
  60. try{
  61.  
  62. EntitySubscription es = [select id from EntitySubscription where parentId=:itemId and subscriberId=:userId limit 1000];
  63. delete es;
  64. return itemId;
  65. }catch(System.Exception ex){
  66. system.debug(ex);
  67. return 'error';
  68. }
  69.  
  70. return 'error';
  71. }
  72.  
  73. @RemoteAction
  74. global static string followItem(string itemId, string userId){
  75. try{
  76. EntitySubscription es = new EntitySubscription(parentId=itemId, SubscriberId=userId);
  77. insert es;
  78. return itemId;
  79. }catch(System.Exception ex){
  80. system.debug(ex);
  81. return 'error';
  82. }
  83.  
  84. return 'error';
  85. }
Add Comment
Please, Sign In to add comment