当前位置: 首页>>代码示例>>C#>>正文


C# ContentAPI.GetContentById方法代码示例

本文整理汇总了C#中ContentAPI.GetContentById方法的典型用法代码示例。如果您正苦于以下问题:C# ContentAPI.GetContentById方法的具体用法?C# ContentAPI.GetContentById怎么用?C# ContentAPI.GetContentById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentAPI的用法示例。


在下文中一共展示了ContentAPI.GetContentById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Display_EditLibraryItem


//.........这里部分代码省略.........

            if (_Type == "quicklinks")
            {
                dr[3] = "<input type=\"hidden\" size=\"9\" maxlength=\"19\" name=\"frm_content_id\" value=\"" + library_data.ContentId + "\"/>" + library_data.ContentId;
            }
            else
            {
                dr[2] += "<input type=\"hidden\" name=\"frm_content_id\" value=\"\"/>";
            }
            dr[2] += "<input type=hidden name=frm_libtype id=frm_libtype value=\"" + _Type + "\"/>";
            dt.Rows.Add(dr);
        }

        DataView dv = new DataView(dt);
        EditLibraryItemGrid.DataSource = dv;
        EditLibraryItemGrid.DataBind();

        m_libraryToolBar = (librarytoolbar)(LoadControl("controls/library/librarytoolbar.ascx"));
        ToolBarHolder.Controls.Add(m_libraryToolBar);
        m_libraryToolBar.AppImgPath = _AppImgPath;
        m_libraryToolBar.PageAction = _PageAction;
        m_libraryToolBar.FolderInfo = folder_data;
        m_libraryToolBar.SecurityInfo = security_data;
        m_libraryToolBar.FolderId = _FolderId;
        m_libraryToolBar.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.LibraryInfo = library_data;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            editTabs.Visible = true;
            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            bool bManagedAsset = false;
            ContentData content_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

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

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Setting the titles for tabs
            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            RenderSummaryEditor();

            //Populating the category
            string Action = "Edit";
            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            int v = 0;
                            ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, "update", _FolderId, ref v, null).ToString();

                            ShowTagEditArea(m_refcontentapi, library_data);
                        }
                        else
                        {
                            string strLink;
                            strLink = "<a href=\"library.aspx?LangType=" + meta_data[0].Language.ToString() + "&action=" + _PageAction + "&id=" + _Id + "&parent_id=" + _FolderId + "\">";
                            ShowMeta.Text = "<span style=\"COLOR: red\">*Note - Related metadata/tags will be displayed only if a specific language was selected. You may either go back to the page and select a language, or click " + strLink + "here</a> to view the metadata with the language selected automatically.</span>";
                        }
                    }

                }
            }
        }
    }
开发者ID:jaytem,项目名称:minGit,代码行数:101,代码来源:library.aspx.cs

示例2: Display_AddLibraryItem


//.........这里部分代码省略.........
        else
        {
            OverwriteSubPanel0.Visible = true;

            if (_Type == "hyperlinks")
            {
                tr2_td2_ali_controls.Text = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"http://\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                frm_filename.Visible = false;
            }
            else if (_Type == "quicklinks")
            {
                tr2_td2_ali_controls.Text = "<span style=\"white-space:nowrap;\">" + _SitePath + "<input type=\"text\" size=\"" + (50 - Strings.Len(_SitePath)) + "\" maxlength=\"255\" name=\"frm_filename\" value=\"\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/></span>";
                frm_filename.Visible = false;
            }
            AddItemFocus.Text = "document.forms[0].frm_title.focus();";
        }

        if (_Type != "quicklinks" && _Type != "forms")
        {
            addTabs.Visible = false;
            editTabs.Visible = true;

            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            ContentData content_data = new ContentData();
            bool bManagedAsset = false;
            string ty = "";

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

            if (_Operation == "overwrite")
            {
                Action = "Edit";
                ty = "update";
                if (library_data.ContentId != 0)
                {
                    content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);

                    if (!(content_data == null))
                    {
                        meta_data = content_data.MetaData;
                        _ContentTeaser = content_data.Teaser;
                        if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                        {
                            bManagedAsset = true;
                        }
                    }
                    else
                    {
                        meta_data = m_refcontentapi.GetMetaDataTypes("id");
                    }
                }
            }
            else
            {
                if (_PageAction == "addlibraryitem")
                {
                    ty = "add";
                }
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            RenderSummaryEditor();
            // Setting the titles for tabs
            AdddvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            AdddvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            AdddvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            //Populating the category Tab

            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)//  bManagedAsset)
                    {
                        int c = 0;
                        ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, ty, _FolderId, ref c, null).ToString();

                        ShowTagEditArea(m_refcontentapi, library_data);
                    }
                }
            }
        }
    }
