Exemplo n.º 1
0
 protected string GetViewUrl(Eucalypto.ISearchResult entity)
 {
     if (SearchEntityUrlCallback != null)
         return SearchEntityUrlCallback(entity).GetClientUrl(this, true);
     else
         return string.Empty;
 }
Exemplo n.º 2
0
    protected string GetShortDescription(Eucalypto.News.Item item)
    {
        if (item.Description == null)
          return string.Empty;

        if (item.Description.Length > 100)
          return item.Description.Substring(0, 100) + "...";
          return item.Description;
    }
Exemplo n.º 3
0
    private SyndicationLibrary.RSS.RssItem CreateRssItem(Eucalypto.News.Item item)
    {
        string link = item.URL;

        string rssTitle = string.Format("[{0}] {1}", item.Category.DisplayName, item.Title);

        SyndicationLibrary.RSS.RssItem rssItem = new SyndicationLibrary.RSS.RssItem(rssTitle, item.Description, link);
        rssItem.PublicationDate = item.UpdateDate;
        rssItem.Guid = new SyndicationLibrary.RSS.RssGuid(link, true);

        return rssItem;
    }
Exemplo n.º 4
0
    private SyndicationLibrary.RSS.RssItem CreateRssItem(Eucalypto.Forum.Message msg)
    {
        //Calculate the link of the forum
        //The link is encoded automatically by the Rss library
        string link = Navigation.Forum_ViewTopic(msg.Topic.Id, msg.Id).GetAbsoluteClientUrl(false);

        string rssTitle = string.Format("[{0}] {1}", msg.Topic.Category.DisplayName, msg.Title);

        SyndicationLibrary.RSS.RssItem item = new SyndicationLibrary.RSS.RssItem(rssTitle, msg.Body, link);
        item.PublicationDate = msg.UpdateDate;
        item.Guid = new SyndicationLibrary.RSS.RssGuid(link, true);

        return item;
    }
Exemplo n.º 5
0
    private SyndicationLibrary.RSS.RssItem CreateRssItem(Eucalypto.Wiki.Article article)
    {
        //Calculate the link of the article
        //The link is encoded automatically by the Rss library
        string link = Navigation.Wiki_ViewArticle(article.Name, article.Version).GetAbsoluteClientUrl(false);

        string rssTitle = string.Format("[{0}] {1}", article.Category.DisplayName, article.Title);

        SyndicationLibrary.RSS.RssItem item = new SyndicationLibrary.RSS.RssItem(rssTitle, article.Description, link);
        item.PublicationDate = article.UpdateDate;
        item.Guid = new SyndicationLibrary.RSS.RssGuid(link, true);

        return item;
    }
Exemplo n.º 6
0
    protected string GetLastPost(Eucalypto.Forum.Topic topic)
    {
        IList<Eucalypto.Forum.Message> messages = Eucalypto.Forum.ForumManager.GetMessagesByTopic(topic);

        string status = "{1}<br />&nbsp;&nbsp;by {2}";

        DateTime lastReply = messages[messages.Count - 1].InsertDate;
        string lastUser = messages[messages.Count - 1].Owner;

        status = string.Format(status,
                    messages.Count,
                    Utilities.GetDateTimeForDisplay(lastReply),
                    Utilities.GetDisplayUser(lastUser));

        return status;
    }
Exemplo n.º 7
0
    private void ExploreMessages(Eucalypto.Forum.Category forum, Eucalypto.Forum.Topic topic,
                        IList<Eucalypto.Forum.Message> messages, string filterParent, int level)
    {
        foreach (Eucalypto.Forum.Message msg in messages)
        {
            if (string.Equals(msg.IdParentMessage, filterParent, StringComparison.InvariantCultureIgnoreCase))
            {
                Controls_ViewMessage ctlMessage = (Controls_ViewMessage)LoadControl("~/Controls/ViewMessage.ascx");
                ctlMessage.SetMessage(msg);
                ctlMessage.SetIndentLevel(level);

                Controls.Add(ctlMessage);

                ExploreMessages(forum, topic, messages, msg.Id, level + 1);
            }
        }
    }
