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

📄 addarticle.aspx.vb

📁 程序设计:Flyangel 用到了vb.net c# asp.net xml等 最大特别是核心功能组件化. 特色: 强大的后台管理功能 支持二级分类 支持匿名投稿 超强用户权限设置
💻 VB
字号:
Option Strict On

Imports System
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Xml
Imports flyangel.editor.flashhtmledit
Imports System.Configuration
Imports flyangel.article.twotipclass

Public Class addarticle
    Inherits System.Web.UI.Page
    Protected WithEvents readme_add As System.Web.UI.WebControls.Label
    Protected WithEvents txttitle As System.Web.UI.WebControls.TextBox
    Protected WithEvents typeid As System.Web.UI.WebControls.DropDownList
    Protected WithEvents zhuantiid As System.Web.UI.WebControls.DropDownList
    Protected WithEvents picurl As System.Web.UI.WebControls.TextBox
    Protected WithEvents article_tj As System.Web.UI.WebControls.CheckBox
    Protected WithEvents about_word As System.Web.UI.WebControls.TextBox
    Protected WithEvents article_author As System.Web.UI.WebControls.TextBox
    Protected WithEvents article_comefrom As System.Web.UI.WebControls.TextBox
    Protected WithEvents Flashhtmledit1 As New flyangel.editor.flashhtmledit
    Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
    Protected WithEvents Panel_upload As System.Web.UI.WebControls.Panel
    Protected WithEvents return_index As System.Web.UI.WebControls.HyperLink

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
        '不要使用代码编辑器修改它。
        Flashhtmledit1.SetShowCopyRight = "flash@ycdx.edu.cn"
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '在此处放置初始化页的用户代码
        AddHandler Flashhtmledit1.EditorHTMLSaved, AddressOf Me.OnEditorHTMLSaved
        If Not IsPostBack Then

            Dim dpuser As iUserClass = HowToUsingFlyangel.iUserClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
            dpuser.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringB")
            If Not dpuser.GetUserLoginCheck() Then
                Response.Redirect("userlogin.aspx")
                Exit Sub
            End If
            If Request.Cookies("UserInfo").Values("UserName") = "" Then
                Response.Redirect("userlogin.aspx")
                Exit Sub
            End If

            Dim dbfly As iArticleClass = HowToUsingFlyangel.iArticleClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
            dbfly.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringA")
            dbfly.SetLogXmlDocument = ConfigurationSettings.AppSettings("logxml")

            dbfly.Addarticle_Sort(typeid, "addarticle_class_type")
            dbfly.Addarticle_Zhuanti(zhuantiid)

            If Request.Cookies("UserInfo")("ShengHe_Level") = "1" Then
                readme_add.Text = "请注意,您目前具有自动发布文章的权限,即您的文章不需要经过审核!"
            Else
                readme_add.Text = "<br>请注意,您目前所投稿的文章需要经过管理员审核,文章才会被发布!"
            End If
            If Request.Cookies("UserInfo")("Html_Level") = "1" Then
                readme_add.Text += "<br>你具备发布HTML格式内容的权限,请妥善使用此功能!"
            Else
                readme_add.Text += "<br>你不具备发布HTML格式内容的权限,如果需要,请与管理员联系!"
                Flashhtmledit1.Htmleditorbool = 0
            End If
            If Request.Cookies("UserInfo")("Upload_Level") = "1" Then
                Panel_upload.Visible = True
            Else
                Flashhtmledit1.Uploadfilebool = 0
            End If
            article_author.Text = Request.Cookies("UserInfo")("UserName")
            article_comefrom.Text = Request.Cookies("UserInfo")("UserClass")
        End If
    End Sub

    Private Sub OnEditorHTMLSaved(ByVal sender As System.Object, ByVal e As flyangel.editor.flashhtmledit.EditorEventArgs) Handles Flashhtmledit1.EditorHTMLSaved
        Dim dpuser As iUserClass = HowToUsingFlyangel.iUserClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        dpuser.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringB")
        If Not dpuser.GetUserLoginCheck() Then
            Response.Redirect("article_save.aspx?action=nologin")
            Exit Sub
        End If


        Dim _textcontent As ArticleAddInfo
        _textcontent.ArticleAboutKey = about_word.Text.Trim()
        _textcontent.ArticleAddAuthor = Request.Cookies("UserInfo")("UserName")
        _textcontent.ArticleAuthor = article_author.Text.Trim()

        If Request.Cookies("UserInfo")("Html_Level") = "1" Then
            _textcontent.ArticleContent = Flashhtmledit1.HTMLValue
        Else
            _textcontent.ArticleContent = flash.article_function.FormatStr(Flashhtmledit1.HTMLValue)
        End If

        _textcontent.ArticleNfrom = article_comefrom.Text.Trim()
        If picurl.Text.Trim <> "" Then
            _textcontent.ArticlePicUrl = picurl.Text.Trim()
            _textcontent.ArticlePicChk = 1
        Else
            _textcontent.ArticlePicUrl = ""
            _textcontent.ArticlePicChk = 0
        End If
        _textcontent.ArticleTitle = txttitle.Text.Trim()

        _textcontent.ArticleTypeId = Convert.ToInt32((typeid.SelectedValue).Substring(7))

        _textcontent.ArticleZhuanTiId = Convert.ToInt32(zhuantiid.SelectedValue)

        If article_tj.Checked Then
            _textcontent.ArticleTuiJian = 1
        Else
            _textcontent.ArticleTuiJian = 0
        End If

        Dim dbfly As iArticleClass = HowToUsingFlyangel.iArticleClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        dbfly.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringA")

        Dim dplog As iSystemClass = HowToUsingFlyangel.iSystemClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        dplog.SetLogXmlSchema = ConfigurationSettings.AppSettings("logxsd")
        Dim addnewsresultbool As Boolean
        If Request.Cookies("UserInfo")("ShengHe_Level") = "1" Then
            addnewsresultbool = dbfly.AddArticle_Record(_textcontent, True, DoArticleType.AddNews)
            dplog.SetLogXmlDocument = ConfigurationSettings.AppSettings("logxml")
        Else
            addnewsresultbool = dbfly.AddArticle_Record(_textcontent, False, DoArticleType.AddNews)
            dplog.SetLogXmlDocument = ConfigurationSettings.AppSettings("eventxml")
        End If

        If addnewsresultbool Then
            dplog.Log_Add_cache("文章投稿", Request.Cookies("UserInfo")("UserName"), txttitle.Text & "(栏目:" & typeid.SelectedItem.Text & ")", Request.UserHostAddress)
            Response.Redirect("article_save.aspx?action=news")
        Else
            Response.Redirect("article_save.aspx?action=error")
        End If


    End Sub

End Class

⌨️ 快捷键说明

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