コード例 #1
0
ファイル: viewcontent.ascx.cs プロジェクト: jaytem/minGit
    private void ViewToolBar()
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        string strAssetId = content_data.AssetData.Id;
        bool bIsAsset = false;
        Hashtable asset_info = new Hashtable();
        int i;
        bool folderIsHidden = m_refContentApi.IsFolderHidden(content_data.FolderId);

        bIsAsset = Utilities.IsAsset(content_data.Type, strAssetId);
        if (bIsAsset)
        {

            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                asset_info.Add(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i], "");
            }
            asset_info["AssetID"] = content_data.AssetData.Id; //(m_AssetInfoKeys(i))
            asset_info["AssetVersion"] = content_data.AssetData.Version;
            asset_info["AssetFilename"] = content_data.AssetData.FileName;
            asset_info["MimeType"] = content_data.AssetData.MimeType;
            asset_info["FileExtension"] = content_data.AssetData.FileExtension;
            asset_info["MimeName"] = content_data.AssetData.MimeName;
            asset_info["ImageUrl"] = content_data.AssetData.ImageUrl;

            //This code is used to pass the file name to the control to handle work-offline feature.
            if (content_data.AssetData.FileName.Trim() != "")
            {
                lblContentTitle.Text = content_data.AssetData.FileName;
            }
            else
            {
                lblContentTitle.Text = content_data.Title;
            }

            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                AssetHidden.Text += "<input type=\"hidden\" name=\"asset_" + Strings.LCase(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]) + "\" value=\"" + EkFunctions.HtmlEncode(asset_info[Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]].ToString()) + "\">";
            }
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "Tree/js/com.ektron.utils.string.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "Tree/js/com.ektron.utils.cookie.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\" src=\"" + m_refContentApi.AppPath + "java/assetevents.js\"></script>" + "\r\n";
            AssetHidden.Text += "<script language=\"JavaScript\">" + "\r\n";
            AssetHidden.Text += "setTimeout(\"SetTraceFormName()\",1);" + "\r\n";
            AssetHidden.Text += "function SetTraceFormName()" + "\r\n";
            AssetHidden.Text += "{" + "\r\n";
            AssetHidden.Text += "if (\"object\" == typeof g_AssetHandler)" + "\r\n";
            AssetHidden.Text += "{" + "\r\n";
            AssetHidden.Text += "g_AssetHandler.formName = \"frmContent\";" + "\r\n";
            AssetHidden.Text += "}" + "\r\n";
            AssetHidden.Text += "}" + "\r\n";
            AssetHidden.Text += "</script>";
        }

        if (m_strPageAction == "view" || m_strPageAction == "viewstaged")
        {
            string WorkareaTitlebarTitle = (string)(m_refMsg.GetMessage("view content title") + " \"" + content_data.Title + "\"");
            if (m_strPageAction == "viewstaged")
            {
                WorkareaTitlebarTitle = WorkareaTitlebarTitle + m_refMsg.GetMessage("staged version msg");
            }
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar(WorkareaTitlebarTitle);
        }

        result.Append("<table><tr>");

        if (!folderIsHidden)
        {
            if (Request.QueryString["callerpage"] == "dashboard.aspx")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:top.switchDesktopTab()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["callerpage"] != null)
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(AntiXss.UrlEncode(Request.QueryString["callerpage"]) + "?" + EkFunctions.HtmlEncode(Request.QueryString["origurl"]).Replace("&amp;", "&")), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["backpage"] == "history")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:history.back()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(EkFunctions.HtmlEncode("content.aspx?LangType=" + ContentLanguage + "&action=ViewContentByCategory&id=" + content_data.FolderId)), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
        }

        bool primaryCssClassApplied = false;

        if (security_data.CanEdit)
        {
            // Don't show edit button for Mac when using XML config:
            if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
            {
                if (content_data.Type == 3333)
                {
                    result.Append(m_refStyle.GetCatalogEditAnchor(m_intId, 3333, false, !primaryCssClassApplied));
                }
                else
                {
                    if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                    {
                        result.Append(m_refStyle.GetEditAnchor(m_intId, 1, false, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData, !primaryCssClassApplied)); // to be commented out
                    }
                    else
                    {
                        result.Append(m_refStyle.GetEditAnchor(m_intId, 1, false, EkEnumeration.CMSContentSubtype.Content, !primaryCssClassApplied)); // to be commented out
                    }

                    result.Append(m_refStyle.GetPageBuilderEditAnchor(m_intId, content_data, !primaryCssClassApplied));
                }

                primaryCssClassApplied = true;
            }
        }

        if (security_data.CanEdit)
        {
            if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || IsFolderAdmin())))
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/checkIn.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&content_type=" + content_data.Type), m_refMsg.GetMessage("alt checkin button text"), m_refMsg.GetMessage("btn checkin"), "", StyleHelper.CheckInButtonCssClass, !primaryCssClassApplied));

                primaryCssClassApplied = true;

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                }
            }
            else if (((content_data.Status == "I") || (content_data.Status == "T")) && (content_data.UserId == CurrentUserId))
            {
                if (security_data.CanPublish)
                {
                    bool metaRequuired = false;
                    bool categoryRequired = false;
                    bool manaliasRequired = false;
                    string msg = string.Empty;
                    m_refContentApi.EkContentRef.ValidateMetaDataTaxonomyAndAlias(content_data.FolderId, content_data.Id, content_data.LanguageId, ref metaRequuired, ref categoryRequired, ref manaliasRequired);
                    if (metaRequuired == false && categoryRequired == false && manaliasRequired == false)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentPublish.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt publish button text"), m_refMsg.GetMessage("btn publish"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"", StyleHelper.PublishButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        if (metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias and category required");
                        }
                        else if (metaRequuired && categoryRequired && !manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and category required");
                        }
                        else if (metaRequuired && !categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias required");
                        }
                        else if (!metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias and category required");
                        }
                        else if (metaRequuired)
                        {
                            msg = m_refMsg.GetMessage("validate meta required");
                        }
                        else if (manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias required");
                        }
                        else
                        {
                            msg = m_refMsg.GetMessage("validate category required");
                        }

                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentPublish.png", "#", m_refMsg.GetMessage("alt publish button text"), m_refMsg.GetMessage("btn publish"), "onclick=\"alert(\'" + msg + "\');\"", StyleHelper.PublishButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalSubmitFor.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt submit button text"), m_refMsg.GetMessage("btn submit"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"", StyleHelper.SubmitForApprovalButtonCssClass, !primaryCssClassApplied)); //TODO need to pass integer not boolean

                    primaryCssClassApplied = true;
                }

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                }
            }
            else if ((content_data.Status == "O") || (content_data.Status == "I") || (content_data.Status == "S") || (content_data.Status == "T") || (content_data.Status == "P"))
            {
                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass, !primaryCssClassApplied));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass, !primaryCssClassApplied));
                }

                primaryCssClassApplied = true;
            }
        }
        else
        {
            //NEW CODE IMPLEMENTATION ADDED BY UDAI On 06/16/05 FOR THE DEFECT#13694,13914
            //BEGIN
            if (content_data.Status == "S" || content_data.Status == "M")
            {
                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                string aPublishTagClass;

                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "../UI/Icons/contentPublish.png";
                    CaptionKey = "btn publish";
                    aPublishTagClass = StyleHelper.PublishButtonCssClass;
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "../UI/Icons/delete.png";
                    CaptionKey = "btn delete";
                    aPublishTagClass = StyleHelper.DeleteButtonCssClass;
                }

                if (security_data.CanPublish && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + PublishIcon, "#", AltPublishMsg, m_refMsg.GetMessage(CaptionKey), "Onclick=\"javascript:return LoadChildPage(\'action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", aPublishTagClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + PublishIcon, "content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "", AltPublishMsg, m_refMsg.GetMessage(CaptionKey), "", aPublishTagClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }
                else if (security_data.CanApprove && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalApproveItem.png", "#", AltApproveMsg, m_refMsg.GetMessage("btn approve"), "Onclick=\"javascript:return LoadChildPage(\'action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", StyleHelper.ApproveButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalApproveItem.png", "content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "", AltApproveMsg, m_refMsg.GetMessage("btn approve"), "", StyleHelper.ApproveButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }

                if ((security_data.CanPublish || security_data.CanApprove) && content_state_data.CurrentUserId == CurrentUserId)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "btn_decline-nm.gif", "#", AltDeclineMsg, m_refMsg.GetMessage("btn decline"), "Onclick=\"javascript:return LoadChildPage(\'action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\');\"", StyleHelper.DeclineButtonCssClass, !primaryCssClassApplied));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "btn_decline-nm.gif", "javascript:DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')", AltDeclineMsg, m_refMsg.GetMessage("btn decline"), "", StyleHelper.DeclineButtonCssClass, !primaryCssClassApplied));
                    }

                    primaryCssClassApplied = true;
                }

                if (security_data.CanEditSumit)
                {
                    // Don't show edit button for Mac when using XML config:
                    if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
                    {
                        if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                        {
                            result.Append(m_refStyle.GetEditAnchor(m_intId, 1, true, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData, !primaryCssClassApplied));
                        }
                        else
                        {
                            result.Append(m_refStyle.GetEditAnchor(m_intId, 1, true, content_data.SubType, !primaryCssClassApplied));
                        }

                        primaryCssClassApplied = true;

                        result.Append(m_refStyle.GetPageBuilderEditAnchor(m_intId, content_data));
                    }
                }

                if (m_strPageAction == "view")
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass, !primaryCssClassApplied));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass, !primaryCssClassApplied));
                }
                //End If
                //END
            }
            else
            {
                if ((content_data.Status == "O") && ((security_data.IsAdmin || IsFolderAdmin()) || (security_data.CanBreakPending)))
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/checkIn.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea" + "&content_type=" + content_data.Type), m_refMsg.GetMessage("alt checkin button text"), m_refMsg.GetMessage("btn checkin"), "onclick=\"DisplayHoldMsg(true);return true;\"", StyleHelper.CheckInButtonCssClass, true));

                    if (m_strPageAction == "view")
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/preview.png", (string)("content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage), m_refMsg.GetMessage("alt view staged button text"), m_refMsg.GetMessage("btn view stage"), "", StyleHelper.ViewStagedButtonCssClass));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewPublished.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId), m_refMsg.GetMessage("alt view published button text"), m_refMsg.GetMessage("btn view publish"), "", StyleHelper.ViewPublishedButtonCssClass));
                    }
                }
            }
        }

        if (security_data.CanHistory)
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/history.png", "#", m_refMsg.GetMessage("alt history button text"), m_refMsg.GetMessage("lbl generic history"), "onclick=\"top.document.getElementById(\'ek_main\').src=\'historyarea.aspx?action=report&LangType=" + ContentLanguage + "&id=" + m_intId + "\';return false;\"", StyleHelper.HistoryButtonCssClass));
        }

        if (security_data.CanDelete)
        {
            string href;
            href = (string)("content.aspx?LangType=" + ContentLanguage + "&action=submitDelContAction&delete_id=" + m_intId + "&page=" + Request.QueryString["calledfrom"] + "&folder_id=" + content_data.FolderId);
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/delete.png", "#", m_refMsg.GetMessage("alt delete button text"), m_refMsg.GetMessage("btn delete"), "onclick=\"DeleteConfirmationDialog(\'" + href + "\');return false;\" ", StyleHelper.DeleteButtonCssClass));
        }

        result.Append(StyleHelper.ActionBarDivider);

        if (content_data.Status != "A")
        {
            if (!((Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= content_data.Type) && (content_data.Type <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)))
            {
                if (content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/contentViewDifferences.png", "#", "View Difference", m_refMsg.GetMessage("btn view diff"), "onclick=\"PopEditWindow(\'compare.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\', \'Compare\', 785, 650, 1, 1);\"", StyleHelper.ViewDifferenceButtonCssClass));
                }
            }
        }

        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/permissions.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewPermissions&type=content&id=" + m_intId), m_refMsg.GetMessage("alt permissions button text content (view)"), m_refMsg.GetMessage("btn view permissions"), "", StyleHelper.ViewPermissionsButtonCssClass));
            if (!folderIsHidden)
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvals.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewApprovals&type=content&id=" + m_intId), m_refMsg.GetMessage("alt approvals button text content (view)"), m_refMsg.GetMessage("btn view approvals"), "", StyleHelper.ViewApprovalsButtonCssClass));
            }
        }
        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/linkSearch.png", (string)("isearch.aspx?LangType=" + ContentLanguage + "&action=dofindcontent&folderid=0&content_id=" + m_intId + ((content_data.AssetData.MimeType.IndexOf("image") != -1) ? "&asset_name=" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension : "")), m_refMsg.GetMessage("btn link search"), m_refMsg.GetMessage("btn link search"), "", StyleHelper.SearchButtonCssClass));

        result.Append(StyleHelper.ActionBarDivider);

        if (security_data.CanAddTask)
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/taskAdd.png", (string)("tasks.aspx?LangType=" + ContentLanguage + "&action=AddTask&cid=" + m_intId + "&callbackpage=content.aspx&parm1=action&value1=" + m_strPageAction + "&parm2=id&value2=" + m_intId + "&parm3=LangType&value3=" + ContentLanguage), m_refMsg.GetMessage("btn add task"), m_refMsg.GetMessage("btn add task"), "", StyleHelper.AddTaskButtonCssClass));
        }

        result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/chartBar.png", (string)("ContentStatistics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId), m_refMsg.GetMessage("click view content reports"), m_refMsg.GetMessage("click view content reports"), "", StyleHelper.ViewReportButtonCssClass));
        string quicklinkUrl = SitePath + content_data.Quicklink;
        if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))
        {
            quicklinkUrl = m_refContentApi.RequestInformationRef.AssetPath + content_data.Quicklink;
        }
        else if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && SitePath != "/")
        {
            string appPathOnly = m_refContentApi.RequestInformationRef.ApplicationPath.Replace(SitePath, "");
            if (content_data.Quicklink.Contains(appPathOnly) || !content_data.Quicklink.Contains("downloadasset.aspx"))
            {
                quicklinkUrl = SitePath + ((content_data.Quicklink.StartsWith("/")) ? (content_data.Quicklink.Substring(1)) : content_data.Quicklink);
            }
            else
            {
                quicklinkUrl = m_refContentApi.RequestInformationRef.ApplicationPath + content_data.Quicklink;
            }
        }
        if (IsAnalyticsViewer() && ObjectFactory.GetAnalytics().HasProviders())
        {
            string modalUrl = string.Format("onclick=\"window.open(\'{0}/analytics/seo.aspx?tab=traffic&uri={1}\', \'Analytics400\', \'width=900,height=580,scrollable=1,resizable=1\');return false;\"", ApplicationPath, quicklinkUrl);
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/chartPie.png", "#", m_refMsg.GetMessage("lbl entry analytics"), m_refMsg.GetMessage("lbl entry analytics"), modalUrl, StyleHelper.ViewAnalyticsButtonCssClass));
        }

        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/properties.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=EditContentProperties&id=" + m_intId), m_refMsg.GetMessage("btn edit prop"), m_refMsg.GetMessage("btn edit prop"), "", StyleHelper.EditPropertiesButtonCssClass));
        }

        //Sync API needs to know folder type to display the eligible sync profiles.
        if (this.folder_data == null)
        {
            folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
        }

        SiteAPI site = new SiteAPI();
        EkSite ekSiteRef = site.EkSiteRef;
        if ((m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncAdmin) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncUser)) && (LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Feature.eSync)) && m_refContentApi.RequestInformationRef.IsSyncEnabled)
        {
            if ((m_strPageAction == "view") && (content_data.Status.ToUpper() == "A") && ServerInformation.IsStaged())
            {
                if (content_data.SubType != EkEnumeration.CMSContentSubtype.WebEvent)
                {
                    if (folder_data.IsDomainFolder)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "sync_now_data.png", "#", m_refMsg.GetMessage("alt sync content"), m_refMsg.GetMessage("btn sync content"), "OnClick=\"Ektron.Workarea.Sync.Relationships.ShowSyncConfigurations(" + ContentLanguage + "," + m_intId + ",\'" + content_data.AssetData.Id + "\',\'" + content_data.AssetData.Version + "\'," + content_data.FolderId + ",true);return false;\"", StyleHelper.SyncButtonCssClass));
                    }
                    else
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppImgPath + "sync_now_data.png", "#", m_refMsg.GetMessage("alt sync content"), m_refMsg.GetMessage("btn sync content"), "OnClick=\"Ektron.Workarea.Sync.Relationships.ShowSyncConfigurations(" + ContentLanguage + "," + m_intId + ",\'" + content_data.AssetData.Id + "\',\'" + content_data.AssetData.Version + "\'," + content_data.FolderId + ",false);return false;\"", StyleHelper.SyncButtonCssClass));
                    }
                }
            }
        }

        if (EnableMultilingual == 1)
        {
            string strViewDisplay = "";
            string strAddDisplay = "";
            LanguageData[] result_language;
            int count = 0;

            if (security_data.CanEdit || security_data.CanEditSumit)
            {
                LocalizationObject l10nObj = new LocalizationObject();
                int sourceLanguageId;
                DateTime sourceDateModified;
                Ektron.Cms.Localization.LocalizationState locState = l10nObj.GetContentLocalizationState(m_intId, content_data, out sourceLanguageId, out sourceDateModified);
                if (-1 == sourceLanguageId) sourceLanguageId = ContentLanguage;

                bool addedTranslationDivider = false;

                if (m_refStyle.IsExportTranslationSupportedForContentType((EkEnumeration.CMSContentType)content_data.Type))
                {
                    var statusMenu = m_refStyle.GetTranslationStatusMenu(content_data, m_refMsg.GetMessage("alt click here to update this content translation status"), m_refMsg.GetMessage("lbl mark translation status"), locState);

                    if (!String.IsNullOrEmpty(statusMenu))
                    {
                        if (!addedTranslationDivider)
                        {
                            result.Append(StyleHelper.ActionBarDivider);
                            addedTranslationDivider = true;
                        }

                        result.Append(statusMenu);
                    }

                    var statusPopUpMenu = m_refStyle.PopupTranslationMenu(content_data, locState);

                    if (!String.IsNullOrEmpty(statusMenu))
                    {
                        if (!addedTranslationDivider)
                        {
                            result.Append(StyleHelper.ActionBarDivider);
                            addedTranslationDivider = true;
                        }

                        result.Append(statusPopUpMenu);
                    }

                    if (locState.IsExportableState())
                    {
                        var exportButton = m_refStyle.GetExportTranslationButton((string)("content.aspx?LangType=" + sourceLanguageId + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId), m_refMsg.GetMessage("alt Click here to export this content for translation"), m_refMsg.GetMessage("lbl Export for translation"));

                        if (!String.IsNullOrEmpty(exportButton))
                        {
                            if (!addedTranslationDivider)
                            {
                                result.Append(StyleHelper.ActionBarDivider);
                                addedTranslationDivider = true;
                            }

                            result.Append(exportButton);
                        }
                    }
                }
                if (System.Configuration.ConfigurationSettings.AppSettings["ek_ContentFallback"] != null && Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["ek_ContentFallback"]))
                {
                    if (!addedTranslationDivider)
                    {
                        result.Append(StyleHelper.ActionBarDivider);
                        addedTranslationDivider = true;
                    }

                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/listBullet.png", "localization/contentfallback.aspx?id=" + m_intId + "&folder_id=" + content_data.FolderId, m_refMsg.GetMessage("alt edit content fallback"), m_refMsg.GetMessage("alt edit content fallback"), "", StyleHelper.EditFallbackButtonCssClass));
                }
            }

            result_language = m_refContentApi.DisplayAddViewLanguage(m_intId);
            for (count = 0; count <= result_language.Length - 1; count++)
            {
                if (result_language[count].Type == "VIEW")
                {
                    if (content_data.LanguageId == result_language[count].Id)
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + " selected>" + result_language[count].Name + "</option>";
                    }
                    else
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
            }
            if (strViewDisplay != "")
            {
                result.Append(StyleHelper.ActionBarDivider);
                result.Append("<td class=\"label\">" + m_refMsg.GetMessage("view language") + "</td>");
                result.Append("<td>");
                result.Append("<select id=viewcontent name=viewcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'VIEW\');\">");
                result.Append(strViewDisplay);
                result.Append("</select>");
                result.Append("</td>");
            }
            if (security_data.CanAdd)
            {
                //If (bCanAddNewLanguage) Then
                for (count = 0; count <= result_language.Length - 1; count++)
                {
                    if (result_language[count].Type == "ADD")
                    {
                        strAddDisplay = strAddDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
                if (strAddDisplay != "")
                {
                    result.Append("<td>&nbsp;&nbsp;</td>");
                    result.Append("<td class=\"label\">" + m_refMsg.GetMessage("add title") + ":</td>");
                    result.Append("<td>");
                    if (folder_data == null)
                    {
                        folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
                    }
                    if (Utilities.IsNonFormattedContentAllowed(m_refContentApi.GetEnabledXmlConfigsByFolder(this.folder_data.Id)))
                    {
                        allowHtml = "&AllowHtml=1";
                    }
                    result.Append("<select id=addcontent name=addcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'ADD\');\">");
                    result.Append("<option value=" + "0" + ">" + "-select language-" + "</option>");
                    result.Append(strAddDisplay);
                    result.Append("</select></td>");
                }
                //End If
            }
        }

        result.Append(StyleHelper.ActionBarDivider);
        result.Append("<td>");
        if (m_strPageAction == "view")
        {
            result.Append(m_refStyle.GetHelpButton("Viewcontent", ""));
        }
        else if (m_strPageAction == "viewstaged")
        {
            result.Append(m_refStyle.GetHelpButton("Viewstaged", ""));
        }
        result.Append("</td>");
        result.Append("</tr>");
        result.Append("</table>");
        htmToolBar.InnerHtml = result.ToString();
    }