Exemplo n.º 8
0
    private void LoadList(Eucalypto.Wiki.Category category)
    {
        //Get the standard articles
        IList<Eucalypto.Wiki.Article> articles = Eucalypto.Wiki.WikiManager.GetArticles(category, Eucalypto.Wiki.ArticleStatus.EnabledAndApproved);

        list.LoadList(articles);

        //My articles
        sectionMyArticles.Visible = false;
        if (User.Identity.IsAuthenticated)
        {
            IList<Eucalypto.Wiki.Article> myArticles = Eucalypto.Wiki.WikiManager.GetArticlesByOwner(category, User.Identity.Name,
                                                                            Eucalypto.Wiki.ArticleStatus.DisabledOrNotApproved);

            if (myArticles.Count > 0)
            {
                listMyArticles.LoadList(myArticles);
                sectionMyArticles.Visible = true;
            }
        }

        //Get not approved or disabled articles
        sectionNotApproved.Visible = false;
        if (User.Identity.IsAuthenticated &&
            Eucalypto.SecurityHelper.MatchPermissions(Page.User, category.ApprovePermissions))
        {
            IList<Eucalypto.Wiki.Article> articlesNotApproved = Eucalypto.Wiki.WikiManager.GetArticles(category,
                                                                            Eucalypto.Wiki.ArticleStatus.DisabledOrNotApproved);

            //Remove the articles of the current user because are already added to the previous list (My Articles)
            List<Eucalypto.Wiki.Article> articlesNotApprovedFilter = new List<Eucalypto.Wiki.Article>();
            foreach (Eucalypto.Wiki.Article article in articlesNotApproved)
            {
                if (string.Equals(article.Owner, User.Identity.Name) == false)
                    articlesNotApprovedFilter.Add(article);
            }

            if (articlesNotApprovedFilter.Count > 0)
            {
                listNotApproved.LoadList(articlesNotApprovedFilter);
                sectionNotApproved.Visible = true;
            }
        }
    }
Exemplo n.º 9
0
    private void LoadNews(Eucalypto.News.Category category)
    {
        if (Eucalypto.SecurityHelper.CanRead(Page.User, category, null) == false)
          throw new Eucalypto.InvalidPermissionException("read category");

        HtmlLink link = new HtmlLink();
        link.Href = Navigation.News_CategoryRss(CategoryName).GetServerUrl(true);
        link.Attributes.Add("rel", "alternate");
        link.Attributes.Add("type", "application/rss+xml");
        link.Attributes.Add("title", category.DisplayName);
        Page.Header.Controls.Add(link);

        linkRss.HRef = Navigation.News_CategoryRss(CategoryName).GetServerUrl(true);

        title.InnerText = category.DisplayName;

        PagingInfo paging = new PagingInfo(5, 0);
        IList<Eucalypto.News.Item> list = Eucalypto.News.NewsManager.GetItems(category, paging);

        listRepeater.DataSource = list;
        listRepeater.DataBind();
    }
Exemplo n.º 10
0
    /// <summary>
    /// Set the message to load. This method autmatically set also the IdMessage property.
    /// </summary>
    /// <param name="msg"></param>
    public void SetMessage(Eucalypto.Forum.Message msg)
    {
        IdMessage = msg.Id;

        LoadMessage(msg);
    }
Exemplo n.º 11
0
    private void LoadMessage(Eucalypto.Forum.Message msg)
    {
        Eucalypto.Forum.Topic topic = msg.Topic;
        Eucalypto.Forum.Category forum = topic.Category;

        if (Eucalypto.SecurityHelper.CanRead(Page.User, forum, msg) == false)
            throw new Eucalypto.InvalidPermissionException("read message");

        //Create a link (a element) that can be used for anchor (vertical navigation), note that I cannot use ASP.NET element because ASP.NET automatically change the ID adding the container id (containerid:controlid)
        string anchorId = "msg" + msg.Id; //Note: this is the format that you must use when you want to navigate to a message: es. ViewTopic.aspx?id=xxx#msgYYY
        messageTitle.InnerHtml = string.Format("<a id=\"{0}\">{1}</a>", anchorId, HttpUtility.HtmlEncode(msg.Title));

        lblAuthor.InnerText = Utilities.GetDisplayUser(msg.Owner);
        lblDate.InnerText = Utilities.GetDateTimeForDisplay(msg.InsertDate);

        sectionBody.InnerHtml = msg.Body;

        if (DeleteLinkVisible && Eucalypto.SecurityHelper.CanDelete(Page.User, forum, msg))
            sectionDelete.Visible = true;
        else
            sectionDelete.Visible = false;

        if (ReplyLinkVisible && Eucalypto.SecurityHelper.CanInsert(Page.User, forum))
            sectionNew.Visible = true;
        else
            sectionNew.Visible = false;

        if (msg.Attachment != null)
        {
            sectionAttachment.Visible = true;

            linkAttach.InnerHtml = HttpUtility.HtmlEncode(msg.Attachment.Name);
            linkAttach.HRef = Navigation.Forum_Attach(msg.Id, true).GetServerUrl(true);
        }
        else
            sectionAttachment.Visible = false;

        //Flag the control as loaded
        mMessageLoaded = true;
    }
Exemplo n.º 12
0
 protected string GetViewUrl(Eucalypto.Wiki.ArticleBase article)
 {
     return Navigation.Wiki_ViewArticle(ArticleName, article.Version).GetClientUrl(Page, true);
 }
Exemplo n.º 13
0
    private void LoadCmbValidationMode(Eucalypto.XHtmlMode mode)
    {
        cmbXhtmlMode.Items.Clear();

        cmbXhtmlMode.Items.Add(Eucalypto.XHtmlMode.None.ToString());
        cmbXhtmlMode.Items.Add(Eucalypto.XHtmlMode.BasicValidation.ToString());
        cmbXhtmlMode.Items.Add(Eucalypto.XHtmlMode.StrictValidation.ToString());

        cmbXhtmlMode.SelectedValue = mode.ToString();
    }
