예제 #1
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);
        }
    }
예제 #2
0
        private void Display_AliasTab()
        {
            StringBuilder sbHtml = new StringBuilder();
            Ektron.Cms.UrlAliasing.UrlAliasManualApi _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
            Ektron.Cms.UrlAliasing.UrlAliasAutoApi _autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
            System.Collections.Generic.List<string> aliasExtensions;
            string ext = "";
            int i;

            Ektron.Cms.Common.UrlAliasManualData defaultManualAlias = new Ektron.Cms.Common.UrlAliasManualData(0, 0, string.Empty, string.Empty);
            System.Collections.Generic.List<UrlAliasAutoData> autoAliasList = new System.Collections.Generic.List<UrlAliasAutoData>();

            aliasExtensions = _manualAliasApi.GetFileExtensions();
            if (entry_edit_data != null)
            {
                defaultManualAlias = _manualAliasApi.GetDefaultAlias(entry_edit_data.Id);
            }
            sbHtml.Append("<div>");
            if (_urlAliasSettingApi.IsManualAliasEnabled)
            {
                if (m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias))
                {
                    sbHtml.Append("<fieldset><legend><strong>" + m_refMsg.GetMessage("lbl tree url manual aliasing") + "</strong></legend>");
                    sbHtml.Append("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">");
                    sbHtml.Append("<tr><td colspan=4>&nbsp;<br></td></tr>");
                    sbHtml.Append("<tr><td>&nbsp;</td><td class=\"info\" nowrap=\"true\">" + m_refMsg.GetMessage("lbl primary") + " " + m_refMsg.GetMessage("lbl alias name") + ":&nbsp;");
                    sbHtml.Append("<td>&nbsp;<input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + defaultManualAlias.AliasId + "\"></td>");
                    sbHtml.Append("<td>&nbsp;<input type=\"hidden\" name=\"prev_frm_manalias_name\" value=\"" + defaultManualAlias.AliasName + "\"></td>");
                    sbHtml.Append("<td>&nbsp;<input type=\"hidden\" name=\"prev_frm_manalias_ext\" value=\"" + defaultManualAlias.FileExtension + "\"></td>");
                    if (catalog_data.IsDomainFolder)
                    {
                        sbHtml.Append("<td width=\"95%\">http://" + catalog_data.DomainProduction + "/<input type=\"text\"  size=\"35\" id=\"frm_manalias\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + "\">");
                    }
                    else
                    {
                        sbHtml.Append("<td width=\"95%\">" + m_refContentApi.SitePath + "<input type=\"text\"  size=\"35\" id=\"frm_manalias\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + "\">");
                    }

                    for (i = 0; i <= aliasExtensions.Count - 1; i++)
                    {
                        if (ext != "")
                        {
                            ext = ext + ",";
                        }
                        ext = ext + aliasExtensions[i];
                    }
                    sbHtml.Append(m_refContentApi.RenderHTML_RedirExtensionDD("frm_ManAliasExt", defaultManualAlias.FileExtension, ext));
                    sbHtml.Append("<br/></td>");
                    sbHtml.Append("</tr></table></fieldset>");
                    sbHtml.Append("<br/><br/><br/>");
                }
                else
                {
                    sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + defaultManualAlias.AliasId + "\">");
                    sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + defaultManualAlias.FileExtension + "\">");
                }

            }
            if (_urlAliasSettingApi.IsAutoAliasEnabled)
            {
                if (entry_edit_data != null)
                {
                    autoAliasList = _autoaliasApi.GetListForContent(entry_edit_data.Id);
                }
                sbHtml.Append("<div class=\"autoAlias\" style=\"width: auto; height: auto; overflow: auto;\" id=\"autoAliasList\">");
                sbHtml.Append("<fieldset><legend><strong>" + m_refMsg.GetMessage("lbl automatic") + "</strong></legend><br/>");
                sbHtml.Append("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">");
                sbHtml.Append("<tr><td><u><strong>" + m_refMsg.GetMessage("generic type") + "</strong></u></td>");
                sbHtml.Append("<td><u><strong>" + m_refMsg.GetMessage("lbl alias name") + "</strong></u></td></tr>");
                for (i = 0; i <= autoAliasList.Count() - 1; i++)
                {
                    sbHtml.Append("<tr><td>" + autoAliasList[i].AutoAliasType.ToString() + "</td>");
                    sbHtml.Append("<td>" + autoAliasList[i].AliasName + "</td></tr>");
                }
                sbHtml.Append("</table></fieldset></div>");
            }
            sbHtml.Append("</div>");
            ltrEditAlias.Text = sbHtml.ToString();
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Packages.jQuery.jQueryUI.ThemeRoller.Register(this);
            Packages.jQuery.jQueryUI.Tabs.Register(this);
            Packages.jQuery.jQueryUI.Datepicker.Register(this);

            ICmsContextService cmsContextService = ServiceFactory.CreateCmsContextService();
            JS.RegisterJSInclude(this, cmsContextService.UIPath + "/js/jQuery/Plugins/globinfo/ektron.glob." + ClientCulture.Name + ".js", "EktronGlobalCulture_" + ClientCulture.Name + "_JS");
            JS.RegisterJSInclude(this, JS.ManagedScript.EktronBlockUiJS);
            JS.RegisterJSInclude(this, ContentApi.AppPath + "WebCalendar/DefaultTemplate/timeselector/jquery.ptTimeSelect.js", "WebCalendarAdvancedFormTimePickerJS");
            JS.RegisterJSInclude(this, ContentApi.AppPath + "WebCalendar/defaulttemplate/advancedform.js", "WebCalendarAdvancedFormJS");

            labelfortitle.Text = ContentApi.EkMsgRef.GetMessage("generic title label");
            labelforlocation.Text = ContentApi.EkMsgRef.GetMessage("generic location") + ":";

            UpdateButton.ValidationGroup = Owner.ValidationGroup;
            UpdateButton.CommandName = Mode == AdvancedFormMode.Edit ? "Update" : "Insert";
            UpdateButton.Command += new CommandEventHandler(CommandHandler);
            CancelButton.Command += new CommandEventHandler(CancelButton_Command);
            AdvancedEditCloseButton.Command += new CommandEventHandler(CancelButton_Command);

            AdvCalendarSelect.Visible = (Provider.DataSources.Count > 1);
            long lastselectedfolder = Folder;
            sourceSelector.Items.Clear();

            foreach (EventRadScheduleProvider.CalendarData cd in Provider.DataSources)
            {
                if (cd.PermissionData.CanAdd)
                {
                    FolderData fd = ContentApi.GetFolderById(cd.FolderID, false, false);
                    IsEventSearchable = fd.IscontentSearchable;
                    Ektron.Cms.API.User.User uapi = new Ektron.Cms.API.User.User();
                    Ektron.Cms.API.Community.CommunityGroup cgapi = new Ektron.Cms.API.Community.CommunityGroup();
                    if (fd != null)
                    {
                        string name = "";
                        switch (cd.sourceType)
                        {
                            case Ektron.Cms.Controls.SourceType.SystemCalendar:
                                name = "System Calendar: " + fd.Name + " (ID: " + cd.FolderID + ")";
                                break;
                            case Ektron.Cms.Controls.SourceType.GroupCalendar:
                                CommunityGroupData cgd = cgapi.GetCommunityGroupByID(cd.defaultId);
                                name = "Group Calendar: " + cgd.GroupName + " (Group ID: " + cd.defaultId + ")";
                                break;
                            case Ektron.Cms.Controls.SourceType.UserCalendar:
                                UserData thisUser = uapi.GetUser(cd.defaultId, false, true);
                                if (cd.defaultId == 0 || cd.defaultId == ContentApi.UserId)
                                {
                                    name = "My Calendar (" + thisUser.DisplayUserName + ")";
                                }
                                else
                                {
                                    name = "User Calendar: " + thisUser.DisplayUserName + " (User ID: " + cd.defaultId + ")";
                                }
                                break;
                        }
                        sourceSelector.Items.Add(new ListItem(name, cd.FolderID.ToString() + "|" + cd.SelectedTaxID.ToString()));
                    }
                }
            }
            if (Provider.DataSources.Count == 1)
            {
                SelectedTaxID = Provider.DataSources[0].SelectedTaxID;
                Folder = Provider.DataSources[0].FolderID;
            }
            if (sourceSelector.SelectedValue == string.Empty && sourceSelector.Items.Count > 0)
            {
                sourceSelector.Items[0].Selected = true;
            }
            if (lastselectedfolder != 0)
            {
                Folder = lastselectedfolder;
            }
            if (EventData != null)
            {
                Folder = EventData.FolderId;
                sourceSelector.Enabled = false;
            }
            if (Folder > 0)
            {
                TaxonomySelector.FolderID = Folder;
                MetadataSelector.FolderID = Folder;
                if (Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.UrlAliasing, false))
                {
                    Ektron.Cms.UrlAliasing.UrlAliasSettingsApi _aliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi();
                    FolderData fd = ContentApi.GetFolderById(Folder, false, false);
                    if (_aliasSettings.IsManualAliasEnabled)
                    {
                        if (ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias))
                        {
                            phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = true;
                            aliasRequired.InnerText = fd.AliasRequired.ToString().ToLower();
                        }
                    }
                    if (_aliasSettings.IsAutoAliasEnabled)
                    {
                        System.Collections.Generic.List<UrlAliasAutoData> autoAliasList = new System.Collections.Generic.List<UrlAliasAutoData>();
                        Ektron.Cms.UrlAliasing.UrlAliasAutoApi autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
                        phAliases.Visible = phAliasTab.Visible = pnlAutoAlias.Visible = true;
                        if (EventData != null)
                        {
                            autoAliasList = autoAliasApi.GetListForContent(EventData.Id);
                            rpAutoAlias.DataSource = autoAliasList;
                        }
                    }

                     //-------------------DisplayTabs Based on selected options from Folder properties----------------------------------
                    if (((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) == (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) && fd.DisplaySettings != 0)
                    {

                        if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.MetaData) == (int)EkEnumeration.FolderTabDisplaySettings.MetaData)
                        {
                          phMetadata.Visible=  MetadataSelector.Visible = true;
                        }
                        else
                        {
                            if (!MetadataSelector.MetadataRequired)
                                phMetadata.Visible = MetadataSelector.Visible = false;
                        }
                        if ((_aliasSettings.IsManualAliasEnabled || _aliasSettings.IsAutoAliasEnabled) && _contentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) //And Not (m_bIsBlog)
                        {
                            if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) == (int)EkEnumeration.FolderTabDisplaySettings.Aliasing)
                            { phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = pnlAutoAlias.Visible = true; }
                            else
                            {
                                if (!fd.AliasRequired)
                                    phAliases.Visible = phAliasTab.Visible = pnlManualAlias.Visible = pnlAutoAlias.Visible = false;
                            }
                        }

                        if ((fd.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) == (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy)
                        { phTaxonomyTab.Visible = phTaxonomy.Visible = true; }
                        else
                        {
                            if (!fd.IsCategoryRequired)
                                phTaxonomyTab.Visible = phTaxonomy.Visible = false;
                        }

                    }
                    //-------------------DisplayTabs Based on selected options from Folder properties End-----------------------------
                }
            }

            if (!FormInitialized)
            {
                initHiddenData();
                InitializeManualAliases();
                PrefillEventControls();
                PrefillRecurrenceControls();
                UpdateResetExceptionsVisibility();
                bool failed = false;
                string initform = String.Format("Ektron.WebCalendar.AdvancedForm.init(\"{0}\", \"{1}\", {2});", Owner.ClientID, ContentApi.AppPath, ContentApi.RequestInformationRef.WorkAreaOperationMode.ToString().ToLower());
                try
                {
                    JavaScript.RegisterJavaScriptBlock(this, initform);
                }
                catch
                {
                    failed = true;
                }
                if (failed || Controls.IsReadOnly)
                {
                    //we're apparently in a full postback which doesn't care for registerjsblock
                    extrascript.Text = "<script type=\"text/javascript\" defer=\"defer\"> window.setTimeout(function(){" + initform + "}, 750); </script>";
                    extrascript.Visible = true;
                }
            }
            else
            {
                extrascript.Visible = false;
            }
            btnHelp.Text = "<li class=\"actionbarDivider\">&nbsp;</li>" + m_refStyle.GetHelpButton("editevent", "");
        }
