Exemple #1
0
    private void ViewMetaData(ContentData data)
    {
        // Note: History for metadata-to-folder-assignment is not stored, and the
            // metadata array supplied to this function does not include anything useful
            // except for the TypeName property (string). We must compare this name to
            // all the names of the metadata currently assigned to the content-items
            // folder, showing only the matches and filtering out all of the rest:
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            int idx;
            Hashtable htValidMetadata;
            Collection cCustFieldCol;
            Collection cCustFieldItem;
            CustomFieldsApi custFlds;
            string sName;

            // folder
            try
            {
                // build a table of valid names:
                custFlds = new CustomFieldsApi();
                cCustFieldCol = custFlds.GetFieldsByFolder(data.FolderId, data.LanguageId);
                htValidMetadata = new Hashtable();
                foreach (Collection tempLoopVar_cCustFieldItem in cCustFieldCol)
                {
                    cCustFieldItem = tempLoopVar_cCustFieldItem;
                    htValidMetadata.Add(cCustFieldItem["CustomFieldName"], true);
                }

                // now display only those items that belong to the containing folder:
                result.Append("<table class=\"ektronForm\"><tbody>");

                if (!(data.MetaData == null))
                {
                    for (idx = 0; idx <= data.MetaData.Length - 1; idx++)
                    {
                        sName = (string) (data.MetaData[idx].TypeName);
                        if (htValidMetadata.ContainsKey(sName))
                        {
                            result.Append("<tr><td class=\"label\">" + sName + ":</td><td>&nbsp;&nbsp;");
                            result.Append(data.MetaData[idx].Text + "</td></tr>");
                        }
                    }
                }
                else
                {
                    result.Append("<tr><td>There is no metadata defined.</td><tr>");
                }
                result.Append("</tbody></table>");
                MetaDataValue.Text = result.ToString();

            }
            catch (Exception ex)
            {
                MetaDataValue.Text = ex.Message;

            }
            finally
            {
                result = null;
                custFlds = null;
                htValidMetadata = null;
                cCustFieldCol = null;
                cCustFieldItem = null;
            }
    }
    private void Display_ViewFolder()
    {
        Collection cPreApproval;
        bool isBlog;
        isBlog = System.Convert.ToBoolean(_FolderType == 1 ? true : false);
        if (isBlog)
        {
            _BlogData = _ContentApi.BlogObject(_FolderData);
            _FolderData.PublishPdfEnabled = false;
            phSubjects.Visible = true;
            phBlogRoll.Visible = true;
            phDescription.Visible = false;
        }

        _PermissionData = _ContentApi.LoadPermissions(_Id, "folder", 0);

        ltrTypes.Text = _MessageHelper.GetMessage("Smart Forms txt");
        //Sitemap Path
        ltInheritSitemapPath.Text = _MessageHelper.GetMessage("lbl Inherit Parent Configuration");

        ViewFolderToolBar();

        if (isBlog)
        {
            phBlogProperties1.Visible = true;
            if (_BlogData.Visibility == Ektron.Cms.Common.EkEnumeration.BlogVisibility.Public)
            {
                td_vf_visibilitytxt.InnerHtml = _MessageHelper.GetMessage("lbl public");
            }
            else
            {
                td_vf_visibilitytxt.InnerHtml = _MessageHelper.GetMessage("lbl private");
            }

            td_vf_nametxt.InnerHtml = _BlogData.Name;
            td_vf_titletxt.InnerHtml = _BlogData.Title;
        }
        else
        {
            phFolderProperties1.Visible = true;
            td_vf_foldertxt.InnerHtml = _FolderData.Name;
        }

        td_vf_idtxt.InnerHtml = _Id.ToString();

        if (isBlog)
        {
            phBlogProperties2.Visible = true;
            string sEnabled = "";
            string sModerate = "";
            string sRequire = "";
            string sNotify = "";
            if (_BlogData.EnableComments)
            {
                sEnabled = "checked=\"checked\" ";
            }
            if (_BlogData.ModerateComments)
            {
                sModerate = "checked=\"checked\" ";
            }
            if (_BlogData.RequiresAuthentication)
            {
                sRequire = "checked=\"checked\" ";
            }
            if (_BlogData.NotifyURL != "")
            {
                sNotify = "checked=\"checked\" ";
            }
            td_vf_taglinetxt.InnerHtml = _BlogData.Tagline;
            if (_BlogData.PostsVisible < 0)
            {
                td_vf_postsvisibletxt.InnerHtml = "(selected day)";
            }
            else
            {
                td_vf_postsvisibletxt.InnerHtml += _BlogData.PostsVisible.ToString();
            }
            td_vf_commentstxt.InnerHtml += "<input disabled=\"disabled\" type=\"checkbox\" name=\"enable_comments\" id=\"enable_comments\" " + sEnabled + " />" + _MessageHelper.GetMessage("lbl enable comments");
            td_vf_commentstxt.InnerHtml += "<br />";
            td_vf_commentstxt.InnerHtml += "<input disabled=\"disabled\" type=\"checkbox\" name=\"moderate_comments\" id=\"moderate_comments\" " + sModerate + " />" + _MessageHelper.GetMessage("lbl moderate comments");
            td_vf_commentstxt.InnerHtml += "<br />";
            td_vf_commentstxt.InnerHtml += "<input disabled=\"disabled\" type=\"checkbox\" name=\"require_authentication\" id=\"require_authentication\" " + sRequire + " />" + _MessageHelper.GetMessage("lbl require authentication");

            td_vf_updateservicestxt.InnerHtml += "<input type=\"checkbox\" name=\"notify_url\" id=\"notify_url\" " + sNotify + " disabled=\"disabled\" />" + _MessageHelper.GetMessage("lbl Notify blog");
            td_vf_updateservicestxt.InnerHtml += "<br />";
            td_vf_updateservicestxt.InnerHtml += _BlogData.NotifyURL;
        }
        else
        {
            td_vf_folderdesctxt.InnerHtml = _FolderData.Description;
        }

        if (_FolderData.StyleSheet == "")
        {
            td_vf_stylesheettxt.InnerHtml += _MessageHelper.GetMessage("none specified msg");
        }
        else
        {
            td_vf_stylesheettxt.InnerHtml += _SitePath + _FolderData.StyleSheet;
        }

        if (_FolderData.StyleSheetInherited)
        {
            td_vf_stylesheettxt.InnerHtml += "<div class=\"ektronCaption\">" + _MessageHelper.GetMessage("inherited style sheet msg") + "</div>";
        }
        DrawContentAliasesTable();
        IsContentSearchableSection();
        IsDisplaySettings();
        DrawContentTemplatesTable();
        DrawFolderTaxonomyTable(); //Assigned taxonomy
        long iTmpCaller = _ContentApi.RequestInformationRef.CallerId;
        try
        {
            _ContentApi.RequestInformationRef.CallerId = Ektron.Cms.Common.EkConstants.InternalAdmin;
            _ContentApi.RequestInformationRef.UserId = Ektron.Cms.Common.EkConstants.InternalAdmin;

            AssetConfigInfo[] asset_config = _ContentApi.GetAssetMgtConfigInfo();
            if (asset_config[10].Value.IndexOf("ektron.com") > -1)
            {
                ltrCheckPdfServiceProvider.Text = _MessageHelper.GetMessage("pdf service provider");
            }
            else
            {
                ltrCheckPdfServiceProvider.Text = "";
            }
        }
        catch (Exception ex)
        {
            string _error = ex.Message;
        }
        finally
        {
            _ContentApi.RequestInformationRef.CallerId = iTmpCaller;
            _ContentApi.RequestInformationRef.UserId = iTmpCaller;
        }

        if (_FolderData.PublishPdfEnabled && (Ektron.Cms.Common.EkEnumeration.FolderType)_FolderType != Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            if (_FolderData.PublishPdfActive)
            {
                td_vf_pdfactivetxt.InnerHtml += _MessageHelper.GetMessage("publish as pdf");
                ltrCheckPdfServiceProvider.Visible = true;
            }
            else
            {
                td_vf_pdfactivetxt.InnerHtml += _MessageHelper.GetMessage("lbl Publish native format");
                ltrCheckPdfServiceProvider.Visible = false;
            }
        }
        else
        {
            phPublishAsPdf.Visible = false;
        }

        // show domain info
        if (_FolderData.IsDomainFolder)
        {
            phProductionDomain.Visible = true;
            SettingsData settings_list;
            SiteAPI m_refSiteAPI = new SiteAPI();
            CommonApi m_refCommonAPI = new CommonApi();
            Ektron.Cms.Common.EkRequestInformation request_info;
            settings_list = m_refSiteAPI.GetSiteVariables(-1);
            request_info = m_refCommonAPI.RequestInformationRef;

            DomainFolder.Text += "<tr>";
            DomainFolder.Text += "<td class=\"label\">" + _MessageHelper.GetMessage("lbl Staging Domain") + ":</td>";
            DomainFolder.Text += "<td class=\"value\">http://" + _FolderData.DomainStaging + "</td>";
            DomainFolder.Text += "</tr>";
            DomainFolder.Text += "<tr>";
            DomainFolder.Text += "<td class=\"label\">" + _MessageHelper.GetMessage("lbl Production Domain") + ":</td>";
            DomainFolder.Text += "<td class=\"value\">http://" + _FolderData.DomainProduction + "</td>";
            DomainFolder.Text += "</tr>";

        }
        if (_FolderData.IsDomainFolder && _FolderData.ParentId == 0)
        {
            DrawFolderLocaleTaxonomyTable();
        }
        else
        {
            LocaleTaxonomy.Visible = false;
        }

        // show categories if its a blog
        if (isBlog)
        {
            if (!(_BlogData.Categories == null) && _BlogData.Categories.Length > 0)
            {
                for (this._i = 0; this._i <= _BlogData.Categories.Length - 1; this._i++)
                {
                    ltr_vf_categories.Text += _BlogData.Categories[this._i];
                    ltr_vf_categories.Text += "<br/>";
                }
            }
            else
            {
                ltr_vf_categories_lbl.Text = "No subjects";
            }

            if (!(_BlogData.BlogRoll == null) && _BlogData.BlogRoll.Length() > 0)
            {
                for (this._i = 0; this._i <= _BlogData.BlogRoll.Length() - 1; this._i++)
                {
                    Table tRoll = new Table();
                    tRoll.CssClass = "ektronGrid";
                    TableRow tRollRow = new TableRow();
                    TableCell tRollCell = new TableCell();
                    //Link Name
                    tRollCell = new TableCell();
                    tRollRow = new TableRow();
                    tRollCell.Text = "Link Name:";
                    tRollCell.CssClass = "label";
                    tRollRow.Controls.Add(tRollCell);
                    tRollCell = new TableCell();
                    tRollCell.Text = _BlogData.BlogRoll.RollItem(this._i).LinkName;
                    tRollCell.CssClass = "readOnlyValue";
                    tRollRow.Controls.Add(tRollCell);
                    tRoll.Controls.Add(tRollRow);
                    //URL
                    tRollCell = new TableCell();
                    tRollRow = new TableRow();
                    tRollCell.Text = "URL:";
                    tRollCell.CssClass = "label";
                    tRollRow.Controls.Add(tRollCell);
                    tRollCell = new TableCell();
                    tRollCell.Text = _BlogData.BlogRoll.RollItem(this._i).URL;
                    tRollCell.CssClass = "readOnlyValue";
                    tRollRow.Controls.Add(tRollCell);
                    tRoll.Controls.Add(tRollRow);
                    //Short Description
                    tRollCell = new TableCell();
                    tRollRow = new TableRow();
                    tRollCell.Text = "Short Description:";
                    tRollCell.CssClass = "label";
                    tRollRow.Controls.Add(tRollCell);
                    tRollCell = new TableCell();
                    tRollCell.Text = _BlogData.BlogRoll.RollItem(this._i).ShortDescription;
                    tRollCell.CssClass = "readOnlyValue";
                    tRollRow.Controls.Add(tRollCell);
                    tRoll.Controls.Add(tRollRow);
                    //Relationship
                    tRollCell = new TableCell();
                    tRollRow = new TableRow();
                    tRollCell.Text = "Relationship:";
                    tRollCell.CssClass = "label";
                    tRollRow.Controls.Add(tRollCell);
                    tRollCell = new TableCell();
                    tRollCell.Text = _BlogData.BlogRoll.RollItem(this._i).Relationship;
                    tRollCell.CssClass = "readOnlyValue";
                    tRollRow.Controls.Add(tRollCell);
                    tRoll.Controls.Add(tRollRow);
                    lbl_vf_roll.Controls.Add(tRoll);

                    Literal spacer = new Literal();
                    spacer.Text = "<div class=\'ektronTopSpace\'></div>";
                    lbl_vf_roll.Controls.Add(spacer);
                }
            }
        }

        if (_SettingsData.EnablePreApproval)
        {
            phPreapprovalGroup.Visible = true;
            cPreApproval = _ContentApi.EkContentRef.GetFolderPreapprovalGroup(_Id);
            if (-1 == Convert.ToInt32(cPreApproval["PreApprovalGroupID"]))
            {
                td_vf_preapprovaltxt.InnerHtml += cPreApproval["UserGroupName"] + " (Inherited)";
            }
            else if (0 == Convert.ToInt32(cPreApproval["PreApprovalGroupID"]))
            {
                td_vf_preapprovaltxt.InnerHtml += "(None)";
            }
            else
            {
                td_vf_preapprovaltxt.InnerHtml += cPreApproval["PreApprovalGroup"];
            }
        }

        // display replication settings for folder
        if (_ContentApi.RequestInformationRef.EnableReplication)
        {
            bool bShowReplicationMethod = true;
            if (_FolderData.ParentId != 0 && ((Ektron.Cms.Common.EkEnumeration.FolderType)_FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.Blog || (Ektron.Cms.Common.EkEnumeration.FolderType)_FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum))
            {
                FolderData tmp_folder_data = null;
                tmp_folder_data = this._ContentApi.EkContentRef.GetFolderById(_FolderData.ParentId);
                if ((Ektron.Cms.Common.EkEnumeration.FolderType)tmp_folder_data.FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.Community)
                {
                    bShowReplicationMethod = false;
                }
            }
            if (bShowReplicationMethod)
            {
                ReplicationMethod.Text = "<tr><td>&nbsp;</td></tr><tr><td class=\"label\">" + _MessageHelper.GetMessage("lbl folderdynreplication") + "</td></tr><tr><td>";
                if (_FolderData.ReplicationMethod == 1)
                {
                    ReplicationMethod.Text += _MessageHelper.GetMessage("replicate folder contents");
                }
                else
                {
                    ReplicationMethod.Text += _MessageHelper.GetMessage("generic No");
                }
                ReplicationMethod.Text += "	</td></tr>";
            }
        }

        // Show Custom-Field folder assignments:
        CustomFieldsApi customFieldsApi = new CustomFieldsApi();
        if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            customFieldsApi.ContentLanguage = _ContentApi.DefaultContentLanguage;
        }
        else
        {
            customFieldsApi.ContentLanguage = _ContentLanguage;
        }
        litMetadata.Text = customFieldsApi.GetEditableCustomFieldAssignments(_Id, false);
        customFieldsApi = null;
        DisplaySitemapPath();
        DisplaySubscriptionInfo();
        DrawContentTypesTable();
        if (_FolderType == 2) //OrElse m_intFolderId = 0 Avoiding root to be site aliased
        {
            phSiteAlias.Visible = true;
            DisplaySiteAlias();
        }
        Showpane();
    }
