Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AssertInternalReferrer();
        //<data name="id" xml:space="preserve">
        //    <value>text</value>
        //</data>

        string strResourceName = Request.QueryString.Get("name");
        if (strResourceName != null)
        {
            string strResourceKey = Request.QueryString.Get("id");
            string strResourcesPath = Server.MapPath("Resources/");
            string xsltFile = Server.MapPath("resxdata.xslt");
            string strLang = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
            string xmlFile = strResourcesPath + strResourceName + "." + strLang + ".resx";
            if (!System.IO.File.Exists(xmlFile))
            {
                strLang = System.Threading.Thread.CurrentThread.CurrentUICulture.Parent.Name;
                xmlFile = strResourcesPath + strResourceName + "." + strLang + ".resx";
                if (!System.IO.File.Exists(xmlFile))
                {
                    xmlFile = strResourcesPath + strResourceName + ".resx";
                }
            }
            Ektron.Cms.Xslt.ArgumentList args = null;
            if (!String.IsNullOrEmpty(strResourceKey))
            {
                args = new Ektron.Cms.Xslt.ArgumentList();
                args.AddParam("resourceKey", "", strResourceKey);
            }
            _api = new Ektron.Cms.CommonApi();
            string strXml = Ektron.Cms.EkXml.XSLTransform(xmlFile, xsltFile, true, true, args, true, null, _api.RequestInformationRef.ApplicationPath, false);
            litOutput.Text = strXml;
        }
    }
Пример #2
0
 private void Page_Load(System.Object sender, System.EventArgs e)
 {
     Ektron.Cms.Xslt.ArgumentList args = new Ektron.Cms.Xslt.ArgumentList();
     AssertInternalReferrer();
     CmsDataList.Visible = false;
     CmsDataListXml.Text = Ektron.Cms.EkXml.XSLTransform(CmsDataList.EkItem.Html, Server.MapPath("cmsdatalist.xslt"), true, false, args, true, null);
 }
Пример #3
0
        private void BindComboBox()
        {
            // Need fully qualified URL so XSLT can get dynamic (i.e., .aspx) localeUrl
            string xmlPath = new Uri(Request.Url, DataListSpecXml).AbsoluteUri;
            string xsltPath = new Uri(Request.Url, "../../ContentDesigner/DataListSpecToDataListCombo.xslt").AbsoluteUri;

            Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList();
            objXsltArgs.AddParam("LangType", "", _api.UserLanguage);
            string comboItems = Ektron.Cms.EkXml.XSLTransform(xmlPath, xsltPath, true, true, objXsltArgs, false, null, _api.RequestInformationRef.ApplicationPath, false);

            cboList.LoadXmlString(comboItems);
        }
