Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="zen">
- <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">
- <span class="zen-media zen-mediaExt" data-chatter-subscribe="1" style="display: {!IF(task.isFollowed, 'none', 'inline')};">
- <a href="javascript:void(0);" class="zen-mrs zen-img">
- <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." />
- </a>
- <span class="zen-mediaBody">
- <a href="javascript:void(0);" title="Follow this task to receive updates in your feed.">
- Follow
- </a>
- </span>
- </span>
- <span class="zen-media zen-mediaExt"
- onblur="SfdcApp.Chatter.SubscribeButton.onHover(event, false)"
- onfocus="SfdcApp.Chatter.SubscribeButton.onHover(event, true)"
- onmouseout="SfdcApp.Chatter.SubscribeButton.onHover(event, false)"
- onmouseover="SfdcApp.Chatter.SubscribeButton.onHover(event, true)"
- data-uidsfdc="341"
- style="display: {!IF(task.isFollowed, 'inline', 'none')};">
- <img src="/s.gif"
- alt="Stop following this task to stop receiving updates in your feed."
- width="12"
- height="1"
- class="chatter-icon zen-mrs chatter-checkedIcon zen-img"
- style="margin-right: 0.25em;"
- title="Stop following this task to stop receiving updates in your feed." />
- <span class="zen-mediaBody">
- Following
- <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.">
- <img src="/s.gif"
- alt="Stop following this task to stop receiving updates in your feed."
- width="12"
- height="1"
- class="chatter-icon chatter-unfollowIcon"
- style="margin-right: 0.25em;"
- title="Stop following this task to stop receiving updates in your feed." />
- </a>
- </span>
- </span>
- </div>
- </div>
- function unfollowHandler(item){
- Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.ctrlMetro.unFollowItem}', item.id, userId, unfollowReturnHandler);
- return false;
- }
- function followHandler(item){
- Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.ctrlMetro.followItem}', item.id, userId, followReturnHandler);
- return false;
- }
- <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')}"/>
- <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')}"/>
- @RemoteAction
- global static string unFollowItem(string itemId, string userId){
- try{
- EntitySubscription es = [select id from EntitySubscription where parentId=:itemId and subscriberId=:userId limit 1000];
- delete es;
- return itemId;
- }catch(System.Exception ex){
- system.debug(ex);
- return 'error';
- }
- return 'error';
- }
- @RemoteAction
- global static string followItem(string itemId, string userId){
- try{
- EntitySubscription es = new EntitySubscription(parentId=itemId, SubscriberId=userId);
- insert es;
- return itemId;
- }catch(System.Exception ex){
- system.debug(ex);
- return 'error';
- }
- return 'error';
- }
Add Comment
Please, Sign In to add comment