예제 #4
0
    private void PostBack_DoFindContent()
    {
        pagedata = new Collection();
        try
        {
            SearchAssetRequest sar = new SearchAssetRequest();
            Ektron.Cms.Content.EkContent ekc;
            Ektron.Cms.UrlAliasing.UrlAliasManualApi _manualAliasApi;
            Ektron.Cms.UrlAliasing.UrlAliasAutoApi _autoAliasApi;
            System.Collections.Generic.List<UrlAliasManualData> manualAliasList;
            System.Collections.Generic.List<UrlAliasAutoData> autoAliasList;
            string tempURL;
            string strLibPath = "";
            string strContentID = "";
            long contentID = 0;
            string strFormID = "";
            string strAssetName = "";
            string strLibtype = "";
            PagingInfo page;
            int index = 0;
            int contentType = 0;
            ekc = m_refContentApi.EkContentRef;

            strLibPath = (string)((!(Request.QueryString["libpath"] == null)) ? (Request.QueryString["libpath"]) : "");
            strContentID = (string)((!(Request.QueryString["content_id"] == null)) ? (Request.QueryString["content_id"]) : "");
            strFormID = (string)((!(Request.QueryString["form_id"] == null)) ? (Request.QueryString["form_id"]) : "");
            strAssetName = (string)((!(Request.QueryString["asset_name"] == null)) ? (Request.QueryString["asset_name"]) : "");
            strLibtype = (string)((!(Request.QueryString["libtype"] == null)) ? (Request.QueryString["libtype"]) : "");
            contentID = EkFunctions.ReadDbLong(strContentID);
            contentType = Convert.ToInt32(m_refContentApi.EkContentRef.GetContentType(contentID));
            if (strLibPath != "")
            {
                m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }

            // Fixed #13770, search links from a form
            if ((strLibPath != "") || (strContentID != "") || (strFormID != "") || (strAssetName != ""))
            {
                // Checking links from known content block
                sar = new SearchAssetRequest();
                sar.FolderID = 0;
                sar.Recursive = true;
                sar.SearchContent = true;
                sar.AllowFragments = true;
                sar.SearchInHTML = true;
                sar.SearchForms = true;
                sar.SearchCatalog = System.Convert.ToBoolean(contentType == EkConstants.CMSContentType_CatalogEntry);

                string domain;
                domain = "";
                if ((strFormID != "") || (strContentID != ""))
                {
                    // see if content is in a domain folder which always uses linkit.aspx
                    string id;
                    if (strFormID != "")
                    {
                        id = strFormID;
                    }
                    else
                    {
                        id = strContentID;
                    }
                    domain = m_refContentApi.GetDomainByContentId(Convert.ToInt64(id));

                }

                if (strAssetName != "" && !m_refContentApi.RequestInformationRef.LinkManagement)
                {
                    sar.SearchText = strAssetName.Replace("\'", "\'");
                    sar.SearchType = EkEnumeration.SearchTypes.AndWords;
                }
                else if ((strAssetName != "") && (strLibtype != "images"))
                {
                    sar.SearchType = EkEnumeration.SearchTypes.OrWords; //AndWords
                    sar.SearchText = (string)("linkit.aspx?LinkIdentifier=id&amp;ItemId=" + strContentID + ",showcontent.aspx?id=" + strContentID);
                    //If searching for content linked to DMS image (from library)
                }
                else if ((strAssetName != "") && (strLibtype == "images"))
                {
                    sar.SearchType = EkEnumeration.SearchTypes.OrWords; //AndWords
                    sar.SearchText = strAssetName;
                }
                else if (strLibPath != "")
                {
                    if ((m_refContentApi.RequestInformationRef.LinkManagement || (domain != null)) && ((strLibtype != "images") && strLibtype != "files") && (strLibtype != "hyperlinks"))
                    {
                        //This is only for quicklink search
                        //if content is in a domain folder, linkit.aspx will redirect to the proper domain
                        if (strFormID != "")
                        {
                            sar.SearchText = (string)("linkit.aspx?LinkIdentifier=ekfrm&amp;ItemId=" + strFormID);
                        }
                        else
                        {
                            sar.SearchText = (string)("linkit.aspx?LinkIdentifier=id&amp;ItemId=" + strContentID);
                        }
                    }
                    else
                    {
                        sar.SearchText = strLibPath;
                    }

                    sar.SearchType = EkEnumeration.SearchTypes.AndWords;
                }
                else if ((m_refContentApi.RequestInformationRef.LinkManagement || (domain != null)) && (strFormID != ""))
                {
                    // if content is in a domain folder, linkit.aspx will redirect to the proper domain
                    sar.SearchText = (string)("linkit.aspx?LinkIdentifier=ekfrm&amp;ItemId=" + strFormID);
                    sar.SearchType = EkEnumeration.SearchTypes.AndWords;
                }
                else if (strContentID != "")
                {

                    _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
                    _autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
                    page = new Ektron.Cms.PagingInfo();
                    long.TryParse(strContentID, out contentID);
                    manualAliasList = _manualAliasApi.GetList(page, contentID, true, EkEnumeration.UrlAliasingOrderBy.None);
                    autoAliasList = _autoAliasApi.GetListForContent(contentID);
                    tempURL = string.Empty;
                    for (index = 0; index <= manualAliasList.Count - 1; index++)
                    {
                        tempURL += (string)(manualAliasList[index].DisplayAlias + " ");
                    }
                    for (index = 0; index <= autoAliasList.Count - 1; index++)
                    {
                        tempURL += (string)(autoAliasList[index].AliasName + " ");
                    }

                    // We check the alias and add that as the or phrase.
                    sar.SearchText = (string)("id=" + strContentID);
                    if (tempURL != "" && domain != "")
                    {
                        sar.SearchText += (string)(" " + domain + "/" + tempURL);
                    }
                    else if (tempURL != "" && domain == "")
                    {
                        sar.SearchText += (string)(" " + m_refContentApi.SitePath + tempURL);
                    }
                    sar.SearchType = EkEnumeration.SearchTypes.OrWords;
                }
                else
                {
                    // Not sure if GetAllAliasedPageNameByCID needs form id or content id,
                    // but all we've got at this point is form id.
                    // We check the alias and add that as the or phrase.
                    _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
                    _autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
                    page = new Ektron.Cms.PagingInfo();
                    long.TryParse(strContentID, out contentID);
                    manualAliasList = _manualAliasApi.GetList(page, contentID, true, EkEnumeration.UrlAliasingOrderBy.None);
                    autoAliasList = _autoAliasApi.GetListForContent(contentID);
                    tempURL = string.Empty;
                    for (index = 0; index <= manualAliasList.Count - 1; index++)
                    {
                        tempURL += (string)(manualAliasList[index].DisplayAlias + " ");
                    }
                    for (index = 0; index <= autoAliasList.Count - 1; index++)
                    {
                        tempURL += (string)(autoAliasList[index].AliasName + " ");
                    }
                    sar.SearchText = (string)("ekfrm=" + strFormID);
                    if (tempURL != "" && domain != "")
                    {
                        sar.SearchText += (string)(" " + domain + "/" + tempURL);
                    }
                    else if (tempURL != "" && domain == "")
                    {
                        sar.SearchText += (string)(" " + m_refContentApi.SitePath + tempURL);
                    }
                    sar.SearchType = EkEnumeration.SearchTypes.OrWords;
                }

            }
            else
            {
                sar = CustomFields.Populate_AssetRequestObjectFromForm(null);
            }

            sar.isWorkareaSearch = true;
            sar.ItemLanguageID = this.ContentLanguage;

            SearchContentItem[] sic;
            sar.CurrentPage = m_intCurrentPage;

            string cacheKey;
            if (sar.SearchText != "")
            {
                cacheKey = sar.SearchText + sar.SearchType.ToString() + sar.SearchAssets.ToString() + sar.Teaser_SearchText + sar.Title_SearchText + sar.FolderID.ToString();
            }
            else
            {
                cacheKey = (string)("Blank" + sar.SearchType.ToString() + sar.SearchAssets.ToString() + sar.Teaser_SearchText + sar.Title_SearchText + sar.FolderID.ToString());
            }
            if (!(Cache[cacheKey] == null))
            {
                sar.SearchResults = (SearchCacheData[])Cache[cacheKey];
            }

            //cms_LoadSearchResult stored proc doesn't return SearchAssetRequest.RecordsAffected value if we do not pass pagesize: Defect:46642
            if ((!(Request.Form[isPostData.UniqueID] == null)) || (m_strPageAction == "dofindcontent"))
            {
                sar.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
            }
            sic = ekc.SearchAssets(ref sar);

            if ((Cache[cacheKey] == null) && sar.SearchResults != null)
            {
                Cache.Add(cacheKey, sar.SearchResults, null, DateTime.Now.AddSeconds(120), TimeSpan.Zero, CacheItemPriority.Normal, null);
            }

            m_intTotalPages = sar.TotalPages;
            m_intTotalRecords = sar.RecordsAffected;
            PageSettings();
            search_result = sic;

            StringBuilder strHiddenText = new StringBuilder();

            if (!((Request.Form[isPostData.UniqueID] == null)) && m_intTotalPages > 1)
            {
                foreach (object AvailableItem in Request.Form)
                {
                    if (AvailableItem.ToString().ToLower().IndexOf("ecm", 0, 3) != -1)
                    {
                        strHiddenText.Append("<input type=\"hidden\" id=\"" + AvailableItem + "\" name=\"" + AvailableItem + "\" value=\"" + Request.Form[AvailableItem.ToString()] + "\">");
                    }
                }
                HiddenData.Text = strHiddenText.ToString();
            }

            //Since viewstate is false for the page, ensure the active tab is set correctly.
            //mvSearch.ActiveViewIndex = Convert.ToInt32(hdnSelectedTab.Value);
            if (Convert.ToInt32(hdnSelectedTab.Value) == 0)
                uxSearchTabs.SetActiveTab(uxTabBasic);
            else
                uxSearchTabs.SetActiveTab(uxTabAdvanced);
            hmenuSelected.Value = hdnSelectedTab.Value;

            string strViewMode;
            //If there is no dropdown on the page ie. clicked on a page link in results,
            //use old value of dropdown from the hidden field pageMode
            //else use dropdown value and, update pageMode
            if (!(Request.Form["selDisplayMode"] == null))
            {
                strViewMode = (string)(Request.Form["selDisplayMode"].ToLower());
                pageMode.Value = strViewMode;
            }
            else
            {
                strViewMode = (string)pageMode.Value;
            }

            if ((strViewMode != null) && (strViewMode.CompareTo("graphical") == 0))
            {
                iconListOutputLit.Text = "&nbsp;&nbsp;Processing...";
                BuildGraphicalResults(sar);
            }
            else if ((strViewMode != null) && (strViewMode.CompareTo("mixed") == 0))
            {
                Populate_SearchResultGrid_Content_Mixed(sar);
            }
            else
            {
                // Default to text mode:
                Populate_SearchResultGrid_Content(sar);
            }

            if (strLibPath != "")
            {
                m_refContentApi.ContentLanguage = ContentLanguage;
            }
            //mvSearch.SetActiveView(vwSearchAdvanced);
            uxSearchTabs.SetActiveTab(uxTabAdvanced);
        }
        catch (Exception ex)
        {
            throw (new Exception("[iSearch.asx.vb->Postback_DoFindContent] " + ex.Message));
        }
    }