Exemplo n.º 14
0
    private void LoadCmbBackupMode(Eucalypto.WikiBackupMode mode)
    {
        cmbBackupMode.Items.Clear();

        cmbBackupMode.Items.Add(Eucalypto.WikiBackupMode.Always.ToString());
        cmbBackupMode.Items.Add(Eucalypto.WikiBackupMode.Request.ToString());
        cmbBackupMode.Items.Add(Eucalypto.WikiBackupMode.Never.ToString());

        cmbBackupMode.SelectedValue = mode.ToString();
    }
Exemplo n.º 15
0
 protected string GetViewUrl(Eucalypto.News.Item item)
 {
     return Navigation.News_ViewItem(item.Id).GetClientUrl(Page, true);
 }
Exemplo n.º 16
0
    private void LoadAttachmentsList(Eucalypto.Wiki.Article article)
    {
        string[] attachments = Eucalypto.Wiki.WikiManager.GetFileAttachments(article, Eucalypto.Wiki.EnabledStatus.Enabled);

        listAttachments.DataSource = attachments;
        listAttachments.DataBind();
    }
Exemplo n.º 17
0
    private string ElaborateXHTML(Eucalypto.Wiki.Article latestArticle, Eucalypto.Wiki.ArticleBase article)
    {
        Eucalypto.XHTMLText xhtml = new Eucalypto.XHTMLText();
        xhtml.Load(article.Body);

        string[] attachments = Eucalypto.Wiki.WikiManager.GetFileAttachments(latestArticle, Eucalypto.Wiki.EnabledStatus.Enabled);
        Array.Sort<string>(attachments);

        xhtml.ReplaceLinks(delegate(string oldUrl, out string newUrl)
                            { ReplaceLink(latestArticle.Name, attachments, oldUrl, out newUrl); }
                            );

        //Insert the TOC
        xhtml.InsertTOC(article.TOC);

        return xhtml.GetXhtml();
    }
Exemplo n.º 18
0
    Navigation.NavigationPage searchResult_SearchEntityUrlCallback(Eucalypto.ISearchResult entity)
    {
        Eucalypto.Wiki.Article article = (Eucalypto.Wiki.Article)entity;

        return Navigation.Wiki_ViewArticle(article.Name, 0);
    }
Exemplo n.º 19
0
    Navigation.NavigationPage searchResult_SearchEntityUrlCallback(Eucalypto.ISearchResult entity)
    {
        Eucalypto.Forum.Message msg = (Eucalypto.Forum.Message)entity;

        return Navigation.Forum_ViewTopic(msg.Topic.Id, msg.Id);
    }
Exemplo n.º 20
0
    private void LoadArticle(Eucalypto.Wiki.Article latestArticle)
    {
        Eucalypto.Wiki.ArticleBase article;

        if (Eucalypto.SecurityHelper.CanRead(Page.User, latestArticle.Category, latestArticle) == false)
            throw new Eucalypto.InvalidPermissionException("read article");

        if (ArticleVersion == 0)
            article = latestArticle;
        else
            article = Eucalypto.Wiki.WikiManager.GetArticleByVersion(latestArticle, ArticleVersion);

        lblArticleTitle.InnerText = article.Title;
        lblAuthor.InnerText = Utilities.GetDisplayUser(article.Author);
        lblDate.InnerText = Utilities.GetDateTimeForDisplay(article.UpdateDate);
        lblVersion.InnerText = article.Version.ToString();
        lblArticleDescription.InnerText = article.Description;

        string body = article.Body;
        if (ElaborateOutput)
            body = ElaborateXHTML(latestArticle, article);

        sectionBody.InnerHtml = body;

        linkLatestVersion.HRef = Navigation.Wiki_ViewArticle(latestArticle.Name, 0).GetServerUrl(true);
        linkBrowseVersions.HRef = Navigation.Wiki_ViewArticleVersions(latestArticle.Name).GetServerUrl(true);

        //Show the edit only if EditLinkVisible and this is the latest article version
        bool enabledEdit = Eucalypto.SecurityHelper.CanEdit(Page.User, latestArticle.Category, latestArticle);
        linkEdit.Visible = enabledEdit && latestArticle == article;
        linkEdit.HRef = Navigation.Wiki_EditArticle(ArticleName).GetServerUrl(true);
        linkPrint.HRef = Navigation.Wiki_PrintArticle(ArticleName, ArticleVersion).GetServerUrl(true);

        sectionActions.Visible = SectionActionsVisible;

        sectionProperties.Visible = SectionPropertiesVisible;
    }
Exemplo n.º 21
0
 protected int GetRepliesCount(Eucalypto.Forum.Topic topic)
 {
     //Remove 1 because it is the topic message
     return Eucalypto.Forum.ForumManager.MessageCountByTopic(topic) - 1;
 }