コード例 #1
0
        /// <summary>
        /// Fills the context.
        /// </summary>
        /// <param name="absolutePath">The absolute path.</param>
        private void FillContext(string absolutePath)
        {
            CMSContext.Current.Outline = CMSContext.Current.GetQueryString(absolutePath);
            CMSContext.Current.Outline = Regex.Match(CMSContext.Current.Outline, "/[\\w]+(?<outline>.*)").Groups["outline"].Value;

            //GET PAGEID
            using (IDataReader reader = FileTreeItem.GetItemByOutlineAll(CMSContext.Current.Outline, CMSContext.Current.SiteId))
            {
                if (reader.Read())
                {
                    CMSContext.Current.PageId = (int)reader["PageId"];
                }

                reader.Close();
            }

            //SHOW  REQUESTED VERSION
            if (CMSContext.Current.QueryString["VersionId"] != null)
            {
                CMSContext.Current.VersionId = int.Parse(CMSContext.Current.QueryString["VersionId"].ToString());
            }
            //SHOW PUBLISHED VERSION
            else
            {
                //GET PUBLISHED VERSION
                int statusId = WorkflowStatus.GetLast(-1);
                using (IDataReader reader = PageVersion.GetByLangIdAndStatusId(CMSContext.Current.PageId, LanguageId, statusId))
                {
                    if (reader.Read())
                    {
                        CMSContext.Current.VersionId = (int)reader["VersionId"];
                    }

                    reader.Close();
                }
            }
        }