Пример #1
0
    //静态发布栏目和内容页
    protected void btnpub3_Click(object sender, EventArgs e)
    {
        try
        {
            TPortalClass.JpSite site = new TPortalClass.JpSite();
            TPortalClass.JpShtml jpshtml = new TPortalClass.JpShtml();
            TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns();
            DataTable dt_col = JpColumns.GetColumnsOnline();
            if (dt_col.Rows.Count > 0)
            {
                for (int i = 0; i < dt_col.Rows.Count; i++)
                {
                    if (dt_col.Rows[i]["shtml"].ToString() == "1")  //静态发布的栏目
                    {
                        TPortalClass.JpColumns pubcol = new TPortalClass.JpColumns(dt_col.Rows[i]["cid"].ToString());
                        pubcol.shtmlpublish(2, int.Parse(txtdays.Value));
                    }
                }
            }
            Response.Write("<script language=javascript>alert('发布成功!');window.location='pubhtml.aspx';</script>");
        }
        catch
        {
            Response.Write("<script language=javascript>alert('发布失败!');window.location='pubhtml.aspx';</script>");
        }
        finally
        {

        }
    }
Пример #2
0
 //���·���ʱͬʱ������ҳ�����õĶ���ҳ
 public void PubHtml_Config()
 {
     //��̬������ҳ�����õ�ҳ��
     try
     {
         String fname = "";
         JpSite site = new JpSite();
         JpShtml jpshtml = new JpShtml();
         jpshtml.source_path = "http://" + site.host + "/index.aspx";
         jpshtml.target_path = site.root + fname;
         jpshtml.Flush();
         JpPubHtml JpPubHtml = new JpPubHtml();
         String pages = JpPubHtml.pages;
         if (pages != "")
         {
             String[] lv_pages = pages.Split(',');
             for (int i = 0; i < lv_pages.Length; i++)
             {
                 fname = lv_pages[i].Substring(0, lv_pages[i].LastIndexOf(".")) + ".html";
                 jpshtml.source_path = "http://" + site.host + lv_pages[i];
                 jpshtml.target_path = site.root + fname;
                 jpshtml.Flush();
             }
         }
     }
     catch
     {
     }
 }
