예제 #1
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        try
        {
            m_refMsg = m_refContApi.EkMsgRef;

            if (!(Request.QueryString["LangType"] == null))
            {
                if (Request.QueryString["LangType"] != "")
                {
                    m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                    m_refContApi.SetCookieValue("LastValidLanguageID", m_intContentLanguage.ToString());
                }
                else
                {
                    if (m_refContApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID"));
                    }
                }
            }
            else
            {
                if (m_refContApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID"));
                }
            }

            if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refContApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refContApi.ContentLanguage = m_intContentLanguage;
            }

            if (!(Request.QueryString["id"] == null))
            {
                m_intId = Convert.ToInt64(Request.QueryString["id"]);
            }

            if (m_intId != -1)
            {

                m_contentType = m_refContApi.EkContentRef.GetContentType(m_intId);

                switch (m_contentType)
                {

                    case Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry:

                        Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi();
                        List<Ektron.Cms.Commerce.EntryData> entry_version_list = new List<Ektron.Cms.Commerce.EntryData>();
                        //causes cms400.sln compile to fail: entry_version_list = m_refCatalogAPI.GetVersionList(m_intId, m_intContentLanguage);
                        populateEntryGrid(entry_version_list);
                        break;

                    default:

                        ContentHistoryData[] content_history_list = (ContentHistoryData[])Array.CreateInstance(typeof(ContentHistoryData), 0);
                        content_history_list = m_refContApi.GetHistoryList(m_intId);
                        populateContentGrid(content_history_list);
                        break;
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
예제 #2
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        try
            {
                if (!(Request.QueryString["LangType"] == null))
                {
                    if (Request.QueryString["LangType"] != "")
                    {
                        ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                        m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
                    }
                    else
                    {

                        if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                        {
                            ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                        }

                    }
                }
                else
                {

                    if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                    }

                }

                if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
                {
                    m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
                }
                else
                {
                    m_refContentApi.ContentLanguage = ContentLanguage;
                }

                m_refMsg = m_refContentApi.EkMsgRef;

                if (Request.QueryString["id"] != "")
                {
                    ContentId = Convert.ToInt64(Request.QueryString["id"]);
                }

                if (Request.QueryString["hist_id"] != "")
                {
                    HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]);
                }

                if (!(Page.IsPostBack))
                {

                    AppImgPath = m_refContentApi.AppImgPath;
                    AppName = m_refContentApi.AppName;
                    ContentLanguage = m_refContentApi.ContentLanguage;
                    imagePath = m_refContentApi.AppPath + "images/ui/icons/";

                    content_data = new ContentData();

                    if (ContentId > 0 && HistoryId > 0)
                    {

                        if (Request.QueryString["xslt"] == "remove")
                        {
                            bApplyXslt = false;
                        }
                        else
                        {
                            bApplyXslt = true;
                        }

                        security_data = m_refContentApi.LoadPermissions(ContentId, "content", ContentAPI.PermissionResultType.Content);

                        m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId);

                        switch (m_contentType)
                        {

                            case EkConstants.CMSContentType_CatalogEntry:

                                Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi();

                                entry_data = m_refCatalogAPI.GetItem(ContentId);
                                entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId);
                                PopulateCatalogPageData(entry_version_data, entry_data);
                                Display_EntryHistoryToolBar(entry_data);
                                break;

                            default:

                                content_data = m_refContentApi.GetContentById(ContentId, 0);
                                hist_content_data = m_refContentApi.GetContentByHistoryId(HistoryId);
                                FolderData folder_data;
                                blog_post_data = new BlogPostData();
                                blog_post_data.Categories = new string[0];
                                if (!(content_data == null))
                                {
                                    bIsBlog = System.Convert.ToBoolean(m_refContentApi.EkContentRef.GetFolderType(content_data.FolderId) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog);
                                    if (bIsBlog)
                                    {
                                        folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
                                        if (hist_content_data.MetaData != null)
                                        {
                                            for (int i = 0; i <= (hist_content_data.MetaData.Length - 1); i++)
                                            {
                                                Ektron.Cms.Common.EkEnumeration.BlogPostDataType MetaType = (Ektron.Cms.Common.EkEnumeration.BlogPostDataType)Enum.Parse(typeof(Ektron.Cms.Common.EkEnumeration.BlogPostDataType), hist_content_data.MetaData[i].TypeId.ToString());

                                                if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Categories || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog categories") > -1)
                                                {
                                                    hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("&#39;", "\'");
                                                    hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("&quot", "\"");
                                                    hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("&gt;", ">");
                                                    hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("&lt;", "<");
                                                    blog_post_data.Categories = Strings.Split((string)(hist_content_data.MetaData[i].Text), ";", -1, 0);
                                                }
                                                else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Ping || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog pingback") > -1)
                                                {
                                                    blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(hist_content_data.MetaData[i].Text));
                                                }
                                                else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Tags || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog tags") > -1)
                                                {
                                                    blog_post_data.Tags = (string)(hist_content_data.MetaData[i].Text);
                                                }
                                                else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Trackback || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog trackback") > -1)
                                                {
                                                    blog_post_data.TrackBackURL = (string)(hist_content_data.MetaData[i].Text);
                                                }
                                            }
                                        }
                                        if (!(folder_data.XmlConfiguration == null))
                                        {
                                            bXmlContent = true;
                                        }
                                    }
                                    hist_content_data.Type = content_data.Type;
                                    PopulatePageData(hist_content_data, content_data);
                                }
                                Display_ContentHistoryToolBar();
                                break;

                        }

                    }
                    else if (ContentId > 0)
                    {

                        m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId);

                        switch (m_contentType)
                        {

                            case EkConstants.CMSContentType_CatalogEntry:

                                Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi();

                                entry_data = m_refCatalogAPI.GetItem(ContentId);
                                entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId);
                                PopulateCatalogPageData(entry_version_data, entry_data);
                                Display_EntryHistoryToolBar(entry_data);
                                break;

                            default:

                                content_data = m_refContentApi.GetContentById(ContentId, 0);
                                PopulatePageData(hist_content_data, content_data);
                                Display_ContentHistoryToolBar();
                                break;

                        }

                    }

                }
                else
                {

                    m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId);
                    content_data = m_refContentApi.GetContentById(ContentId, 0);

                    switch (m_contentType)
                    {

                        case EkConstants.CMSContentType_CatalogEntry:

                            Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi();
                            HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]);
                            m_refCatalogAPI.Restore(ContentId, HistoryId);
                            break;

                        default:

                            HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]);
                            m_refContentApi.RestoreHistoryContent(HistoryId);
                            break;

                    }

                    CloseOnRestore.Text = "<script type=\"text/javascript\">try { location.href = \'content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + ContentId + "&fldid=" + content_data.FolderId + "\'; } catch(e) {}</script>";

                }
            }
            catch (Exception ex)
            {

                ShowError(ex.Message);

            }
    }