开发者ID:jaytem,项目名称:minGit,代码行数:101,代码来源:library.aspx.cs

示例3: Display_ViewLibraryItem


//.........这里部分代码省略.........
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content LED label") + "</span>";
            dr[1] = library_data.DisplayLastEditDate;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content DC label") + "</span>";
            dr[1] = library_data.DisplayDateCreated;

            dt.Rows.Add(dr);
        }
        // Don't tbind the data yet, may have teaser data to include...

        //SEARCH METADATA''''''''''''
        ContentData content_data = null;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            bool bManagedAsset = false;

            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

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

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                _ContentTeaser = _ContentTeaser.Replace("<p> </p>", string.Empty);
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Add the Teaser-Data for this Library item:
            dr = dt.NewRow();
            dr[0] = _MessageHelper.GetMessage("description label");
            dr[1] = _ContentTeaser;
            dt.Rows.Add(dr);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        //ViewLibraryMeta.Text = cFieldsO.WriteMetadataForView(meta_data).ToString
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            ViewLibraryMeta.Text = CustomFields.WriteFilteredMetadataForView(meta_data, _FolderId, true).ToString();
开发者ID:jaytem,项目名称:minGit,代码行数:67,代码来源:library.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        refContentAPI = new ContentAPI();
        refEkContent = refContentAPI.EkContentRef;
        refEkSite = refContentAPI.EkSiteRef;
        ContentMetaData[] metaData = null;
        Ektron.Cms.ContentData originalContent = null;

        ltrEnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea();
        if (ContentID != 0)
        {
            originalContent = refContentAPI.GetContentById(this.ContentID, ResultType);
            if (resultType == ContentAPI.ContentResultType.Staged && originalContent == null)
            {
                originalContent = refContentAPI.GetContentById(this.ContentID, ContentAPI.ContentResultType.Published);
            }
            if (originalContent.FolderId == FolderID)
            {
                metaData = originalContent.MetaData;
            }
        }
        if(metaData == null){
            metaData = refContentAPI.GetMetaDataTypes("id");
        }

        int validCounter = 0;

        if (originalContent != null || ContentID == 0)
        {
            foreach (ContentMetaData cMeta in metaData)
            {
                if (cMeta.Type.ToString() == "ImageSelector")
                {
                    cMeta.Text = cMeta.Text.Replace(SitePath + "assets/", "");
                    cMeta.Text = System.Text.RegularExpressions.Regex.Replace(cMeta.Text, "\\?.*", "");
                }
            }

            StringBuilder sbMetadata = Ektron.Cms.CustomFields.WriteFilteredMetadataForEdit(
                metaData,
                false,
                MetaUpdateString,
                this.FolderID,
                ref validCounter,
                refEkSite.GetPermissions(this.FolderID, 0, "folder"));

            if (!String.IsNullOrEmpty(sbMetadata.ToString()))
            {
                ltrMetadataHTML.Text = sbMetadata.ToString();
                if (sbMetadata.ToString().Contains("<span style=\"color:red\">"))
                   MetadataRequired =  metadataRequired = true;
            }
            else
            {
                ltrMetadataHTML.Text = "<span>"+siteAPI.EkMsgRef.GetMessage("lbl no metadata associated")+"</span>";
            }
        }

        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/jfunct.js", "CommunityJFunctJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/metadata_selectlist.js", "CommunityMetadataSelectListJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/searchfuncsupport.js", "CommunitySearchFuncSupportJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/internCalendarDisplayFuncs.js", "CommunityInternCalendarDisplayFuncsJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/metadata_associations.js", "CommunityMetadataAssociationsJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/optiontransfer.js", "CommunityOptionTransferJS");

        Ektron.Cms.API.JS.RegisterJSBlock(this, "window.ek_ma_ForceNewWindow = " + ForceNewWindow.ToString().ToLower(), "ek_ma_ForceNewWindow");
    }