Пример #4
0
    private void Display_ViewContent()
    {
        m_refMsg = m_refContentApi.EkMsgRef;
        bool bCanAlias = false;
        PermissionData security_task_data;
        StringBuilder sSummaryText;
        Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliasname = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
        Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
        Ektron.Cms.Common.UrlAliasManualData d_alias;
        System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData>();
        Ektron.Cms.UrlAliasing.UrlAliasSettingsApi m_urlAliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi();
        int i;
        bool IsStagingServer;

        IsStagingServer = m_refContentApi.RequestInformationRef.IsStaging;

        security_task_data = m_refContentApi.LoadPermissions(m_intId, "tasks", ContentAPI.PermissionResultType.Task);
        security_data = m_refContentApi.LoadPermissions(m_intId, "content", ContentAPI.PermissionResultType.All);
        security_data.CanAddTask = security_task_data.CanAddTask;
        security_data.CanDestructTask = security_task_data.CanDestructTask;
        security_data.CanRedirectTask = security_task_data.CanRedirectTask;
        security_data.CanDeleteTask = security_task_data.CanDeleteTask;

        active_subscription_list = m_refContentApi.GetAllActiveSubscriptions();

        if ("viewstaged" == m_strPageAction)
        {
            ContentStateData objContentState;
            objContentState = m_refContentApi.GetContentState(m_intId);
            if ("A" == objContentState.Status)
            {
                // Can't view staged
                m_strPageAction = "view";
            }
        }
        try
        {
            if (m_strPageAction == "view")
            {
                content_data = m_refContentApi.GetContentById(m_intId, 0);
            }
            else if (m_strPageAction == "viewstaged")
            {
                content_data = m_refContentApi.GetContentById(m_intId, ContentAPI.ContentResultType.Staged);
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message), true);
            return;
        }

        if ((content_data != null) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64 (content_data.Type), Convert.ToBoolean (-1))))
        {
            ContentPaneHeight = "700px";
        }
        //ekrw = m_refContentApi.EkUrlRewriteRef()
        //ekrw.Load()
        if (((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) && (content_data != null) && (content_data.AssetData != null) && !(Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension))))
        {
            bCanAlias = true;
        }

        blog_post_data = new BlogPostData();
        blog_post_data.Categories = (string[])Array.CreateInstance(typeof(string), 0);
        if (content_data.MetaData != null)
        {
            for (i = 0; i <= (content_data.MetaData.Length - 1); i++)
            {
                if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog categories")
                {
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&#39;", "\'");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&quot", "\"");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&gt;", ">");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&lt;", "<");
                    blog_post_data.Categories = Strings.Split((string)(content_data.MetaData[i].Text), ";", -1, 0);
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog pingback")
                {
                    if (!(content_data.MetaData[i].Text.Trim().ToLower() == "no"))
                    {
                        m_bIsBlog = true;
                    }
                    blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(content_data.MetaData[i].Text));
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog tags")
                {
                    blog_post_data.Tags = (string)(content_data.MetaData[i].Text);
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog trackback")
                {
                    blog_post_data.TrackBackURL = (string)(content_data.MetaData[i].Text);
                }
            }
        }

        //THE FOLLOWING LINES ADDED DUE TO TASK
        //:BEGIN / PROPOSED BY PAT
        //TODO: Need to recheck this part of the code e.r.
        if (content_data == null)
        {
            if (ContentLanguage != 0)
            {
                if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]))
                {
                    Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Strings.Replace(Request.ServerVariables["Query_String"], (string)("LangType=" + ContentLanguage), (string)("LangType=" + m_refContentApi.DefaultContentLanguage), 1, -1, 0)), false);
                    return;
                }
            }
            else
            {
                if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]))
                {
                    Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Request.ServerVariables["Query_String"] + "&LangType=" + m_refContentApi.DefaultContentLanguage), false);
                    return;
                }
            }
        }
        //:END
        if (m_intFolderId == -1)
        {
            m_intFolderId = content_data.FolderId;
        }
        HoldMomentMsg.Text = m_refMsg.GetMessage("one moment msg");

        if ((active_subscription_list == null) || (active_subscription_list.Length == 0))
        {
            phWebAlerts.Visible = false;
            phWebAlerts2.Visible = false;
        }
        content_state_data = m_refContentApi.GetContentState(m_intId);

        jsFolderId.Text = m_intFolderId.ToString ();
        jsIsForm.Text = content_data.Type.ToString ();
        jsBackStr.Text = "back_file=content.aspx";
        if (m_strPageAction.Length > 0)
        {
            jsBackStr.Text += "&back_action=" + m_strPageAction;
        }
        if (Convert.ToString(m_intFolderId).Length > 0)
        {
            jsBackStr.Text += "&back_folder_id=" + m_intFolderId;
        }
        if (Convert.ToString(m_intId).Length > 0)
        {
            jsBackStr.Text += "&back_id=" + m_intId;
        }
        if (Convert.ToString((short)ContentLanguage).Length > 0)
        {
            jsBackStr.Text += "&back_LangType=" + ContentLanguage;
        }
        jsToolId.Text = m_intId.ToString ();
        jsToolAction.Text = m_strPageAction;
        jsLangId.Text = m_refContentApi.ContentLanguage.ToString ();
        if (content_data.Type == 3333)
        {
            ViewCatalogToolBar();
        }
        else
        {
            ViewToolBar();
        }

        if (bCanAlias && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And folder_data.FolderType <> 1 Don't Show alias tab for Blogs.
        {
            string m_strAliasPageName = "";

            d_alias = m_aliasname.GetDefaultAlias(content_data.Id);
            if (d_alias.QueryString != "")
            {
                m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension + d_alias.QueryString; //content_data.ManualAlias
            }
            else
            {
                m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension; //content_data.ManualAlias
            }

            if (m_strAliasPageName != "")
            {

                if (IsStagingServer && folder_data.DomainStaging != string.Empty)
                {
                    m_strAliasPageName = (string)("http://" + folder_data.DomainStaging + "/" + m_strAliasPageName);
                }
                else if (folder_data.IsDomainFolder)
                {
                    m_strAliasPageName = (string)("http://" + folder_data.DomainProduction + "/" + m_strAliasPageName);
                }
                else
                {
                    m_strAliasPageName = SitePath + m_strAliasPageName;
                }
                m_strAliasPageName = "<a href=\"" + m_strAliasPageName + "\" target=\"_blank\" >" + m_strAliasPageName + "</a>";
            }
            else
            {
                m_strAliasPageName = " [Not Defined]";
            }
            tdAliasPageName.InnerHtml = m_strAliasPageName;
        }
        else
        {
            phAliases.Visible = false;
            phAliases2.Visible = false;
        }
        auto_aliaslist = m_autoaliasApi.GetListForContent(content_data.Id);
        autoAliasList.InnerHtml = "<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>";
        autoAliasList.InnerHtml += "<div class=\"ektronBorder\">";
        autoAliasList.InnerHtml += "<table width=\"100%\">";
        autoAliasList.InnerHtml += "<tr class=\"title-header\">";
        autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("generic type") + "</th>";
        autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("lbl alias name") + "</th>";
        autoAliasList.InnerHtml += "</tr>";
        for (i = 0; i <= auto_aliaslist.Count() - 1; i++)
        {
            autoAliasList.InnerHtml += "<tr class=\"row\">";
            if (auto_aliaslist[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Folder)
            {
                autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/folder.png\"  alt=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\"/ ></td>";
            }
            else
            {
                autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/taxonomy.png\"  alt=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\"/ ></td>";
            }

            if (IsStagingServer && folder_data.DomainStaging != string.Empty)
            {
                autoAliasList.InnerHtml = autoAliasList.InnerHtml + "<td> <a href = \"http://" + folder_data.DomainStaging + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td></tr>";
            }
            else if (folder_data.IsDomainFolder)
            {
                autoAliasList.InnerHtml += "<td> <a href = \"http://" + folder_data.DomainProduction + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>";
            }
            else
            {
                autoAliasList.InnerHtml += "<td> <a href = \"" + SitePath + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>";
            }
            autoAliasList.InnerHtml += "</tr>";
        }
        autoAliasList.InnerHtml += "</table>";
        autoAliasList.InnerHtml += "</div>";
        if (content_data == null)
        {
            content_data = m_refContentApi.GetContentById(m_intId, 0);
        }
        if (content_data.Type == 3333)
        {
            m_refCatalog = new CatalogEntry(m_refContentApi.RequestInformationRef);
            m_refCurrency = new Currency(m_refContentApi.RequestInformationRef);
            //m_refMedia = MediaData()
            entry_edit_data = m_refCatalog.GetItemEdit(m_intId, ContentLanguage, false);

            Ektron.Cms.Commerce.ProductType m_refProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef);
            prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true);

            if (prod_type_data.Attributes.Count == 0)
            {
                phAttributes.Visible = false;
                phAttributes2.Visible = false;
            }

            Display_PropertiesTab(content_data);
            Display_PricingTab();
            Display_ItemTab();
            Display_MetadataTab();
            Display_MediaTab();
        }
        else
        {
            ViewContentProperties(content_data);
            phCommerce.Visible = false;
            phCommerce2.Visible = false;
            phItems.Visible = false;
        }

        bool bPackageDisplayXSLT = false;
        string CurrentXslt = "";
        int XsltPntr;

        if ((!(content_data.XmlConfiguration == null)) && (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Content || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Forms))
        {
            if (!(content_data.XmlConfiguration == null))
            {
                if (content_data.XmlConfiguration.DefaultXslt.Length > 0)
                {
                    if (content_data.XmlConfiguration.DefaultXslt == "0")
                    {
                        bPackageDisplayXSLT = true;
                    }
                    else
                    {
                        bPackageDisplayXSLT = false;
                    }
                    if (!bPackageDisplayXSLT)
                    {
                        XsltPntr = int.Parse(content_data.XmlConfiguration.DefaultXslt);
                        if (XsltPntr > 0)
                        {
                            Collection tmpXsltColl = (Collection)content_data.XmlConfiguration.PhysPathComplete;
                            if (tmpXsltColl["Xslt" + XsltPntr] != null)
                            {
                                CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]);
                            }
                            else
                            {
                                tmpXsltColl = (Collection)content_data.XmlConfiguration.LogicalPathComplete;
                                CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]);
                            }
                        }
                    }
                }
                else
                {
                    bPackageDisplayXSLT = true;
                }
                //End If

                Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList();
                objXsltArgs.AddParam("mode", string.Empty, "preview");
                if (bPackageDisplayXSLT)
                {
                    divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, content_data.XmlConfiguration.PackageDisplayXslt, false, false, objXsltArgs, true, true);
                }
                else
                {
                    // CurrentXslt is always obtained from the object in the database.
                    divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, CurrentXslt, true, false, objXsltArgs, true, true);
                }
            }
            else
            {
                divContentHtml.InnerHtml = content_data.Html;
            }
        }
        else
        {
            if (content_data.Type == 104)
            {
                media_html.Value = content_data.MediaText;
                //Get Url from content
                string tPath = m_refContentApi.RequestInformationRef.AssetPath + m_refContentApi.EkContentRef.GetFolderParentFolderIdRecursive(content_data.FolderId).Replace(",", "/") + "/" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension;
                string mediaHTML = FixPath(content_data.Html, tPath);
                int scriptStartPtr = 0;
                int scriptEndPtr = 0;
                int len = 0;
                //Registering the javascript & CSS
                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "linkReg", "<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", false);
                mediaHTML = mediaHTML.Replace("<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", "");
                while (1 == 1)
                {
                    scriptStartPtr = mediaHTML.IndexOf("<script", scriptStartPtr);
                    scriptEndPtr = mediaHTML.IndexOf("</script>", scriptEndPtr);
                    if (scriptStartPtr == -1 || scriptEndPtr == -1)
                    {
                        break;
                    }
                    len = scriptEndPtr - scriptStartPtr + 9;
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), (string)("scriptreg" + scriptEndPtr), mediaHTML.Substring(scriptStartPtr, len), false);
                    mediaHTML = mediaHTML.Replace(mediaHTML.Substring(scriptStartPtr, len), "");
                    scriptStartPtr = 0;
                    scriptEndPtr = 0;
                }
                media_display_html.Value = mediaHTML;
                divContentHtml.InnerHtml = "<a href=\"#\" onclick=\"document.getElementById(\'" + divContentHtml.ClientID + "\').innerHTML = document.getElementById(\'" + media_display_html.ClientID + "\').value;return false;\" alt=\"" + m_refMsg.GetMessage("alt show media content") + "\" title=\"" + m_refMsg.GetMessage("alt show media content") + "\">" + m_refMsg.GetMessage("lbl show media content") + "<br/><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/filmstrip_ph.jpg\" /></a>";
            }
            else
            {
                if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, Convert .ToBoolean (-1)))
                {
                    string ver = "";
                    ver = (string)("&version=" + content_data.AssetData.Version);
                    if (IsImage(content_data.AssetData.Version))
                    {
                        divContentHtml.InnerHtml = "<img src=\"" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\" />";
                    }
                    else
                    {
                        divContentHtml.InnerHtml = "<div align=\"center\" style=\"padding:15px;\"><a style=\"text-decoration:none;\" href=\"#\" onclick=\"javascript:window.open(\'" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\',\'DownloadAsset\',\'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=1000,height=800\');return false;\"><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/application/download.gif\" />" + m_refMsg.GetMessage("btn download") + " &quot;" + content_data.Title + "&quot;</a></div>";
                    }

                }
                else if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                {
                    Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon();
                    FolderData fd = this.m_refContentApi.GetFolderById(content_data.FolderId);
                    string stralias = u.GetAliasForContent(content_data.Id);
                    if (stralias == string.Empty || fd.IsDomainFolder)
                    {
                        stralias = content_data.Quicklink;
                    }

                    string link = "";
                    if (content_data.ContType == (int)EkEnumeration.CMSContentType.Content || (content_data.ContType == (int)EkEnumeration.CMSContentType.Archive_Content && content_data.EndDateAction != 1))
                    {
                        string url = this.m_refContent.RequestInformation.SitePath + stralias;
                        if (url.Contains("?"))
                        {
                            url += "&";
                        }
                        else
                        {
                            url += "?";
                        }
                        if ("viewstaged" == m_strPageAction)
                        {
                            url += "view=staged";
                        }
                        else
                        {
                            url += "view=published";
                        }
                        url += (string)("&LangType=" + content_data.LanguageId.ToString());
                        link = "<a href=\"" + url + "\" onclick=\"window.open(this.href);return false;\">Click here to view the page</a><br/><br/>";
                    }
                    divContentHtml.InnerHtml = link + Ektron.Cms.PageBuilder.PageData.RendertoString(content_data.Html);
                }
                else
                {
                    if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type)
                    {
                        divContentHtml.InnerHtml = content_data.Html.Replace("[srcpath]", m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath);
                        divContentHtml.InnerHtml = divContentHtml.InnerHtml.Replace("[skinpath]", m_refContentApi.ApplicationPath + "csslib/ContentDesigner/");
                    }
                    else
                    {
                        divContentHtml.InnerHtml = content_data.Html;
                    }
                    if (m_bIsBlog)
                    {
                        Collection blogData = m_refContentApi.EkContentRef.GetBlogData(content_data.FolderId);
                        if (blogData != null)
                        {
                            if (blogData["enablecomments"].ToString() != string.Empty)
                            {
                                litBlogComment.Text = "<div class=\"ektronTopSpace\"></div><a class=\"button buttonInline greenHover buttonNoIcon\" href=\"" + m_refContentApi.AppPath + "content.aspx?id=" + content_data.FolderId + "&action=ViewContentByCategory&LangType=" + content_data.LanguageId + "&ContType=" + Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments + "&contentid=" + content_data.Id + "&viewin=" + content_data.LanguageId + "\" title=\"" + m_refMsg.GetMessage("alt view comments label") + "\">" + m_refMsg.GetMessage("view comments") + "</a>";
                                litBlogComment.Visible = true;
                            }
                        }
                    }
                }
            }
        }

        sSummaryText = new StringBuilder();
        if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type)
        {
            if (content_data.Teaser != null)
            {
                if (content_data.Teaser.IndexOf("<ektdesignpackage_design") > -1)
                {
                    string strDesign;
                    strDesign = m_refContentApi.XSLTransform(null, null, true, false, null, true);
                    tdsummarytext.InnerHtml = strDesign;
                }
                else
                {
                    tdsummarytext.InnerHtml = content_data.Teaser;
                }
            }
            else
            {
                tdsummarytext.InnerHtml = "";
            }
        }
        else
        {
            if (m_bIsBlog)
            {
                sSummaryText.AppendLine("<table class=\"ektronGrid\">");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td valign=\"top\" class=\"label\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("generic description") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td valign=\"top\">");
            }
            sSummaryText.AppendLine(content_data.Teaser);
            if (m_bIsBlog)
            {
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td valign=\"top\" class=\"label\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("lbl blog cat") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td>");
                if (!(blog_post_data.Categories == null))
                {
                    arrBlogPostCategories = blog_post_data.Categories;
                    if (arrBlogPostCategories.Length > 0)
                    {
                        Array.Sort(arrBlogPostCategories);
                    }
                }
                else
                {
                    arrBlogPostCategories = null;
                }
                if (blog_post_data.Categories.Length > 0)
                {
                    for (i = 0; i <= (blog_post_data.Categories.Length - 1); i++)
                    {
                        if (blog_post_data.Categories[i].ToString() != "")
                        {
                            sSummaryText.AppendLine("				<input type=\"checkbox\" name=\"blogcategories" + i.ToString() + "\" value=\"" + blog_post_data.Categories[i].ToString() + "\" checked=\"true\" disabled>&nbsp;" + Strings.Replace((string)(blog_post_data.Categories[i].ToString()), "~@~@~", ";", 1, -1, 0) + "<br />");
                        }
                    }
                }
                else
                {
                    sSummaryText.AppendLine("No categories defined.");
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td class=\"label\" valign=\"top\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("lbl personal tags") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td>");
                if (!(blog_post_data == null))
                {
                    sSummaryText.AppendLine(blog_post_data.Tags);
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("	    <td class=\"label\">");
                if (!(blog_post_data == null))
                {
                    sSummaryText.AppendLine("   <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"" + blog_post_data.TrackBackURLID.ToString() + "\" />");
                    sSummaryText.AppendLine("   <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + "");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("		<td>");
                    sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"" + EkFunctions.HtmlEncode(blog_post_data.TrackBackURL) + "\" disabled/>");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("	</tr>");
                    sSummaryText.AppendLine("	<tr>");
                    sSummaryText.AppendLine("		<td class=\"label\">");
                    if (blog_post_data.Pingback == true)
                    {
                        sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                        sSummaryText.AppendLine("		</td>");
                        sSummaryText.AppendLine("		<td>");
                        sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" checked disabled/>");

                    }
                    else
                    {
                        sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                        sSummaryText.AppendLine("		</td>");
                        sSummaryText.AppendLine("		<td>");
                        sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>");
                    }
                }
                else
                {
                    sSummaryText.AppendLine("           <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"\" />");
                    sSummaryText.AppendLine("           <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + "");
                    sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"\" disabled/>");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("	</tr>");
                    sSummaryText.AppendLine("	<tr>");
                    sSummaryText.AppendLine("		<td class=\"label\">" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("		<td>");
                    sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>");
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("</table>");
            }
            tdsummarytext.InnerHtml = sSummaryText.ToString();
        }

        ViewMetaData(content_data);

        tdcommenttext.InnerHtml = content_data.Comment;
        AddTaskTypeDropDown();
        ViewTasks();
        ViewSubscriptions();
        Ektron.Cms.Content.EkContent cref;
        cref = m_refContentApi.EkContentRef;
        TaxonomyBaseData[] dat;
        dat = cref.GetAllFolderTaxonomy(folder_data.Id);
        if (dat == null || dat.Length == 0)
        {
            phCategories.Visible = false;
            phCategories2.Visible = false;
        }
        ViewAssignedTaxonomy();
        if ((content_data != null) && ((content_data.Type >= EkConstants.ManagedAsset_Min && content_data.Type <= EkConstants.ManagedAsset_Max && content_data.Type != 104) || (content_data.Type >= EkConstants.Archive_ManagedAsset_Min && content_data.Type <= EkConstants.Archive_ManagedAsset_Max && content_data.Type != 1104) || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData))
        {
            showAlert = false;
        }
        if (
            (Request.QueryString["menuItemType"] != null && Request.QueryString["menuItemType"].ToLower() == "viewproperties")
            ||
            (Request.QueryString["tab"] != null && Request.QueryString["tab"].ToLower() == "properties")
            )
        {
            DefaultTab.Value = "dvProperties";
            Util_ReloadTree(content_data.Path, content_data.FolderId);
        }
    }