예제 #3
0
        protected void InitDataForProducts()
        {
            hdnProductList.Value = Request.QueryString["idlist"];
            _SelectedProductIds = Request.QueryString["idlist"].Split(",".ToCharArray());

            string json = "";
            long contentIdLong;
            ContentData cd;
            EntryData entryData;
            Ektron.Cms.Commerce.CatalogEntryApi catalogEntryApi = new Ektron.Cms.Commerce.CatalogEntryApi();
            int origLang = m_refContentApi.ContentLanguage;

            try
            {
                if (this._SelectedProductIds != null)
                {
                    m_refContentApi.ContentLanguage = Utilities.GetLanguageId(m_refContentApi);
                    foreach (string contentIdString in this._SelectedProductIds)
                    {
                        if (long.TryParse(contentIdString, out contentIdLong))
                        {
                            cd = m_refContentApi.GetContentById(contentIdLong, ContentAPI.ContentResultType.Published);
                            entryData = catalogEntryApi.GetItem(contentIdLong);
                            json += (string)(json.Length > 0 ? "," : "[");
                            json += "{\"Id\":\"" + cd.Id.ToString() + "\",\"Name\":\"" + cd.Title + "\",\"Path\":\"" + cd.Path.TrimEnd("/".ToCharArray()).Replace("\\", "\\\\").Replace("/", "\\\\") + "\",\"Type\":\"product\",\"SubType\":\"" + GetProductTypeName(entryData.EntryType) + "\",\"TypeCode\":\"0\",\"MarkedForDelete\":\"false\",\"NewlyAdded\":\"false\"}";
                        }
                    }
                }

            }
            finally
            {
                m_refContentApi.ContentLanguage = origLang;
            }

            json += (string)(json.Length > 0 ? "]" : "");
            hdnData.Value = json;
        }