⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewarticle.ascx.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DNNLite.Entites.Modules;
using System.Collections.Generic;

using DNNLite.DesktopModules.Article;
using DNNLite.DesktopModules.Comment;

public partial class DesktopModules_Article_ViewArticle : 
    DNNLite.Entites.Modules.TempletPortalModuleBase  ,
    DNNLite.Entites.Modules.IActionable ,
    DNNLite.DesktopModules.Comment.ICommentAble 
{
    private Article _article = null;
    private ArticleData data = null;

    protected void Page_Init(object sender, EventArgs e)
    {
        data = new ArticleData();
        data.Settings = Settings;
        data.Module = this;
        _article = data.GetArticle();

        //设置关键字
        if (_article != null && ! string.IsNullOrEmpty(_article.Keyword ))
        {
            DNNLite.UI.DNNLitePage pg = Page as DNNLite.UI.DNNLitePage;
            if (pg != null)
            {
                pg.SetKeywords(_article.Keyword);
            }
        }

    }

    #region IActionable 成员

    public System.Collections.Generic.IList<DNNLite.Entites.Modules.ModuleAction> GetCommands()
    {
        IList<ModuleAction> result = new List<ModuleAction>();

        if (string.IsNullOrEmpty(Request["articleid"]))
        {
            result.Add(new ModuleAction("编辑文章", "Edit", EditUrl("Edit")));
        }
        else
        {
            result.Add(new ModuleAction("编辑文章", "Edit", EditUrl("Edit","articleid="+Request["articleid"])));
        }
        return result;
    }

    #endregion

    protected override string TemplateFile
    {
        get 
        {
            if (Settings.ContainsKey("Templet") && (!string.IsNullOrEmpty(Settings["Templet"])))
            {
                return Settings["Templet"];
            }
            else
            {
                return "~/Templets/Article/内容.htm";
            }
        }
    }

    protected override void SetValues(IDictionary<string, object> bag)
    {
        

        bag.Add("data", data);
    }

    

    #region ICommentAble 成员

    public DNNLite.DesktopModules.Comment.CommentOption GetCommentOption()
    {
        CommentOption opt = new CommentOption();
        opt.NeedComment = false;

        if (_article == null) { return opt; }

        opt.Subject = _article.TitleIntact;
        opt.CanComment = true;
        opt.NeedComment = _article.ShowCommentLink;
        opt.CommentKey = _article.CommentKey;

        return opt;
    }

    public DNNLite.DesktopModules.Comment.CommentOption GetCommentOption(string commentkey)
    {
        string[] c = commentkey.Split('-');
        int id = int.Parse( c[c.Length - 1]);

        string sql = "select titleintact,ShowCommentLink from article where id=" + id.ToString();

        DataTable dt = DbService.GetTable(sql);

        CommentOption opt = new CommentOption();
        opt.NeedComment = false;

        if (dt.Rows.Count == 0)
        {
            return opt;
        }

        opt.Subject =  dt.Rows[0]["titleintact"].ToString() ;
        opt.CanComment = true ;
        opt.NeedComment = (bool)dt.Rows[0]["ShowCommentLink"];
        opt.CommentKey = commentkey;

        return opt;

    }

    #endregion
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -