Example #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // load the article control
            Node currentNode = (Node)Context.Items["currentNode"];

            if (SFGlobal.IsUserCMS())
            {
                publicSuffix = "";
            }
            BaseArticle article;

            //SFGlobal.SetLangSession();

            if (Session["lang"] != null)
            {
                lang = Session["lang"].ToString();                //Context.Items["lang"];
            }
            else
            {
                lang = SFGlobal.DefaultLanguage;
            }

            string  sql = string.Format("SELECT b.title, b.summary, b.body, b.dateModified, b.templateID ,b.summary, b.keywords FROM " + this.articleBodyTable + this.publicSuffix + " b INNER JOIN " + this.articleContainerTable + this.publicSuffix + " a ON b.articleID = a.id WHERE (a.nodeID = {0}) AND (b.lang = '{1}')", currentNode.Id.ToString(), lang);
            DataSet ds  = SFGlobal.DAL.execDataSet(sql);
            string  title;

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow             dr = ds.Tables[0].Rows[0];
                ArticleTemplateInfo at = SFGlobal.GetArticleTemplate((int)dr["templateID"]);
                article = (BaseArticle)Page.LoadControl(SFGlobal.NodeTemplateLocation + "\\" + at.Src + ".ascx");
                article.ArticleTitle = dr["title"].ToString();
                article.ArticleBody  = dr["body"].ToString();
                article.LastModified = (dr["dateModified"] != DBNull.Value) ? (DateTime)dr["dateModified"] : System.DateTime.Now;
                article.Keywords     = dr["keywords"].ToString();
                article.Summary      = dr["summary"].ToString();
                title = dr["title"].ToString();
            }
            else
            {
                ArticleTemplateInfo at = SFGlobal.GetArticleTemplate(1);
                article = (BaseArticle)Page.LoadControl(SFGlobal.NodeTemplateLocation + "\\" + at.Src + ".ascx");
                article.ArticleTitle = "problem!";
                article.ArticleBody  = "article doesn't exist for this node.";
                title = "BIG PROBLEM!";
            }
            articleHolder.Controls.Add(article);

            /*
             * Node p = currentNode.parent;
             * if (p.parent != null)
             *      while(p.parent != null)
             *      {
             *              title = ": " + p.getName(SFGlobal.DefaultLanguage) + title;
             *              p = p.parent;
             *      }
             */
        }
Example #2
0
 private void fillTemplateSelect()
 {
     System.Collections.Specialized.ListDictionary at = SFGlobal.LoadArticleTemplates();
     foreach (System.Collections.DictionaryEntry de in at)
     {
         ArticleTemplateInfo ati = (ArticleTemplateInfo)de.Value;
         articleTemplateID.Items.Add(new ListItem(ati.Name, ati.ID));
     }
 }
    private void getDefaultArticleTemplate()
    {
        string SessionKey = "ArticleDefaultTemplate" + false;

        HttpContext.Current.Session[SessionKey] = null;
        ArticleTemplateController tempCon = new ArticleTemplateController();
        ArticleTemplateInfo       objInfo = tempCon.GetDefaultTemplate(false, GetSiteID);

        if (objInfo != null)
        {
            dhnDefaultTemplateEditDom.InnerHtml = HttpUtility.HtmlDecode(objInfo.TemplateEditDOM);
            dhnDefaultTemplateRplcDom.InnerHtml = HttpUtility.HtmlDecode(objInfo.DataReplaceFrameDom);
        }
    }
Example #4
0
        /// <summary>
        /// Retrieves the control specified from the XML config file
        /// </summary>
        /// <param name="id">template id</param>
        /// <returns>Control (which inherits BaseArticle)</returns>
        private BaseArticle loadArticle(int id)
        {
            ArticleTemplateInfo ati = getArticleTemplateInfo(id);

            return((BaseArticle)Page.LoadControl(SFGlobal.NodeTemplateLocation + "\\" + ati.Src + ".ascx"));
        }
Example #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            currentNode = (Node)Context.Items["currentNode"];             // get our current node from the context stack
            string sql = "";
            object id  = null;


            // lets give the CMS user special treatment
            if (SFGlobal.IsUserCMS())
            {
                publicSuffix = "";
                // see if there is a preview assigned to this node
                //sql = "SELECT b.versionNumber, b.pageNumber, b.title, b.summary, b.body, b.dateModified, b.templateID, b.keywords FROM  sf_ArticlePages b INNER JOIN sf_Articles a ON b.articleID = a.id WHERE (a.nodeID = " + currentNode.Id + ") AND (a.lang = '" + lang + "') AND (b.preview = 1)";
                id = SFGlobal.DAL.execScalar(String.Format("SELECT b.id FROM sf_ArticlePages b INNER JOIN sf_Articles a ON b.articleID = a.id WHERE (a.nodeID = {0}) AND (b.preview = 1) AND (a.lang = '{1}')", currentNode.Id, this.lang));
                Response.Write("1=" + id);


                // otherwise show the article set for publish
                if (id == null)
                {
                    id = SFGlobal.DAL.execScalar(String.Format("SELECT b.id FROM sf_ArticlePages b INNER JOIN sf_Articles a ON b.articleID = a.id WHERE (a.nodeID = {0}) AND (a.lang = '{1}') AND (b.publish = 1)", currentNode.Id, this.lang));
                    Response.Write("2=" + id);
                }


                // otherwise show the greatest version number
                if (id == null)
                {
                    id = SFGlobal.DAL.execScalar(String.Format("SELECT TOP 1 b.id FROM sf_ArticlePages b INNER JOIN sf_Articles a ON b.articleID = a.id WHERE (a.nodeID = {0}) AND (a.lang = '{1}') ORDER BY b.versionNumber DESC", currentNode.Id, this.lang));
                    Response.Write("3=" + id);
                }
            }
            else
            {
                //id = (int)SFGlobal.DAL.execScalar(String.Format("SELECT TOP 1 b.id FROM sf_ArticlePages" + this.publicSuffix + " b INNER JOIN sf_Articles" + this.publicSuffix + " a ON b.articleID = a.id WHERE (a.nodeID = {0}) AND (a.lang = '{1}')", currentNode.Id, this.lang));
            }

            if (id == null)
            {
                throw new DuryTools.ErrorHandler("can't find article for this node! help!");
            }
            else
            {
                DataSet ds = SFGlobal.DAL.execDataSet("SELECT * FROM sf_ArticlePages" + this.publicSuffix + " WHERE id = " + id.ToString());
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    DataRow             dr = ds.Tables[0].Rows[0];
                    ArticleTemplateInfo at = SFGlobal.GetArticleTemplate((int)dr["templateID"]);
                    article = (BaseArticle)Page.LoadControl(SFGlobal.NodeTemplateLocation + "\\" + at.Src + ".ascx");
                    article.ArticleTitle = dr["title"].ToString();
                    article.ArticleBody  = dr["body"].ToString();
                    article.LastModified = (dr["dateModified"] != DBNull.Value) ? (DateTime)dr["dateModified"] : System.DateTime.Now;
                    article.Keywords     = dr["keywords"].ToString();
                    article.Summary      = dr["summary"].ToString();
                    //title = dr["title"].ToString();
                    holder.Controls.Add(article);

                    Response.Write(Page.CustomQueryString["page"]);
                }
                else
                {
                    throw new DuryTools.ErrorHandler("Can't load article id: " + id.ToString());
                }
            }

            //DataSet ds = SFGlobal.DAL.execDataSet(sql);
            //Response.Write(ds.Tables[0].Rows.Count);
        }