Пример #5
0
        private void LoadComboBox(RadComboBox combo, string validationName, string xsltPath)
        {
            string xmlPath = new Uri(Request.Url, ValidateSpecXml).AbsoluteUri;
            Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList();
            objXsltArgs.AddParam("validationName", "", validationName);
            objXsltArgs.AddParam("LangType", "", _api.UserLanguage);
            string comboItems = Ektron.Cms.EkXml.XSLTransform(xmlPath, xsltPath, true, true, objXsltArgs, true, null, _api.RequestInformationRef.ApplicationPath, false);

            combo.Items.Clear();
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(comboItems);
            System.Xml.XmlElement root = doc.DocumentElement;
            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                String text = root.ChildNodes[i].Attributes.GetNamedItem("Text").Value;
                String data = root.ChildNodes[i].Attributes.GetNamedItem("Value").Value;
                if ("" == data) data = "{\"\"}";
                combo.Items.Add(new RadComboBoxItem(text, data));
            }
        }
Пример #6
0
    /// <summary>
    /// Builds the region section
    /// </summary>
    /// <param name="cldrMainXmlPath">The file path to the main CLDR file</param>
    private void BuildRegionSection(string cldrMainXmlPath)
    {
        const string RegionFilenameFormat = "{0}.gif";
        string xsltPath = new Uri(Request.Url, "territoryList.xsl").AbsoluteUri;
        Ektron.Cms.Xslt.ArgumentList args = new Ektron.Cms.Xslt.ArgumentList();
        args.AddParam("controlId", string.Empty, RegionSelector.ClientID);
        args.AddParam("subset", string.Empty, RegionSet.Text);
        args.AddParam("selectedLanguage", string.Empty, this.selectedLanguage);
        if (!String.IsNullOrEmpty(this.selectedLanguageTag.ScriptSubtag))
        {
            args.AddParam("selectedScript", string.Empty, this.selectedLanguageTag.ScriptSubtag);
        }

        if (!String.IsNullOrEmpty(this.selectedLanguageTag.RegionSubtag))
        {
            args.AddParam("selectedTerritory", string.Empty, this.selectedLanguageTag.RegionSubtag);
        }

        args.AddParam("lang", string.Empty, this.userLang);
        RegionSelector.Text = ContentApi.XSLTransform(cldrMainXmlPath, xsltPath, true, true, args, false);

        if (!String.IsNullOrEmpty(this.selectedLanguageTag.RegionSubtag))
        {
            string mapArea = this.GetRegionValue(this.selectedLanguageTag.RegionSubtag, "chtm");
            bool isMultinationalRegion = !String.IsNullOrEmpty(mapArea);
            CountryMap.Visible = isMultinationalRegion;
            LocatorMap.Visible = !isMultinationalRegion;
            if (isMultinationalRegion)
            {
                // Get list of country codes to highlight in CountryMap
                args.Clear();
                args.AddParam("countriesInTree", string.Empty, true);
                args.AddParam("selectedLanguage", string.Empty, this.selectedLanguage);
                if (!String.IsNullOrEmpty(this.selectedLanguageTag.ScriptSubtag))
                {
                    args.AddParam("selectedScript", string.Empty, this.selectedLanguageTag.ScriptSubtag);
                }

                if (!String.IsNullOrEmpty(this.selectedLanguageTag.RegionSubtag))
                {
                    args.AddParam("selectedTerritory", string.Empty, this.selectedLanguageTag.RegionSubtag);
                }

                args.AddParam("lang", string.Empty, this.userLang);
                xsltPath = new Uri(Request.Url, "territoryTree.xsl").AbsoluteUri;
                string regionTree = ContentApi.XSLTransform(cldrMainXmlPath, xsltPath, true, true, args, false);

                System.Xml.XPath.XPathDocument docRegionTree = new System.Xml.XPath.XPathDocument(new System.Xml.XmlTextReader(new System.IO.StringReader(regionTree)));
                System.Xml.XPath.XPathNavigator navRegionTree = docRegionTree.CreateNavigator();
                if (navRegionTree != null)
                {
                    string countryCodesXPath = String.Format("//li[@id='{0}']/descendant-or-self::li[not(ul)]/@id", this.selectedLanguageTag.RegionSubtag);
                    System.Xml.XPath.XPathNodeIterator countryNodes = navRegionTree.Select(countryCodesXPath);
                    if (countryNodes != null)
                    {
                        string[] countryCodes = new string[countryNodes.Count];
                        for (int i = 0; i < countryNodes.Count; i++)
                        {
                            countryNodes.MoveNext();
                            countryCodes[i] = countryNodes.Current.Value;
                        }

                        CountryMap.CountryCodes = countryCodes;
                    }
                }

                // Determine map area to display, e.g., whole world, europe, africa, in CountryMap
                CountryMap.MapArea = controls_reports_CountryMap.GeographicalArea.World;
                if (String.IsNullOrEmpty(mapArea))
                {
                    // Single country regions are handled elsewhere, but this will handle single country regions should the need arise.
                    System.Xml.XPath.XPathNavigator countryNode = navRegionTree.SelectSingleNode(String.Format("//li[@id='{0}']/../../@id", this.selectedLanguageTag.RegionSubtag));
                    if (countryNode != null)
                    {
                        string countryRegion = countryNode.Value;
                        mapArea = this.GetRegionValue(countryRegion, "chtm");
                    }
                }

                controls_reports_CountryMap.GeographicalArea[] areas = (controls_reports_CountryMap.GeographicalArea[])Enum.GetValues(typeof(controls_reports_CountryMap.GeographicalArea));
                foreach (controls_reports_CountryMap.GeographicalArea area in areas)
                {
                    if (mapArea == EnumExtensions.ToDescriptionString(area))
                    {
                        CountryMap.MapArea = area;
                        break; // exit, we found it
                    }
                }
            }
            else
            {
                // Single country
                LocatorMap.ImageUrl = CommonApi.AppImgPath + "locators/" + String.Format(RegionFilenameFormat, this.selectedLanguageTag.RegionSubtag);
            }
        }
    }