开发者ID:jaytem,项目名称:minGit,代码行数:67,代码来源:Metadata.ascx.cs

示例5: CaptureMetadata

    private StringBuilder CaptureMetadata(long contentId, long folderId)
    {
        StringBuilder metadataOutput = new StringBuilder();
        ContentAPI myContentAPI = new ContentAPI();
        ContentData myContentEditData = new ContentData();
        ContentMetaData[] myContentMetadata;
        string myType = "update";
        int myCounter = 0;
        Ektron.Cms.Site.EkSite myEkSite = new Ektron.Cms.Site.EkSite();

        int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED;

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

        if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            myContentAPI.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES;
        }
        else
        {
            myContentAPI.ContentLanguage = ContentLanguage;
        }

        if (contentId != -1)
        {
            myEkSite = myContentAPI.EkSiteRef;
            myContentEditData = myContentAPI.GetContentById(contentId, 0);
            myContentMetadata = myContentEditData.MetaData;

            if (myContentMetadata.Length > 0)
            {
                metadataOutput = Ektron.Cms.CustomFields.WriteFilteredMetadataForEdit(myContentMetadata, false, myType, folderId, ref myCounter, myEkSite.GetPermissions(folderId, 0, "folder"));
                if (metadataOutput.Length > 0)
                {
                    ltrShowMetadata.Text = "<li><a id=\"metadataAnchor\" href=\"#\" onclick=\"dmsMetadataShowHideCategory(\'metadata\');return false;\" title=\"View Metadata\" class=\"selected\">" + myContentAPI.EkMsgRef.GetMessage("metadata text") + "</a></li>";
                }
            }
        }

        return metadataOutput;
    }
开发者ID:jaytem,项目名称:minGit,代码行数:62,代码来源:DmsMetadata.aspx.cs

示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        contentAPI = new ContentAPI();
        ekContent = contentAPI.EkContentRef;
        messageHelper = contentAPI.EkMsgRef;

        distributionMode = DistributionWizardHelperMethods.GetModeFromQueryString(Request);

        switch (distributionMode)
        {
            case DistributionWizardEnumerations.Mode.CommunityCopy:
                if (ParseCommunityCopyParameters())
                {
                    long distributionFolderID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_FOLDER_ID];
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_ORIG_CONTENT_ID];

                    ContentData content = contentAPI.GetContentById(
                        distributionContentID,
                        ContentAPI.ContentResultType.Published);

                    if (content != null)
                    {
                        int distributionLanguageID = content.LanguageId;
                        DisplayCommunityCopyMode(content, distributionFolderID);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;
            case DistributionWizardEnumerations.Mode.CommunityRedistribute:
                if (ParseCommunityRedistributeParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_CONTENT_ID];

                    ContentData content = null;

                    try
                    {
                        content = contentAPI.GetContentById(
                            distributionContentID,
                            ContentAPI.ContentResultType.Published);
                    }
                    catch
                    {
                        // Exception likely occurred due to the user not being logged in.
                        // Unfortunately, ContentAPI.IsLoggedIn is not reliable enough (still
                        // returns true if user is user is logged out from a different client)
                        // to check in this case.
                    }

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        long distributionLanguageID = content.LanguageId;
                        DisplayCommunityRedistributeMode(content, content.FolderId);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;

            case DistributionWizardEnumerations.Mode.CommunityReplace:
                if (ParseCommunityReplaceParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_CONTENT_ID];

                    ContentData content = contentAPI.GetContentById(
                        distributionContentID,
                        ContentAPI.ContentResultType.Published);

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        long distributionLanguageID = content.LanguageId;
                        DisplayCommunityReplaceMode(content, content.FolderId);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
//.........这里部分代码省略.........
开发者ID:jaytem,项目名称:minGit,代码行数:101,代码来源:DistributionWizardMetaTax.aspx.cs


注:本文中的ContentAPI.GetContentById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。