예제 #5
0
파일: edit.aspx.cs 프로젝트: jaytem/minGit
    private void EditAliasHtmlScripts()
    {
        StringBuilder sbHtml = new StringBuilder();
        Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliaslist = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
        Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
        System.Collections.Generic.List<string> ext_alias;
        string ext = "";
        int i;

        Ektron.Cms.Common.UrlAliasManualData d_alias = new Ektron.Cms.Common.UrlAliasManualData(0, 0, string.Empty, string.Empty);
        System.Collections.Generic.List<UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<UrlAliasAutoData>();

        bool IsStagingServer;

        IsStagingServer = m_refContApi.RequestInformationRef.IsStaging;

        ext_alias = m_aliaslist.GetFileExtensions();
        if (content_edit_data != null)
        {
            d_alias = m_aliaslist.GetDefaultAlias(content_edit_data.Id);
        }
        m_strManualAliasExt = d_alias.AliasName;
        m_strManualAlias = d_alias.FileExtension;

        sbHtml.Append("<div id=\"dvAlias\">");
        if (m_urlAliasSettings.IsManualAliasEnabled)
        {
            if (m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias))
            {
                sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + d_alias.AliasId + "\">");
                sbHtml.Append("<input type=\"hidden\" id=\"prev_frm_manalias_name\" name=\"prev_frm_manalias_name\" value=\"" + d_alias.AliasName + "\">");
                sbHtml.Append("<input type=\"hidden\" name=\"prev_frm_manalias_ext\" value=\"" + d_alias.FileExtension + "\">");
                sbHtml.Append("<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl tree url manual aliasing") + "</div>");
                sbHtml.Append("<table class=\"ektronForm\">");
                sbHtml.Append("<tr>");
                sbHtml.Append("<td class=\"label\">");
                sbHtml.Append(m_refMsg.GetMessage("lbl primary") + " " + m_refMsg.GetMessage("lbl alias name") + ":");
                sbHtml.Append("</td>");
                sbHtml.Append("<td class=\"value\">");

                if (IsStagingServer && folder_data.DomainStaging != string.Empty)
                {
                    sbHtml.Append("<td width=\"95%\">http://" + folder_data.DomainStaging + "/<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
                }
                else if (folder_data.IsDomainFolder)
                {
                    sbHtml.Append("http://" + folder_data.DomainProduction + "/<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
                }
                else
                {
                    sbHtml.Append(SitePath + "<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
                }
                for (i = 0; i <= ext_alias.Count - 1; i++)
                {
                    if (ext != "")
                    {
                        ext = ext + ",";
                    }
                    ext = ext + ext_alias[i];
                }
                sbHtml.Append(m_refContApi.RenderHTML_RedirExtensionDD("frm_ManAliasExt", d_alias.FileExtension, ext));
                sbHtml.Append("</td>");
                sbHtml.Append("</tr>");
                sbHtml.Append("</table>");
                if (m_refContApi.RedirectorManExt.IndexOf(",") + 1 <= 0)
                {
                    ast_frm_manaliasExt.Value = m_refContApi.RedirectorManExt;
                }
            }
        }
        if (m_urlAliasSettings.IsAutoAliasEnabled)
        {
            if (content_edit_data != null)
            {
                auto_aliaslist = m_autoaliasApi.GetListForContent(content_edit_data.Id);
            }
            sbHtml.Append("<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>");
            sbHtml.Append("<div class=\"ektronBorder\" style=\"width: auto; height: auto; overflow: auto;\" id=\"autoAliasList\">");
            sbHtml.Append("<table width=\"100%\">");
            sbHtml.Append("<tr class=\"title-header\">");
            sbHtml.Append("<th>");
            sbHtml.Append(m_refMsg.GetMessage("generic type"));
            sbHtml.Append("</th>");
            sbHtml.Append("<th>");
            sbHtml.Append(m_refMsg.GetMessage("lbl alias name"));
            sbHtml.Append("</th>");
            for (i = 0; i <= auto_aliaslist.Count() - 1; i++)
            {
                sbHtml.Append("<tr>");
                sbHtml.Append("<td>" + auto_aliaslist[i].AutoAliasType.ToString() + "</td>");
                sbHtml.Append("<td>" + auto_aliaslist[i].AliasName + "</td>");
                sbHtml.Append("</tr>");
            }
            sbHtml.Append("</table>");
            sbHtml.Append("</div>");
        }
        sbHtml.Append("</div>");
        EditAliasHtml.Text = sbHtml.ToString();
    }