Пример #7
0
    /// <summary>
    /// Builds the language tag section
    /// </summary>
    /// <param name="cldrMainXmlPath">The file path to the main CLDR file</param>
    private void BuildLanguageTagSection(string cldrMainXmlPath)
    {
        txtXmlLang.Text = this.selectedLanguageTag.ToString();
        txtPrivateUseSubtag.Text = this.selectedLanguageTag.PrivateUseSubtag;

        string xsltPath = new Uri(Request.Url, "scriptList.xsl").AbsoluteUri;
        Ektron.Cms.Xslt.ArgumentList args = new Ektron.Cms.Xslt.ArgumentList();
        args.AddParam("controlId", string.Empty, ScriptSubtagSelector.ClientID);
        args.AddParam("subset", string.Empty, ScriptSubtagSet.Text);
        args.AddParam("selectedLanguage", string.Empty, this.selectedLanguage);
        if (!String.IsNullOrEmpty(this.selectedLanguageTag.ScriptSubtag))
        {
            args.AddParam("selectedScript", string.Empty, this.selectedLanguageTag.ScriptSubtag);
        }
        else
        {
            args.AddParam("prompt", string.Empty, this.msgSelectPrompt);
        }

        if (!String.IsNullOrEmpty(this.selectedLanguageTag.RegionSubtag))
        {
            args.AddParam("selectedTerritory", string.Empty, this.selectedLanguageTag.RegionSubtag);
        }

        args.AddParam("lang", string.Empty, this.userLang);
        ScriptSubtagSelector.Text = ContentApi.XSLTransform(cldrMainXmlPath, xsltPath, true, true, args, false);
    }