コード例 #2
0
ファイル: viewcontent.ascx.cs プロジェクト: jaytem/minGit
    private void ViewCatalogToolBar()
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        if (content_data == null)
        {
            content_data = m_refContentApi.GetContentById(m_intId, 0);
        }
        long ParentId = content_data.FolderId;
        Ektron.Cms.Commerce.ProductType pProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef);
        int count = 0;
        int lAddMultiType = 0;
        bool bSelectedFound = false;
        bool bViewContent = System.Convert.ToBoolean("view" == m_strPageAction); // alternative is archived content
        string SRC = "";
        string str;
        string backStr;
        bool bFromApproval = false;
        int type = 3333;
        bool folderIsHidden = m_refContentApi.IsFolderHidden(content_data.FolderId);
        bool IsOrdered = m_refContentApi.EkContentRef.IsOrdered(content_data.Id);

        if (type == 1)
        {
            if (bFromApproval)
            {
                backStr = "back_file=approval.aspx";
            }
            else
            {
                backStr = "back_file=content.aspx";
            }
        }
        else
        {
            backStr = "back_file=cmsform.aspx";
        }
        str = Request.QueryString["action"];
        if (str != null && str.Length > 0)
        {
            backStr = backStr + "&back_action=" + str;
        }

        if (bFromApproval)
        {
            str = Request.QueryString["page"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_page=" + str;
            }
        }

        if (!bFromApproval)
        {
            str = Request.QueryString["folder_id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_folder_id=" + str;
            }
        }

        if (type == 1)
        {
            str = Request.QueryString["id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_id=" + str;
            }
        }
        else
        {
            str = Request.QueryString["form_id"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_form_id=" + str;
            }
        }
        if (!(Request.QueryString["callerpage"] == null))
        {
            str = AntiXss.UrlEncode(Request.QueryString["callerpage"]);
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_callerpage=" + str;
            }
        }
        if (!(Request.QueryString["origurl"] == null))
        {
            str = Request.QueryString["origurl"];
            if (str != null && str.Length > 0)
            {
                backStr = backStr + "&back_origurl=" + EkFunctions.UrlEncode(str);
            }
        }
        str = ContentLanguage.ToString();
        if (str != null && str.Length > 0)
        {
            backStr = backStr + "&back_LangType=" + str + "&rnd=" + System.Convert.ToInt32(Conversion.Int((10 * VBMath.Rnd()) + 1));
        }

        SRC = (string)("commerce/catalogentry.aspx?close=false&LangType=" + ContentLanguage + "&id=" + m_intId + "&type=update&" + backStr);
        if (bFromApproval)
        {
            SRC += "&pullapproval=true";
        }

        if (m_strPageAction == "view" || m_strPageAction == "viewstaged")
        {
            string WorkareaTitlebarTitle = (string)(m_refMsg.GetMessage("lbl view catalog entry") + " \"" + content_data.Title + "\" ");
            if (m_strPageAction == "viewstaged")
            {
                WorkareaTitlebarTitle = WorkareaTitlebarTitle + m_refMsg.GetMessage("staged version msg");
            }
            txtTitleBar.InnerHtml = m_refStyle.GetTitleBar(WorkareaTitlebarTitle);
        }

        result.Append("<table><tr>" + "\r\n");
        if ((security_data.CanAdd && bViewContent) || security_data.IsReadOnly == true)
        {

            if (security_data.CanAdd && bViewContent)
            {
                if (!bSelectedFound)
                {
                    lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes;
                }
            }
        }

        SetViewImage("");

        if (!folderIsHidden && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //hiding the move button for pagebuilder type.
        {
            if (Request.QueryString["callerpage"] == "dashboard.aspx")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:top.switchDesktopTab()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (!String.IsNullOrEmpty(Request.QueryString["callerpage"]))
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)(Request.QueryString["callerpage"] + "?" + HttpUtility.UrlDecode(Request.QueryString["origurl"])), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else if (Request.QueryString["backpage"] == "history")
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", "javascript:history.back()", m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
            else
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/back.png", (string)("content.aspx?LangType=" + ContentLanguage + "&action=ViewContentByCategory&id=" + content_data.FolderId), m_refMsg.GetMessage("alt back button text"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));
            }
        }

        string buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"action\">" + m_refMsg.GetMessage("lbl Action") + "</span></td>");

        if ((security_data.CanAdd) || security_data.IsReadOnly)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"folderView\">" + m_refMsg.GetMessage("lbl View") + "</span></td>");
        }

        buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"chartBar\">" + m_refMsg.GetMessage("generic reports title") + "</span></td>");

        StringBuilder localizationMenuOptions = new StringBuilder();
        if (EnableMultilingual == 1)
        {
            string strViewDisplay = "";
            string strAddDisplay = "";
            LanguageData[] result_language;

            if (security_data.CanEdit || security_data.CanEditSumit)
            {
                LocalizationObject l10nObj = new LocalizationObject();
                Ektron.Cms.Localization.LocalizationState locState = l10nObj.GetContentLocalizationState(m_intId, content_data);
                if (m_refStyle.IsExportTranslationSupportedForContentType((EkEnumeration.CMSContentType)content_data.Type))
                {
                    string statusIcon = "";
                    string statusMsg = "";
                    m_refStyle.GetTranslationStatusIconAndMessage(locState, ref statusIcon, ref statusMsg);
                    // localizationMenuOptions.Append("    {0}.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + statusIcon + " \' />&nbsp;&nbsp;" + statusMsg + "\", function() { return false; } );" + Environment.NewLine);
                    // result.Append(m_refStyle.GetTranslationStatusMenu(content_data, m_refMsg.GetMessage("alt click here to update this content translation status"), m_refMsg.GetMessage("lbl mark ready for translation"), locState));
                    localizationMenuOptions.Append(m_refStyle.PopupTranslationMenu(content_data, locState, "actionmenu", statusMsg, statusIcon, false));
                    // result.Append(m_refStyle.PopupTranslationMenu(content_data, locState));

                    if (locState.IsExportableState())
                    {
                        localizationMenuOptions.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + m_refContentApi.AppPath + "images/UI/Icons/translation.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl Export for translation") + "\", function() { window.location.href=\"" + "content.aspx?LangType=" + ContentLanguage + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId + "\"; } );" + Environment.NewLine);
                        // result.Append(m_refStyle.GetExportTranslationButton((string)("content.aspx?LangType=" + ContentLanguage + "&action=Localize&backpage=View&id=" + m_intId + "&folder_id=" + content_data.FolderId), m_refMsg.GetMessage("alt Click here to export this content for translation"), m_refMsg.GetMessage("lbl Export for translation")));
                    }
                }
            }

            result_language = m_refContentApi.DisplayAddViewLanguage(m_intId);
            for (count = 0; count <= result_language.Length - 1; count++)
            {
                if (result_language[count].Type == "VIEW")
                {
                    if (content_data.LanguageId == result_language[count].Id)
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + " selected>" + result_language[count].Name + "</option>";
                    }
                    else
                    {
                        strViewDisplay = strViewDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
            }

            bool languageDividerAdded = false;

            if (strViewDisplay != "")
            {
                result.Append(StyleHelper.ActionBarDivider);
                languageDividerAdded = true;
                result.Append("<td nowrap=\"true\">" + m_refMsg.GetMessage("lbl View") + ":");
                result.Append("<select id=viewcontent name=viewcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'VIEW\');\">");
                result.Append(strViewDisplay);
                result.Append("</select></td>");
            }
            if (security_data.CanAdd)
            {
                //If (bCanAddNewLanguage) Then
                for (count = 0; count <= result_language.Length - 1; count++)
                {
                    if (result_language[count].Type == "ADD")
                    {
                        strAddDisplay = strAddDisplay + "<option value=" + result_language[count].Id + ">" + result_language[count].Name + "</option>";
                    }
                }
                if (strAddDisplay != "")
                {
                    if (!languageDividerAdded)
                    {
                        result.Append(StyleHelper.ActionBarDivider);
                    }
                    else
                    {
                        result.Append("<td>&nbsp;&nbsp;</td>");
                    }
                    result.Append("<td class=\"label\">" + m_refMsg.GetMessage("add title") + ":");
                    if (folder_data == null)
                    {
                        folder_data = m_refContentApi.GetFolderById(content_data.FolderId);
                    }
                    if (Utilities.IsNonFormattedContentAllowed(m_refContentApi.GetEnabledXmlConfigsByFolder(this.folder_data.Id)))
                    {
                        allowHtml = "&AllowHtml=1";
                    }
                    result.Append("<select id=addcontent name=addcontent OnChange=\"javascript:LoadContent(\'frmContent\',\'ADD\');\">");
                    result.Append("<option value=" + "0" + ">" + "-select language-" + "</option>");
                    result.Append(strAddDisplay);
                    result.Append("</select></td>");
                }
                //End If
            }

            //End If
        }

        bool canAddAssets = System.Convert.ToBoolean((security_data.CanAdd || security_data.CanAddFolders) && bViewContent);

        result.Append(StyleHelper.ActionBarDivider);
        result.Append("<td>");
        result.Append(m_refStyle.GetHelpButton(m_strPageAction, ""));
        result.Append("</td>");
        result.Append("</tr></table>");

        result.Append("<script language=\"javascript\">" + Environment.NewLine);

        result.Append("    var filemenu = new Menu( \"file\" );" + Environment.NewLine);
        if (security_data.CanAddFolders)
        {
            result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/folderGreen.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl commerce catalog") + "\", function() { window.location.href = \'content.aspx?LangType=" + ContentLanguage + "&action=AddSubFolder&type=catalog&id=" + m_intId + "\' } );" + Environment.NewLine);
            result.Append("    filemenu.addBreak();" + Environment.NewLine);
        }

        if (security_data.IsCollections || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AminCollectionMenu) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminCollection))
        {
            result.Append("" + Environment.NewLine);
        }
        result.Append("    var viewmenu = new Menu( \"view\" );" + Environment.NewLine);
        if (security_data.CanHistory)
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/history.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl content history"), 98) + "\", function() { top.document.getElementById(\'ek_main\').src=\"historyarea.aspx?action=report&LangType=" + ContentLanguage + "&id=" + m_intId + "\";return false;});" + Environment.NewLine);
        }
        if (content_data.Status != "A")
        {
            if (!((Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= content_data.Type) && (content_data.Type <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)))
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/contentViewDifferences.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view diff"), 98) + "\", function() { PopEditWindow(\'compare.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\', \'Compare\', 785, 500, 1, 1); } );" + Environment.NewLine);
            }
        }
        if (security_data.IsAdmin || IsFolderAdmin())
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/approvals.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view approvals"), 98) + "\", function() { location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewApprovals&type=content&id=" + m_intId + "\";} );" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/permissions.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn view permissions"), 98) + "\", function() { location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewPermissions&type=content&id=" + m_intId + "\";} );" + Environment.NewLine);
        }
        result.Append("    viewmenu.addBreak();" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/brickLeftRight.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl cross sell"), 98) + "\", function() { location.href = \"commerce/recommendations/recommendations.aspx?action=crosssell&folder=" + m_intFolderId + "&id=" + m_intId + "\";} );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'center\' src=\'" + "images/ui/icons/brickUp.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("lbl up sell"), Ektron.Cms.Common.EkConstants.CMSContentType_Content) + "\", function() { location.href = \"commerce/recommendations/recommendations.aspx?action=upsell&folder=" + m_intFolderId + "&id=" + m_intId + "\";} );" + Environment.NewLine);
        if ((security_data.CanEditFolders && bViewContent) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))
        {
            result.Append("    viewmenu.addBreak();" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/properties.png" + "\' />&nbsp;&nbsp;" + MakeBold(m_refMsg.GetMessage("btn properties"), Ektron.Cms.Common.EkConstants.CMSContentType_Content) + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=EditContentProperties&id=" + m_intId + "\";} );" + Environment.NewLine);
        }

        if (((security_data.CanAdd) && bViewContent) || security_data.IsReadOnly == true)
        {
            if (!(asset_data == null))
            {
                if (asset_data.Length > 0)
                {
                    for (count = 0; count <= asset_data.Length - 1; count++)
                    {
                        if (Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= asset_data[count].TypeId && asset_data[count].TypeId <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max)
                        {
                            if ("*" == asset_data[count].PluginType)
                            {
                                lAddMultiType = asset_data[count].TypeId;
                            }
                            else
                            {
                                string imgsrc = string.Empty;
                                string txtCommName = string.Empty;
                                if (asset_data[count].TypeId == 101)
                                {
                                    imgsrc = "&nbsp;<img src=\'" + "images/UI/Icons/FileTypes/word.png" + "\' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Office Documents");
                                }
                                else if (asset_data[count].TypeId == 102 || asset_data[count].TypeId == 106)
                                {
                                    imgsrc = "&nbsp;<img valign=\'center\' src=\'" + "images/UI/Icons/contentHtml.png" + " \' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Managed Files");
                                }
                                else if (asset_data[count].TypeId == 104)
                                {
                                    imgsrc = "&nbsp;<img valign=\'center\' src=\'" + "images/UI/Icons/film.png" + " \' />&nbsp;&nbsp;";
                                    txtCommName = m_refMsg.GetMessage("lbl Multimedia");
                                }
                                else
                                {
                                    imgsrc = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                }
                                if (asset_data[count].TypeId != 105)
                                {
                                    result.Append("viewmenu.addItem(\"" + imgsrc + "" + MakeBold(txtCommName, System.Convert.ToInt32(asset_data[count].TypeId)) + "\", function() { UpdateView(" + asset_data[count].TypeId + "); } );" + Environment.NewLine);
                                }
                            }
                        }
                    }
                }
            }

            result.Append("    MenuUtil.add( viewmenu );" + Environment.NewLine);

            result.Append("    var deletemenu = new Menu( \"delete\" );" + Environment.NewLine);
            result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/UI/Icons/chartBar.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("content stats") + "\", function() { location.href = \"ContentStatistics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\";} );" + Environment.NewLine);
            result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/chartPie.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl entry reports") + "\", function() { location.href = \"Commerce/reporting/analytics.aspx?LangType=" + ContentLanguage + "&id=" + m_intId + "\";} );" + Environment.NewLine);
            string quicklinkUrl = SitePath + content_data.Quicklink;
            if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))
            {
                quicklinkUrl = m_refContentApi.RequestInformationRef.AssetPath + content_data.Quicklink;
            }
            else if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, true) && SitePath != "/")
            {
                string appPathOnly = m_refContentApi.RequestInformationRef.ApplicationPath.Replace(SitePath, "");
                if (content_data.Quicklink.Contains(appPathOnly) || !content_data.Quicklink.Contains("downloadasset.aspx"))
                {
                    quicklinkUrl = SitePath + ((content_data.Quicklink.StartsWith("/")) ? (content_data.Quicklink.Substring(1)) : content_data.Quicklink);
                }
                else
                {
                    quicklinkUrl = m_refContentApi.RequestInformationRef.ApplicationPath + content_data.Quicklink;
                }
            }
            if (IsAnalyticsViewer() && ObjectFactory.GetAnalytics().HasProviders())
            {
                string modalUrl = string.Format("window.open(\"{0}/analytics/seo.aspx?tab=traffic&uri={1}\", \"Analytics400\", \"width=900,height=580,scrollable=1,resizable=1\");", ApplicationPath, quicklinkUrl);
                result.Append("    deletemenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' valign=\'center\' src=\'" + "images/ui/icons/chartBar.png" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl entry analytics") + "\", function() { " + modalUrl + " } );" + Environment.NewLine);
            }
            result.Append("    MenuUtil.add( deletemenu );" + Environment.NewLine);
        }

        result.Append("    var actionmenu = new Menu( \"action\" );" + Environment.NewLine);
        if (security_data.CanEdit && (content_data.Status != "S" && content_data.Status != "O" || (content_data.Status == "O" && content_state_data.CurrentUserId == CurrentUserId)))
        {
            result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentEdit.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn edit") + "\", function() { javascript:top.document.getElementById(\'ek_main\').src=\'" + SRC + "\';return false;\"" + ",\'EDIT\',790,580,1,1);return false;" + "\" ; } );" + Environment.NewLine);
        }

        if (security_data.CanDelete)
        {
            string href;
            href = (string)("content.aspx?LangType=" + ContentLanguage + "&action=submitDelCatalogAction&delete_id=" + m_intId + "&page=" + Request.QueryString["calledfrom"] + "&folder_id=" + content_data.FolderId);
            if (!IsOrdered)
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/delete.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn delete") + ("\", function() { DeleteConfirmationDialog(\'" + href) + "\');return false;} );" + Environment.NewLine);
            }
        }

        if (security_data.CanEdit)
        {

            if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || IsFolderAdmin())))
            {
                if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))))
                {

                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/checkIn.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn checkin") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&content_type=" + content_data.Type + "\" ; } );" + Environment.NewLine);

                }
                else if (IsFolderAdmin())
                {

                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/lockEdit.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("lbl take ownership") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=TakeOwnerShip&id=" + m_intId + "&content_type=" + content_data.Type + "\" ; } );" + Environment.NewLine);

                }

                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
            }
            else if (((content_data.Status == "I") || (content_data.Status == "T")) && (content_data.UserId == CurrentUserId))
            {
                if (security_data.CanPublish)
                {
                    bool metaRequuired = false;
                    bool categoryRequired = false;
                    bool manaliasRequired = false;
                    string msg = string.Empty;
                    m_refContentApi.EkContentRef.ValidateMetaDataTaxonomyAndAlias(content_data.FolderId, content_data.Id, content_data.LanguageId, ref metaRequuired, ref categoryRequired, ref manaliasRequired);
                    if (metaRequuired == false && categoryRequired == false && manaliasRequired == false)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/application/commerce/submit.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn publish") + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "\" ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        if (metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias and category required");
                        }
                        else if (metaRequuired && categoryRequired && !manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and category required");
                        }
                        else if (metaRequuired && !categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate meta and manualalias required");
                        }
                        else if (!metaRequuired && categoryRequired && manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias and category required");
                        }
                        else if (metaRequuired)
                        {
                            msg = m_refMsg.GetMessage("validate meta required");
                        }
                        else if (manaliasRequired)
                        {
                            msg = m_refMsg.GetMessage("validate manualalias required");
                        }
                        else
                        {
                            msg = m_refMsg.GetMessage("validate category required");
                        }
                        result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\' src=\'" + "images/application/commerce/submit.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn publish") + "\", function() { DisplayHoldMsg(true); window.location.href = \"alert(\'" + msg + "\')\"" + "; } );" + Environment.NewLine);
                    }
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(m_refContentApi.AppPath + "images/UI/Icons/approvalSubmitFor.png", "content.aspx?LangType=" + ContentLanguage + "&action=Submit&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea", m_refMsg.GetMessage("alt submit button text"), m_refMsg.GetMessage("btn submit"), "onclick=\"DisplayHoldMsg(true);return CheckForMeta(" + Convert.ToInt32(security_data.CanMetadataComplete) + ");\"")); //TODO need to pass integer not boolean
                }
                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
            }
            else if ((content_data.Status == "O") || (content_data.Status == "I") || (content_data.Status == "S") || (content_data.Status == "T") || (content_data.Status == "P"))
            {

                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + content_data.FolderId + "\" ; } );" + Environment.NewLine);
                }
            }

            if (content_data.Status == "S" || content_data.Status == "M")
            {

                Util_CheckIsCurrentApprover(CurrentUserId);

                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "commerce/submit.gif";
                    CaptionKey = "btn publish";
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "../UI/Icons/delete.png";
                    CaptionKey = "btn delete";
                }
                if (security_data.CanPublish && IsLastApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } } );" + Environment.NewLine);
                    }
                }
                else if (security_data.CanApprove && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } );" + Environment.NewLine);
                    }
                }
                if ((security_data.CanPublish || security_data.CanApprove) && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { window.location.href = (\'content.aspx?action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + "\' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')" + " ; } );" + Environment.NewLine);
                    }
                }
            }
        }
        else
        {
            if (content_data.Status == "S" || content_data.Status == "M")
            {
                Util_CheckIsCurrentApprover(CurrentUserId);

                ApprovalScript.Visible = true;
                string AltPublishMsg = "";
                string AltApproveMsg = "";
                string AltDeclineMsg = "";
                string PublishIcon = "";
                string CaptionKey = "";
                bool m_TaskExists = m_refContent.DoesTaskExistForContent(content_data.Id);
                string m_sPage = "workarea"; //To be remove not required.
                if (content_data.Status == "S")
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (change)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (change)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (change)");
                    PublishIcon = "commerce/submit.gif";
                    CaptionKey = "btn publish";
                }
                else
                {
                    AltPublishMsg = m_refMsg.GetMessage("approvals:Alt Publish Msg (delete)");
                    AltApproveMsg = m_refMsg.GetMessage("approvals:Alt Approve Msg (delete)");
                    AltDeclineMsg = m_refMsg.GetMessage("approvals:Alt Decline Msg (delete)");
                    PublishIcon = "commerce/ApproveDelete.png";
                    CaptionKey = "approvals:lbl publish msg (delete)";
                }
                if (security_data.CanPublish && IsLastApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/" + PublishIcon + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage(CaptionKey) + "\", function() { if(CheckTitle()) { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } } );" + Environment.NewLine);
                    }
                }
                else if (security_data.CanApprove && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = (\'content.aspx?action=approveContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/Commerce/Approve.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn approve") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?action=approvecontent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + ContentLanguage + "" + "\" ; } );" + Environment.NewLine);
                    }
                }
                if ((security_data.CanPublish || security_data.CanApprove) && IsCurrentApproval)
                {
                    if (m_TaskExists == true)
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { window.location.href = (\'content.aspx?action=declineContent&id=" + content_data.Id + "&fldid=" + content_data.FolderId + "&page=" + m_sPage + "&LangType=" + content_data.LanguageId + "\') ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/application/DMSMenu/page_white_decline.gif" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn decline") + "\", function() { DeclineContent(\'" + content_data.Id + "\', \'" + content_data.FolderId + "\', \'" + m_sPage + "\', \'" + ContentLanguage + "\')" + " ; } );" + Environment.NewLine);
                    }
                }
                if (security_data.CanEditSumit)
                {
                    // Don't show edit button for Mac when using XML config:
                    if (!(m_bIsMac && (content_data.XmlConfiguration != null)) || m_SelectedEditControl == "ContentDesigner")
                    {
                        // result.Append(m_refStyle.GetEditAnchor(m_intId, , True))
                    }
                }
                if (m_strPageAction == "view")
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
                }
                else
                {
                    result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                }
                //End If
                //END
            }
            else
            {
                if ((content_data.Status == "O") && ((security_data.IsAdmin || IsFolderAdmin()) || (security_data.CanBreakPending)))
                {
                    if ((content_data.Status == "O") && ((content_state_data.CurrentUserId == CurrentUserId) || (security_data.IsAdmin || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin))))
                    {

                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/ui/icons/checkIn.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn checkin") + "\", function() { DisplayHoldMsg(true); window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=CheckIn&id=" + m_intId + "&fldid=" + content_data.FolderId + "&page=workarea" + "&content_type=" + content_data.Type + "\" ; \"DisplayHoldMsg(true);return true;\"" + " } );" + Environment.NewLine);

                    }

                    if (m_strPageAction == "view")
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img  height=\'16px\' width=\'16px\'  src=\'" + "images/UI/Icons/preview.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view stage") + "\", function() { window.location.href = \"content.aspx?action=ViewStaged&id=" + m_intId + "&LangType=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/contentViewPublished.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn view publish") + "\", function() { window.location.href = \"content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "\" ; } );" + Environment.NewLine);
                    }
                }
            }
        }
        result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/linkSearch.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn link search") + "\", function() { window.location.href = \"isearch.aspx?LangType=" + ContentLanguage + "&action=dofindcontent&folderid=0&content_id=" + m_intId + ((content_data.AssetData.MimeType.IndexOf("image") != -1) ? "&asset_name=" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension : "") + "\" ; } );" + Environment.NewLine);
        if (security_data.CanAddTask)
        {
            result.Append("    actionmenu.addItem(\"&nbsp;<img height=\'16px\' width=\'16px\' src=\'" + "images/UI/Icons/taskAdd.png" + " \' />&nbsp;&nbsp;" + m_refMsg.GetMessage("btn add task") + "\", function() { window.location.href = \"tasks.aspx?LangType=" + ContentLanguage + "&action=AddTask&cid=" + m_intId + "&callbackpage=content.aspx&parm1=action&value1=" + m_strPageAction + "&parm2=id&value2=" + m_intId + "&parm3=LangType&value3=" + ContentLanguage + "\" ; } );" + Environment.NewLine);
        }
        if (localizationMenuOptions.Length > 0)
        {
            result.Append("    actionmenu.addBreak();" + Environment.NewLine);
            result.Append(localizationMenuOptions);
        }
        result.Append("    MenuUtil.add( actionmenu );" + Environment.NewLine);
        result.Append("    </script>" + Environment.NewLine);
        result.Append("" + Environment.NewLine);
        htmToolBar.InnerHtml = result.ToString();
    }