Пример #3
0
        /// <summary>
        /// ��̬������ǰ��Ŀ����ǰ��Ŀ��ҳ������ҳ��
        /// </summary>
        /// <param name="withfiles">withfiles = 0,ֻ������Ŀҳ��withfiles = 1:������Ŀҳ��δ�������£�withfiles = 2������Ŀҳ����������</param>
        /// <param name="days">����</param>
        public void shtmlpublish(int withfiles, int days)
        {
            DAO db = new DAO();
            String sql = null, listTemplate = this.tmp_col, articleTemplate = this.tmp_art;
            if (listTemplate == "")
                listTemplate = "NONE";
            JpSite site = new JpSite();

            if (site.homepage != listTemplate)// ������ҳ������Ŀ¼
            {
                System.IO.Directory.CreateDirectory(site.root + "/" + site.cidPath(cid));
                //�����
                if (site.lan_big5 == "1")
                {
                    System.IO.Directory.CreateDirectory(site.root + "/big5/" + site.cidPath(cid));
                }
            }
            if (listTemplate != "NONE")
            {
                // ������Ŀ��ҳ
                String fname = "";
                if (site.homepage == listTemplate)// ��ҳ
                {
                    fname = "/index.html";
                }
                else
                {
                    fname = "/" + site.cidPath(cid) + "index.html";
                }

                String source_path = "http://" + site.host + "/" + listTemplate + "?cid=" + this.cid;
                String target_path = site.root + fname;
                JpShtml jpshtml = new JpShtml();
                jpshtml.source_path = source_path;
                jpshtml.target_path = target_path;
                jpshtml.Flush();

                if (site.lan_big5 == "1")
                {
                    fname = "/big5" + fname;
                    source_path = "http://" + site.host + "/big5/" + listTemplate + "?cid=" + this.cid;
                    target_path = site.root + fname;
                    jpshtml.source_path = source_path;
                    jpshtml.target_path = target_path;
                    jpshtml.Flush();
                }

            }

            if (withfiles > 0)
            {
                if (days == 0)
                {
                    // ��һ����������ҳ
                    if (withfiles == 1)
                        sql = "SELECT aid FROM v_article_url WHERE cid = @cid AND ISNULL(shtml_created,0) = 0 ORDER BY asort DESC";// ��������
                    else
                        sql = "SELECT aid FROM v_article_url WHERE cid = @cid ORDER BY asort DESC";// ��������
                }
                else
                {
                    string ls_date = System.DateTime.Now.AddDays(-days).ToString();
                    // ��һ����������ҳ
                    if (withfiles == 1)
                    {
                        sql = "SELECT aid FROM v_article_url WHERE cid = @cid AND ISNULL(shtml_created,0) = 0 ";
                        sql += " AND modtime > '" + ls_date + "' ORDER BY asort DESC";   // ��������
                    }
                    else
                    {
                        sql = "SELECT aid FROM v_article_url WHERE cid = @cid  AND modtime > '" + ls_date + "' ORDER BY asort DESC";// ��������
                    }
                }

                SqlParameter[] sqlparam = {
                    db.MakeInParam("@cid",SqlDbType.VarChar,cid)
                };
                DataTable dt = db.GetDataTable(sql, sqlparam);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int aid = Int32.Parse(dt.Rows[i]["aid"].ToString());
                    String fname = "/" + site.cidPath(cid) + (aid) + ".html";
                    String source_path = "http://" + site.host + articleTemplate + "?aid=" + aid;
                    String target_path = site.root + fname;
                    JpShtml jpshtml = new JpShtml();
                    jpshtml.source_path = source_path;
                    jpshtml.target_path = target_path;
                    jpshtml.Flush();

                    if (site.lan_big5 == "1")
                    {
                        fname = "/big5" + fname;
                        source_path = "http://" + site.host + "/big5/" + articleTemplate + "?aid=" + aid;
                        target_path = site.root + fname;
                        jpshtml.source_path = source_path;
                        jpshtml.target_path = target_path;
                        jpshtml.Flush();
                    }

                }
                sql = "UPDATE JpArticle SET shtml_created = 1 WHERE cid =@cid AND status = '����' AND getdate() >= pubtime and getdate() <= endtime";
                sqlparam = new SqlParameter[]{
                    db.MakeInParam("@cid",SqlDbType.VarChar,cid)
                };
                db.Execute(sql, sqlparam);
                db.Close();

                // ��һɾ����������
                sql = "SELECT aid FROM JpArticle WHERE cid = @cid AND shtml_created = 1 AND status = '����'";
                sqlparam = new SqlParameter[]{
                    db.MakeInParam("@cid",SqlDbType.VarChar,cid)
                };
                dt = db.GetDataTable(sql, sqlparam);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int aid = Int32.Parse(dt.Rows[i]["aid"].ToString());
                    String fnamedelete = site.root + "/" + site.cidPath(cid) + (aid) + ".html";
                    if (System.IO.File.Exists(fnamedelete))
                        System.IO.File.Delete(fnamedelete);
                }
                sql = "UPDATE JpArticle SET shtml_created = 0 WHERE cid = @cid AND status = '����'";
                sqlparam = new SqlParameter[]{
                    db.MakeInParam("@cid",SqlDbType.VarChar,cid)
                };
                db.Execute(sql, sqlparam);
                db.Close();
            }
            db.Close();
        }
Пример #4
0
        // ��̬����
        public void shtmlpublish(bool publish, String l_cid, int l_aid)
        {
            JpSite site = new JpSite();
            // ������Ŀ��ҳ
            JpColumns col = new JpColumns(l_cid);

            String sql = "UPDATE JpArticle SET shtml_created = ";
            if (publish)
            {
                // ���·���������������ҳ
                String fname = "/" + site.cidPath(l_cid) + (l_aid) + ".html";
                JpShtml jpshtml = new JpShtml();
                jpshtml.source_path = "http://" + site.host + col.tmp_art + "?aid=" + l_aid;
                jpshtml.target_path = site.root + fname;
                jpshtml.Flush();

                //�����
                if (site.lan_big5 == "1")
                {
                    jpshtml.source_path = "http://" + site.host + "/big5" + col.tmp_art + "?aid=" + l_aid;
                    jpshtml.target_path = site.root + "/big5/" + fname;
                    jpshtml.Flush();
                }

                sql += "1";

            }
            else
            {
                System.IO.File.Delete(site.root + "/" + site.cidPath(l_cid) + (l_aid) + ".html");

                //�����
                if (site.lan_big5 == "1")
                {
                    System.IO.File.Delete(site.root + "/big5/" + site.cidPath(l_cid) + (l_aid) + ".html");
                }

                sql += "0";
            }
            sql += " where aid = " + l_aid;
            DAO db = new DAO();
            db.Execute(sql);
            db.Close();
        }