Пример #8
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        string sessionId = "";
        if (!string.IsNullOrEmpty(Request["sessionid"]))
        {
            sessionId = Request["sessionid"];
        }
        AssertInternalReferrer(sessionId);
        string output = "<root></root>";

        try
        {
            string sXml = string.Empty;
            string sXslt = string.Empty;
            long xmlConfigId = 0;
            bool isPackageXsl = false;

            if (!string.IsNullOrEmpty(Request["xml"]))
            {
                sXml = Request["xml"];
            }

            if (!string.IsNullOrEmpty(Request["xslt"]))
            {
                sXslt = Request["xslt"];
            }
            if (!string.IsNullOrEmpty(Request["xid"]))
            {
                xmlConfigId = EkFunctions.ReadDbLong(Request["xid"]);
            }

            Ektron.Cms.Xslt.ArgumentList args = null;
            int iArg;
            string sArg = string.Empty;
            int pEqu;
            string sName;
            string sValue;
            iArg = 0;
            if (!string.IsNullOrEmpty(Request["arg0"]))
            {
                sArg = Request["arg0"]; // format: "arg0=" + escape(name + "=" + value)
            }

            while (!string.IsNullOrEmpty(sArg) && sArg.Length > 0)
            {
                pEqu = sArg.IndexOf("="); // separator b/n name and value
                if (pEqu >= 1)
                {
                    sName = sArg.Substring(0, pEqu);
                    sValue = sArg.Substring(pEqu + 1);
                    if (args == null)
                    {
                        args = new Ektron.Cms.Xslt.ArgumentList();
                    }
                    args.AddParam(sName, "", sValue);
                }
                iArg++;
                if (!string.IsNullOrEmpty(Request["arg" + iArg]))
                {
                    sArg = Request["arg" + iArg];
                }
                else
                {
                    sArg = string.Empty;
                }
            }

            if (!string.IsNullOrEmpty(sXml) && Ektron.Cms.Common.EkFunctions.IsURL(sXml))
            {
                try
                {
                    sXml = new Uri(Request.Url, sXml).AbsoluteUri;
                }
                catch (Exception)
                {
                    // Ignore
                }
            }

            // Can't MapPath b/c the transform will lose its context and relative paths will fail.
            if (!string.IsNullOrEmpty(sXslt) && !sXslt.StartsWith("<"))
            {
                bool whitelist = Ektron.Cms.EkXml.IsWhiteListFile(sXslt, refContentApi.ApplicationPath, System.Web.HttpContext.Current.Request.PhysicalApplicationPath, System.Web.HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);
                // either the file will be whitelisted, or the user is logged in and a member of the smart form admins group.
                if (whitelist || Utilities.ValidateUserRole(EkEnumeration.CmsRoleIds.AdminXmlConfig, false))
                {
                    try
                    {
                        sXslt = new Uri(Request.Url, sXslt).AbsoluteUri;
                    }
                    catch (Exception)
                    {
                        // Ignore
                    }
                }
                else
                {
                    sXslt = string.Empty;
                    return;
                }
            }
            else if (xmlConfigId > 0) // smart form editor
            {
                if (Utilities.ValidateUserRole(EkEnumeration.CmsRoleIds.AdminXmlConfig, false) ||
                    !Ektron.Cms.UserContext.GetCurrentUser().IsMemberShip)
                    isPackageXsl = true;
                else
                    sXslt = "";
            }
            output = refContentApi.XSLTransform(sXml, sXslt, false, false, args, true, isPackageXsl);
        }
        catch (Exception ex)
        {
            output = string.Format("<html><head><title>ekAjaxTransform Error</title></head><body class=\"ekAjaxTransformError\">{0}</body></html>", EkFunctions.HtmlEncode(ex.Message));
        }
        Response.ContentType = "application/xml";
        Response.ContentEncoding = System.Text.Encoding.UTF8; // Safari does not encode properly even though this is set
        litContent.Text = output;
    }