Exemple #3
0
 public CustomFieldsApiTests()
 {
     instance = new CustomFieldsApi();
 }
    private void Display_ViewCatalog()
    {
        Collection cPreApproval;

        _PermissionData = _ContentApi.LoadPermissions(_Id, "folder", 0);

        ltrTypes.Text = _MessageHelper.GetMessage("lbl product types");
        //Sitemap Path
        ltInheritSitemapPath.Text = _MessageHelper.GetMessage("lbl Inherit Parent Configuration");

        ViewCatalogToolBar();

        td_vf_foldertxt.InnerHtml = _FolderData.Name;
        td_vf_idtxt.InnerHtml = _Id.ToString();
        td_vf_folderdesctxt.InnerHtml = _FolderData.Description;

        if (_FolderData.StyleSheet == "")
        {
            td_vf_stylesheettxt.InnerHtml += _MessageHelper.GetMessage("none specified msg");
        }
        else
        {
            td_vf_stylesheettxt.InnerHtml += _SitePath + _FolderData.StyleSheet;
        }

        if (_FolderData.StyleSheetInherited)
        {
            td_vf_stylesheettxt.InnerHtml += " " + _MessageHelper.GetMessage("style sheet inherited");
        }

        DrawContentTemplatesTable();
        DrawFolderTaxonomyTable(); //Assigned taxonomy
        DrawContentAliasesTable();
        IsContentSearchableSection();
        IsDisplaySettings();
        if (_SettingsData.EnablePreApproval)
        {
            phPreapprovalGroup.Visible = true;
            cPreApproval = _ContentApi.EkContentRef.GetFolderPreapprovalGroup(_Id);
            if (-1 == Convert.ToInt32(cPreApproval["PreApprovalGroupID"]))
            {
                td_vf_preapprovaltxt.InnerHtml += cPreApproval["UserGroupName"] + " (Inherited)";
            }
            else if (0 == Convert.ToInt32(cPreApproval["PreApprovalGroupID"]))
            {
                td_vf_preapprovaltxt.InnerHtml += "(None)";
            }
            else
            {
                td_vf_preapprovaltxt.InnerHtml += cPreApproval["PreApprovalGroup"];
            }
        }

        // display replication settings for folder
        if (_ContentApi.RequestInformationRef.EnableReplication)
        {
            bool bShowReplicationMethod = true;
            if (_FolderData.ParentId != 0 && (Ektron.Cms.Common.EkEnumeration.FolderType)_FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.Blog || (Ektron.Cms.Common.EkEnumeration.FolderType)_FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum)
            {
                FolderData tmp_folder_data = null;
                tmp_folder_data = this._ContentApi.EkContentRef.GetFolderById(_FolderData.ParentId);
                if ((Ektron.Cms.Common.EkEnumeration.FolderType)tmp_folder_data.FolderType == Ektron.Cms.Common.EkEnumeration.FolderType.Community)
                {
                    bShowReplicationMethod = false;
                }
            }
            if (bShowReplicationMethod)
            {
                ReplicationMethod.Text = "<tr><td>&nbsp;</td></tr><tr><td class=\"label\">" + _MessageHelper.GetMessage("lbl folderdynreplication") + "</td></tr><tr><td>";
                if (_FolderData.ReplicationMethod == 1)
                {
                    ReplicationMethod.Text += _MessageHelper.GetMessage("replicate folder contents");
                }
                else
                {
                    ReplicationMethod.Text += _MessageHelper.GetMessage("generic No");
                }
                ReplicationMethod.Text += "	</td></tr>";
            }
        }

        // Show Custom-Field folder assignments:
        CustomFieldsApi customFieldsApi = new CustomFieldsApi();
        if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            customFieldsApi.ContentLanguage = _ContentApi.DefaultContentLanguage;
        }
        else
        {
            customFieldsApi.ContentLanguage = _ContentLanguage;
        }
        litMetadata.Text = customFieldsApi.GetEditableCustomFieldAssignments(_Id, false, Ektron.Cms.Common.EkEnumeration.FolderType.Catalog);
        LocaleTaxonomy.Visible = false;
        officedocumentspanel.Visible = false;
        customFieldsApi = null;
        DisplaySitemapPath();
        DisplaySubscriptionInfo();
        DrawProductTypesTable();
    }
Exemple #5
0
 public void Init()
 {
     instance = new CustomFieldsApi();
 }