• Jonathan Li
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies

Hi, I have a custom article type that has a chatterfeed called by
<knowledge:articleRendererToolBar articleId="{! $CurrentPage.parameters.id}" canVote="true" showChatter="true">.
Im not sure how to have an upload button to select a file, and then when i press upload, it pushes the file as a post to the chatter feed.

In general, I want the exact same feature as the file upload button in the chatter feed, but with custom "choose file" and "upload" buttons in the 
visual force page. Thanks

I have a wrapper class this holds 3 custom article types which are made in the org. Now that I have the wrapper class, I'm not sure how to work the find() function with my wrapper class because my wrapper class is not an object in the org, and I cannot SOQL with it. Heres my code with the VF page and Controller.

public without sharing class FilterEventController {

    private final User currentUser;

    public String searchInput {
        get;
        set;
    }
    public List < Store_Event__kav > articles {
        get;
        set;
    }
    public List < CompleteArticle > articleNew {
        get;
        set;
    }


    public void find() {
        //Nothing to search for5
        if (searchInput == null || searchInput.length() <= 2) {
            articles = [SELECT Id, KnowledgeArticleId, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
                FROM Store_Event__kav
                WHERE PublishStatus = 'Online'
                and Language = 'en_US'
                and Store_ID__c = : this.currentUser.Store_ID__c
            ];
        } else {
            searchInput = String.escapeSingleQuotes('%' + searchInput + '%');
            articles = [SELECT Id, KnowledgeArticleId, ArticleType, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
                FROM Store_Event__kav
                WHERE(PublishStatus = 'Online'
                    and Language = 'en_US')
                and Store_ID__c = : this.currentUser.Store_ID__c
                and(Title LIKE: searchInput OR Summary LIKE: searchInput)
            ];
        }
    }



    public User StoreManager() {
        return [select Id, Name, Email, Title, AboutMe, FullPhotoUrl, MobilePhone, Store_ID__c from User];
    }
    Public User getStoreManager() {
        return currentUser;
    }


    public FilterEventController() {
        Store_Event__kav temp;
        Store_event__ViewStat temp2;
        Store_event__VoteStat temp3;
        articleNew = new List < CompleteArticle > ();


        articles = [select Id, KnowledgeArticleId, ArticleType, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
            from Store_Event__kav
            where PublishStatus = 'Online'
            and Language = 'en_US'
            and IsLatestVersion = true
            and Store_ID__c = : this.currentUser.Store_ID__c
        ];

        List < Store_event__ViewStat > viewCount = [SELECT NormalizedScore, ViewCount, ParentId, Channel FROM Store_Event__ViewStat where Channel = 'AllChannels'];

        List < Store_event__VoteStat > voteCount = [SELECT Channel, Id, NormalizedScore, ParentId FROM Store_Event__VoteStat WHERE Channel = 'AllChannels'];

        for (Store_Event__kav article: articles) {
            temp = article;
            for (Store_event__ViewStat viewStat: viewCount)
                if (viewStat.parentId == article.KnowledgeArticleId)
                    temp2 = viewStat;

            for (Store_event__VoteStat voteStat: voteCount)
                if (voteStat.parentId == article.KnowledgeArticleId)
                    temp3 = voteStat;

            CompleteArticle a = new CompleteArticle(temp, temp2, temp3);
            articleNew.add(a);
        }
        List<CompleteArticle> articleData = [SELECT id,title,store,summary,views,parentId,votes
                                             FROM CompleteArticle__c];


    }
    public class CompleteArticle {
        public Id id {
            get;
            set;
        }
        public id parentId {
            get;
            set;
        }
        public String summary {
            get;
            set;
        }
        public String title {
            get;
            set;
        }
        public String store {
            get;
            set;
        }
        public Double views {
            get;
            set;
        }
        public Double votes {
            get;
            set;
        }

        public CompleteArticle(Store_Event__kav articles, Store_event__ViewStat viewCount, Store_event__VoteStat voteCount) {
            this.id = articles.KnowledgeArticleId;
            this.title = articles.Title;
            this.store = articles.Store__c;
            this.summary = articles.Summary;
            this.views = viewCount.ViewCount;
            this.parentId = viewCount.ParentId;
            this.votes = voteCount.NormalizedScore;
            this.parentId = voteCount.ParentId;
        }

    }



}

VF:

<apex:page controller="FilterEventController">
<apex:form >
<apex:pageBlock title="Events at your Local Store">
<apex:pageBlockSection >

<apex:inputText label="Search: " value="{!searchInput}" title="Search for Title or Summary" >
<apex:actionSupport event="onkeyup" action="{!find}" reRender="table1"/>
</apex:inputText>
    
</apex:pageBlockSection>
  <a class="btn btn-primary" href="/knowledge/publishing/articleEdit.apexp?&type=Store_Event__kav">New Store Article</a>
<apex:pageBlockSection columns="1" id="table1">
<apex:pageBlockTable value="{!articleNew}" var="item" id="Table" >
   <apex:column headerValue="Event Title" >
                <a href="/knowledge/publishing/articleOnlineDetail.apexp?id={!item.id}">{!item.title}</a> </apex:column>
      <apex:column headerValue="Summary" value="{!item.Summary}"/>
    <apex:column headerValue="Votes" value="{!item.votes}"/>
    <apex:column headerValue="Views" value="{!item.views}"/>

 

</apex:pageBlockTable>
   
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
  



</apex:page>

Here I have this code:

{!IF(p.Staff_Pick__c = TRUE,$Resource.ThumbsUp,' ')}

If staff pick is checked off, I want it to display a thumbs up image from resource, otherwise its an empty space. But when I have this line of code, it just shows
/resource/1399044523000/ThumbsUp instead

Hi, I have a custom article type that has a chatterfeed called by
<knowledge:articleRendererToolBar articleId="{! $CurrentPage.parameters.id}" canVote="true" showChatter="true">.
Im not sure how to have an upload button to select a file, and then when i press upload, it pushes the file as a post to the chatter feed.

In general, I want the exact same feature as the file upload button in the chatter feed, but with custom "choose file" and "upload" buttons in the 
visual force page. Thanks

I have a wrapper class this holds 3 custom article types which are made in the org. Now that I have the wrapper class, I'm not sure how to work the find() function with my wrapper class because my wrapper class is not an object in the org, and I cannot SOQL with it. Heres my code with the VF page and Controller.

public without sharing class FilterEventController {

    private final User currentUser;

    public String searchInput {
        get;
        set;
    }
    public List < Store_Event__kav > articles {
        get;
        set;
    }
    public List < CompleteArticle > articleNew {
        get;
        set;
    }


    public void find() {
        //Nothing to search for5
        if (searchInput == null || searchInput.length() <= 2) {
            articles = [SELECT Id, KnowledgeArticleId, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
                FROM Store_Event__kav
                WHERE PublishStatus = 'Online'
                and Language = 'en_US'
                and Store_ID__c = : this.currentUser.Store_ID__c
            ];
        } else {
            searchInput = String.escapeSingleQuotes('%' + searchInput + '%');
            articles = [SELECT Id, KnowledgeArticleId, ArticleType, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
                FROM Store_Event__kav
                WHERE(PublishStatus = 'Online'
                    and Language = 'en_US')
                and Store_ID__c = : this.currentUser.Store_ID__c
                and(Title LIKE: searchInput OR Summary LIKE: searchInput)
            ];
        }
    }



    public User StoreManager() {
        return [select Id, Name, Email, Title, AboutMe, FullPhotoUrl, MobilePhone, Store_ID__c from User];
    }
    Public User getStoreManager() {
        return currentUser;
    }


    public FilterEventController() {
        Store_Event__kav temp;
        Store_event__ViewStat temp2;
        Store_event__VoteStat temp3;
        articleNew = new List < CompleteArticle > ();


        articles = [select Id, KnowledgeArticleId, ArticleType, Title, Store__c, Details__c, Event_Date__c, Summary, Thumbnail__c, Store_ID__c
            from Store_Event__kav
            where PublishStatus = 'Online'
            and Language = 'en_US'
            and IsLatestVersion = true
            and Store_ID__c = : this.currentUser.Store_ID__c
        ];

        List < Store_event__ViewStat > viewCount = [SELECT NormalizedScore, ViewCount, ParentId, Channel FROM Store_Event__ViewStat where Channel = 'AllChannels'];

        List < Store_event__VoteStat > voteCount = [SELECT Channel, Id, NormalizedScore, ParentId FROM Store_Event__VoteStat WHERE Channel = 'AllChannels'];

        for (Store_Event__kav article: articles) {
            temp = article;
            for (Store_event__ViewStat viewStat: viewCount)
                if (viewStat.parentId == article.KnowledgeArticleId)
                    temp2 = viewStat;

            for (Store_event__VoteStat voteStat: voteCount)
                if (voteStat.parentId == article.KnowledgeArticleId)
                    temp3 = voteStat;

            CompleteArticle a = new CompleteArticle(temp, temp2, temp3);
            articleNew.add(a);
        }
        List<CompleteArticle> articleData = [SELECT id,title,store,summary,views,parentId,votes
                                             FROM CompleteArticle__c];


    }
    public class CompleteArticle {
        public Id id {
            get;
            set;
        }
        public id parentId {
            get;
            set;
        }
        public String summary {
            get;
            set;
        }
        public String title {
            get;
            set;
        }
        public String store {
            get;
            set;
        }
        public Double views {
            get;
            set;
        }
        public Double votes {
            get;
            set;
        }

        public CompleteArticle(Store_Event__kav articles, Store_event__ViewStat viewCount, Store_event__VoteStat voteCount) {
            this.id = articles.KnowledgeArticleId;
            this.title = articles.Title;
            this.store = articles.Store__c;
            this.summary = articles.Summary;
            this.views = viewCount.ViewCount;
            this.parentId = viewCount.ParentId;
            this.votes = voteCount.NormalizedScore;
            this.parentId = voteCount.ParentId;
        }

    }



}

VF:

<apex:page controller="FilterEventController">
<apex:form >
<apex:pageBlock title="Events at your Local Store">
<apex:pageBlockSection >

<apex:inputText label="Search: " value="{!searchInput}" title="Search for Title or Summary" >
<apex:actionSupport event="onkeyup" action="{!find}" reRender="table1"/>
</apex:inputText>
    
</apex:pageBlockSection>
  <a class="btn btn-primary" href="/knowledge/publishing/articleEdit.apexp?&type=Store_Event__kav">New Store Article</a>
<apex:pageBlockSection columns="1" id="table1">
<apex:pageBlockTable value="{!articleNew}" var="item" id="Table" >
   <apex:column headerValue="Event Title" >
                <a href="/knowledge/publishing/articleOnlineDetail.apexp?id={!item.id}">{!item.title}</a> </apex:column>
      <apex:column headerValue="Summary" value="{!item.Summary}"/>
    <apex:column headerValue="Votes" value="{!item.votes}"/>
    <apex:column headerValue="Views" value="{!item.views}"/>

 

</apex:pageBlockTable>
   
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
  



</apex:page>

Here I have this code:

{!IF(p.Staff_Pick__c = TRUE,$Resource.ThumbsUp,' ')}

If staff pick is checked off, I want it to display a thumbs up image from resource, otherwise its an empty space. But when I have this line of code, it just shows
/resource/1399044523000/ThumbsUp instead