Пример #1
0
    private void Display_EditControls()
    {
        int intContentLanguage = 1033;
        PermissionData security_lib_data;
        int i = 0;
        bool bEphoxSupport = false;
        string aliasContentType = string.Empty;

        folder_data = null;
        try
        {
            netscape.Value = "";
            language_data = m_refSiteApi.GetLanguageById(m_intContentLanguage);
            ImagePath = language_data.ImagePath;
            BrowserCode = language_data.BrowserCode;
            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                asset_info.Add(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i], "");
            }
            Page.ClientScript.RegisterHiddenField("TaxonomyOverrideId", Convert.ToString(TaxonomyOverrideId));
            if (IsMac && m_SelectedEditControl != "ContentDesigner" && m_strType == "update")
            {
                //We do not support XML content and Form. Check if the content is XML or form and if it is then don't proceed further.
                ContentData cData;
                cData = m_refContApi.GetContentById(m_intItemId, 0);
                if ((cData.Type == 2) || ((cData.XmlConfiguration != null) && (cData.XmlConfiguration.PackageXslt.Length > 0)))
                {
                    bEphoxSupport = false;
                }
                else
                {
                    bEphoxSupport = true;
                }
                if (!bEphoxSupport)
                {
                    //Show not supported message
                    throw (new Exception("Forms and XML Editing is not supported on MAC."));
                }
            }
            if ((Request.QueryString["pullapproval"] == "true") && (m_strType == "update"))
            {
                ret = m_refContent.TakeOwnership(m_intItemId);
            }
            var2 = m_refContent.GetEditorVariablev2_0(m_intItemId, m_strType); //TODO:Verify info param via var1 removed
            security_data = m_refContApi.LoadPermissions(m_intItemId, "content", 0);
            endDateActionSel = GetEndDateActionStrings();
            endDateActionSize = Convert.ToInt32(endDateActionSel["SelectionSize"]);
            if (security_data != null)
            {
                IsAdmin = security_data.IsAdmin;
            }
            active_subscription_list = m_refContApi.GetAllActiveSubscriptions();
            settings_data = m_refSiteApi.GetSiteVariables(CurrentUserID);

            if (m_strType == "update")
            {
                content_edit_data = m_refContApi.GetContentForEditing(m_intItemId);
                UserRights = m_refContApi.LoadPermissions(m_intItemId, "content", ContentAPI.PermissionResultType.Content);
                lContentType = content_edit_data.Type;
                lContentSubType = content_edit_data.SubType;
                if (content_edit_data.Type == 2 || 4 == content_edit_data.Type)
                {
                    bIsFormDesign = true;
                    m_intContentType = 2;
                }
                if (!(content_edit_data == null))
                {
                    security_lib_data = m_refContApi.LoadPermissions(content_edit_data.FolderId, "folder", 0);
                    UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib;
                    m_strContentTitle = Server.HtmlDecode(content_edit_data.Title);
                    m_strAssetFileName = content_edit_data.AssetData.FileName;
                    m_strContentHtml = content_edit_data.Html;
                    content_teaser = content_edit_data.Teaser;
                    meta_data = content_edit_data.MetaData;

                    content_comment = Server.HtmlDecode(content_edit_data.Comment);
                    content_stylesheet = content_edit_data.StyleSheet;
                    m_intContentFolder = content_edit_data.FolderId;
                    m_intTaxFolderId = content_edit_data.FolderId;
                    intContentLanguage = content_edit_data.LanguageId;
                    go_live = content_edit_data.GoLive;
                    end_date = content_edit_data.EndDate;
                    end_date_action = content_edit_data.EndDateAction.ToString();
                    intInheritFrom = m_refContent.GetFolderInheritedFrom(m_intContentFolder);

                    subscription_data_list = m_refContApi.GetSubscriptionsForFolder(intInheritFrom);
                    subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForContent(m_refContentId); //first try content
                    if (subscription_properties_list == null)
                    {
                        subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForFolder(intInheritFrom); //then get folder
                        subscribed_data_list = subscription_data_list;
                    }
                    else //content is populated.
                    {
                        subscribed_data_list = m_refContApi.GetSubscriptionsForContent(m_refContentId); // get subs for folder
                    }

                    if (!(meta_data == null))
                    {
                        MetaDataNumber = meta_data.Length;
                    }
                    PreviousState = content_edit_data.CurrentStatus;
                    iMaxContLength = content_edit_data.MaxContentSize;
                    iMaxSummLength = content_edit_data.MaxSummarySize;
                    path = content_edit_data.Path;
                    m_intManualAliasId = content_edit_data.ManualAliasId;

                    folder_data = m_refContApi.GetFolderById(m_intContentFolder);

                    if ((path.Substring(path.Length - 1, 1) == "\\"))
                    {
                        path = path.Substring(path.Length -(path.Length - 1));
                    }
                    //Check to see if this belongs to XML configuration
                    if (lContentType != 2)
                    {
                        xmlconfig_data = content_edit_data.XmlConfiguration;
                        if (!(xmlconfig_data == null))
                        {
                            editorPackage = xmlconfig_data.PackageXslt;
                            MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + content_edit_data.XmlConfiguration.Id.ToString() + "\">";
                            if (editorPackage.Length > 0)
                            {
                                bVer4Editor = true; // this means that we will be using the new Package Design for the content
                            }
                        }
                    }

                    if (m_strContentTitle != "")
                    {
                        MetaComplete = UserRights.CanMetadataComplete; //Changed from 1 to true
                    }
                    asset_info["AssetID"] = content_edit_data.AssetData.Id;
                    asset_info["AssetVersion"] = content_edit_data.AssetData.Version;
                    asset_info["MimeType"] = content_edit_data.AssetData.MimeType;
                    asset_info["FileExtension"] = content_edit_data.AssetData.FileExtension;
                }
                validTypes.Value = Convert.ToString(asset_info["FileExtension"]);
            }
            else
            {

                UserRights = m_refContApi.LoadPermissions(m_intItemId, "folder", ContentAPI.PermissionResultType.Folder);
                folder_data = m_refContApi.GetFolderById(m_intItemId);
                MetaComplete = UserRights.CanMetadataComplete;
                if (m_intXmlConfigId > -1)
                {
                    xmlconfig_data = m_refContApi.GetXmlConfiguration(m_intXmlConfigId);
                    MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + m_intXmlConfigId.ToString() + "\">";
                }
                else
                {
                    if ((folder_data.XmlConfiguration != null) && (folder_data.XmlConfiguration.Length > 0) && (Request.QueryString["AllowHTML"] != "1"))
                    {
                        xmlconfig_data = folder_data.XmlConfiguration[0];
                    }
                    else
                    {
                        xmlconfig_data = null;
                    }
                }
                if (!(xmlconfig_data == null))
                {
                    editorPackage = xmlconfig_data.PackageXslt;
                    if (editorPackage.Length > 0)
                    {
                        bVer4Editor = true;
                    }
                }
                content_stylesheet = m_refContApi.GetStyleSheetByFolderID(m_intItemId);
                security_lib_data = m_refContApi.LoadPermissions(m_intItemId, "folder", 0);
                UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib;
                string TmpId = Request.QueryString["content_id"];
                if (!String.IsNullOrEmpty(TmpId))
                {
                    //translating asset
                    if (Request.QueryString["type"] == "add")
                    {
                        if (!String.IsNullOrEmpty(Request.QueryString["back_LangType"]))
                        {
                            m_refContApi.ContentLanguage = Convert.ToInt32(Request.QueryString["back_LangType"]);
                        }
                        else
                        {
                            m_refContApi.ContentLanguage = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]);
                        }
                    }
                    content_data = m_refContApi.GetContentById(Convert.ToInt64(TmpId), 0);
                    if (content_data != null)
                    {
                        if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
                        {
                            isOfficeDoc.Value = "true";
                        }
                        if (m_intXmlConfigId == -1)
                        {
                            if (content_data.XmlConfiguration != null)
                            {
                                m_intXmlConfigId = content_data.XmlConfiguration.Id;
                                xmlconfig_data = content_data.XmlConfiguration;
                                editorPackage = xmlconfig_data.PackageXslt;
                                if (editorPackage.Length > 0)
                                {
                                    bVer4Editor = true;
                                }
                                MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + m_intXmlConfigId.ToString() + "\">";
                            }
                        }

                        m_strContentTitle = Server.HtmlDecode(content_data.Title);
                        m_strAssetFileName = content_data.AssetData.FileName;
                        m_strContentHtml = content_data.Html;
                        content_teaser = content_data.Teaser;
                        content_comment = Server.HtmlDecode(content_data.Comment);
                        go_live = content_data.GoLive;
                        end_date = content_data.EndDate;
                        end_date_action = content_data.EndDateAction.ToString();
                        lContentType = content_data.Type;
                        lContentSubType = content_data.SubType;
                        if (m_strType == "add")
                        {
                            if (Utilities.IsAssetType(lContentType))
                            {
                                m_strContentTitle = Server.HtmlDecode(content_data.Title);
                                validTypes.Value = content_data.AssetData.FileExtension;
                            }
                        }
                        else
                        {
                            asset_info["AssetID"] = content_data.AssetData.Id;
                            asset_info["AssetVersion"] = content_data.AssetData.Version;
                            asset_info["AssetFilename"] = content_data.AssetData.FileName;
                            asset_info["MimeType"] = content_data.AssetData.MimeType;
                            asset_info["FileExtension"] = content_data.AssetData.FileExtension;
                            asset_info["MimeName"] = content_data.AssetData.MimeName;
                            asset_info["ImageUrl"] = content_data.AssetData.ImageUrl;
                            if (Convert.ToString(asset_info["MimeType"]) == "application/x-shockwave-flash")
                            {
                                asset_info["MediaAsset"] = true;
                            }
                            else
                            {
                                asset_info["MediaAsset"] = false;
                            }
                            validTypes.Value = Convert.ToString(asset_info["FileExtension"]);
                            //Next
                        }
                    }
                }
                else
                {
                    //Adding new file
                    List<string> fileTypeCol = new List<string>(DocumentManagerData.Instance.FileTypes.Split(",".ToCharArray()));
                    string allTypes = "";
                    foreach (string type in fileTypeCol)
                    {
                        if (allTypes.Length > 0)
                        {
                            allTypes += (string)("," + type.Trim().Replace("*.", ""));
                        }
                        else
                        {
                            allTypes += type.Trim().Replace("*.", "");
                        }
                    }
                    validTypes.Value = allTypes;
                }
                m_intContentFolder = m_intItemId;
                intInheritFrom = m_refContent.GetFolderInheritedFrom(m_intContentFolder);
                subscription_data_list = m_refContApi.GetSubscriptionsForFolder(intInheritFrom); //AGofPA get subs for folder; set break inheritance flag false
                subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForFolder(intInheritFrom); //get folder properties
                subscribed_data_list = subscription_data_list; //get subs for folder
                intContentLanguage = m_intContentLanguage;
                m_refContApi.ContentLanguage = m_intContentLanguage;

                meta_data = m_refContApi.GetMetaDataTypes("id");
                path = m_refContApi.GetPathByFolderID(m_intContentFolder);
                if ((path.Substring(path.Length - 1, 1) == "\\"))
                {
                    path = path.Substring(path.Length - (path.Length - 1));
                }
                iMaxContLength = int.Parse(settings_data.MaxContentSize);
                iMaxSummLength = int.Parse(settings_data.MaxSummarySize);
            }
            if (folder_data.FolderType == 1)
            {
                m_bIsBlog = true;
                blog_data = m_refContApi.BlogObject(folder_data);
                if (m_strType == "update")
                {
                    blog_post_data = m_refContApi.GetBlogPostData(m_intItemId);
                }
                else if (m_strType == "add" && m_refContentId > 0) // add new lang
                {
                    blog_post_data = m_refContApi.EkContentRef.GetBlogPostDataOnly(m_refContentId, back_LangType);
                }
                else
                {
                    blog_post_data = m_refContApi.GetBlankBlogPostData();
                }
            }
            if (xmlconfig_data != null)
            {
                Collection collXmlConfigData = (Collection)xmlconfig_data.LogicalPathComplete;
                if (bVer4Editor == false) //only do this if we are using the old method
                {
                    urlxml = "?Edit_xslt=";
                    if (xmlconfig_data.EditXslt.Length > 0)
                    {
                        urlxml = urlxml + EkFunctions.UrlEncode(Convert.ToString(collXmlConfigData["EditXslt"]));
                        if (m_strContentHtml.Trim().Length == 0)
                        {
                            m_strContentHtml = "<root> </root>";
                        }
                    }
                    urlxml = urlxml + "&Save_xslt=";
                    if (xmlconfig_data.SaveXslt.Length > 0)
                    {
                        save_xslt_file = Convert.ToString(collXmlConfigData["SaveXslt"]);
                        urlxml = urlxml + EkFunctions.UrlEncode(save_xslt_file);
                    }
                    urlxml = urlxml + "&Schema=";
                    if (xmlconfig_data.XmlSchema.Length > 0)
                    {
                        m_strSchemaFile = Convert.ToString(collXmlConfigData["XmlSchema"]);
                        urlxml = urlxml + EkFunctions.UrlEncode(m_strSchemaFile);
                    }
                    xml_config = AppeWebPath + "cms_xmlconfig.aspx" + urlxml;
                    if (xmlconfig_data.XmlAdvConfig.Length > 0)
                    {
                        xml_config = Convert.ToString(collXmlConfigData["XmlAdvConfig"] + urlxml);
                    }
                    m_strSchemaFile = Convert.ToString(collXmlConfigData["XmlSchema"]);
                    m_strNamespaceFile = Convert.ToString(collXmlConfigData["XmlNameSpace"]);
                }
            }

            //DHTML RENDERING
            //ASSET CONFIG
            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                AssetHidden.Text += "<input type=\"hidden\" name=\"asset_" + Strings.LCase(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]) + "\" value=\"" + EkFunctions.HtmlEncode(asset_info[Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]].ToString()) + "\">";
            }
            content_type.Value = Convert.ToString(lContentType);
            content_subtype.Value = Convert.ToString(lContentSubType);
            if (m_SelectedEditControl != "ContentDesigner")
            {
                jsEditorScripts.Text = Utilities.EditorScripts(var2, AppeWebPath, BrowserCode);
            }
            AutoNav.Text = path.Replace("\\", "\\\\");
            invalidFormatMsg.Text = m_refMsg.GetMessage("js: invalid date format error msg");
            invalidYearMsg.Text = m_refMsg.GetMessage("js: invalid year error msg");
            invalidMonthMsg.Text = m_refMsg.GetMessage("js: invalid month error msg");
            invalidDayMsg.Text = m_refMsg.GetMessage("js: invalid day error msg");
            invalidTimeMsg.Text = m_refMsg.GetMessage("js: invalid time error msg");

            if (MetaComplete)
            {
                ecmMetaComplete.Text = "1";
            }
            else
            {
                ecmMetaComplete.Text = "0";
            }
            ecmMonths.Text = "";
            jsNullContent.Text = m_refMsg.GetMessage("null content warning msg");
            jsEDWarning.Text = m_refMsg.GetMessage("js: earlier end date warning");
            jsMetaCompleteWarning.Text = m_refMsg.GetMessage("js: alert cannot submit meta incomplete") + "\\n" + m_refMsg.GetMessage("js: alert save or checkin or complete meta");
            jsSetActionFunction.Text = SetActionClientScript(folder_data.PublishHtmlActive, (xmlconfig_data != null && 1 == lContentType));
            jsSitePath.Text = m_refContApi.SitePath;
            jsEditProLocale.Text = AppeWebPath + "locale" + AppLocaleString + "b.xml";
            ValidateContentPanel.Text = " var errReason = 0;" + "\r\n";
            ValidateContentPanel.Text += "var errReasonT = 0;" + "\r\n";
            ValidateContentPanel.Text += "var errAccess = false;" + "\r\n";
            ValidateContentPanel.Text += "var errMessage = \"\";" + "\r\n";
            ValidateContentPanel.Text += "var sInvalidContent = \"Continue saving invalid document?\";" + "\r\n";
            if (m_SelectedEditControl != "ContentDesigner")
            {
                ValidateContentPanel.Text += "if (eWebEditProMessages) {" + "\r\n";
                ValidateContentPanel.Text += "  sInvalidContent = eWebEditProMessages.invalidContent;" + "\r\n";
                ValidateContentPanel.Text += "}" + "\r\n";
            }
            ValidateContentPanel.Text += "var errContent = \"" + m_refMsg.GetMessage("js: alert invalid data") + "\";" + "\r\n";
            ValidateContentPanel.Text += "var objValidateInstance = null;" + "\r\n";
            if (m_SelectedEditControl != "ContentDesigner")
            {
                ValidateContentPanel.Text += "objValidateInstance = eWebEditPro.instances[\"content_html\"];" + "\r\n";
                ValidateContentPanel.Text += "if (objValidateInstance){" + "\r\n";
                ValidateContentPanel.Text += "	if (!eWebEditPro.instances[\"content_html\"].validateContent()) {" + "\r\n";
                ValidateContentPanel.Text += "		errReason = objValidateInstance.event.reason;" + "\r\n";
                ValidateContentPanel.Text += "		if (-1001 == errReason || -1002 == errReason || 1003 == errReason || -1003 == errReason) {" + "\r\n";
                ValidateContentPanel.Text += "			errAccess = true;" + "\r\n";
                ValidateContentPanel.Text += "		}" + "\r\n";
                ValidateContentPanel.Text += "	}" + "\r\n";
                ValidateContentPanel.Text += "}" + "\r\n";
            }
            else
            {
                ValidateContentPanel.Text += "  if (\"object\" == typeof Ektron && Ektron.ContentDesigner && Ektron.ContentDesigner.instances) {" + "\r\n";
                ValidateContentPanel.Text += "      var objContentEditor = Ektron.ContentDesigner.instances[\"content_html\"];" + "\r\n";
                ValidateContentPanel.Text += "      if (objContentEditor && \"function\" == typeof objContentEditor.validateContent) {" + "\r\n";
                ValidateContentPanel.Text += "          errMessage = objContentEditor.validateContent();" + "\r\n";
                ValidateContentPanel.Text += "      }" + "\r\n";
                ValidateContentPanel.Text += "      if (errMessage != null && errMessage != \"\") {" + "\r\n";
                ValidateContentPanel.Text += "          if (\"object\" == typeof errMessage && \"undefined\" == typeof errMessage.code) {" + "\r\n";
                ValidateContentPanel.Text += "              alert(errMessage.join(\"\\n\\n\\n\"));" + "\r\n";
                ValidateContentPanel.Text += "		        return false;" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "          else if (\"object\" == typeof errMessage && \"string\" == typeof errMessage.msg) {" + "\r\n";
                ValidateContentPanel.Text += "		        errReason = errMessage.code;" + "\r\n";
                ValidateContentPanel.Text += "			    errAccess = true;" + "\r\n";
                ValidateContentPanel.Text += "              alert(\"Content is invalid.\" + \"\\n\\n\" + errMessage.msg);" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "          else if (\"string\" == typeof errMessage && errMessage.length > 0) {" + "\r\n";
                ValidateContentPanel.Text += "              alert(errMessage);" + "\r\n";
                ValidateContentPanel.Text += "		        return false;" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "      }" + "\r\n";
                ValidateContentPanel.Text += "  }" + "\r\n";
            }
            ValidateContentPanel.Text += "var objTeaserInstance = null;" + "\r\n";
            if (m_SelectedEditControl != "ContentDesigner")
            {
                ValidateContentPanel.Text += "objTeaserInstance = eWebEditPro.instances[\"content_teaser\"];" + "\r\n";
                ValidateContentPanel.Text += "if (objTeaserInstance){" + "\r\n";
                ValidateContentPanel.Text += "	if (!objTeaserInstance.validateContent()) {" + "\r\n";
                ValidateContentPanel.Text += "		errReasonT = objTeaserInstance.event.reason;" + "\r\n";
                ValidateContentPanel.Text += "		if (-1001 == errReasonT || -1002 == errReasonT || 1003 == errReasonT || -1003 == errReasonT) {" + "\r\n";
                ValidateContentPanel.Text += "			errAccess = true;" + "\r\n";
                ValidateContentPanel.Text += "		}" + "\r\n";
                ValidateContentPanel.Text += "	}" + "\r\n";
                ValidateContentPanel.Text += "}" + "\r\n";
            }
            else
            {
                ValidateContentPanel.Text += "  if (\"object\" == typeof Ektron && Ektron.ContentDesigner && Ektron.ContentDesigner.instances && (\"\" == errMessage || null == errMessage)) {" + "\r\n";
                ValidateContentPanel.Text += "      var teaserName = \"content_teaser\";" + "\r\n";
                ValidateContentPanel.Text += "      if (document.forms[0].response) {" + "\r\n";
                ValidateContentPanel.Text += "        var iTeaser = 0;" + "\r\n";
                ValidateContentPanel.Text += "        for (var i = 0; i < document.forms[0].response.length; i++) {" + "\r\n";
                ValidateContentPanel.Text += "            if (document.forms[0].response[i].checked) {" + "\r\n";
                ValidateContentPanel.Text += "                iTeaser = i;" + "\r\n";
                ValidateContentPanel.Text += "            }" + "\r\n";
                ValidateContentPanel.Text += "        }" + "\r\n";
                ValidateContentPanel.Text += "        switch (iTeaser) {" + "\r\n";
                ValidateContentPanel.Text += "            case 2: " + "\r\n";
                ValidateContentPanel.Text += "                teaserName = \"forms_transfer\";" + "\r\n";
                ValidateContentPanel.Text += "                break;" + "\r\n";
                ValidateContentPanel.Text += "            case 1:" + "\r\n";
                ValidateContentPanel.Text += "                teaserName = \"forms_redirect\";" + "\r\n";
                ValidateContentPanel.Text += "                break;" + "\r\n";
                ValidateContentPanel.Text += "            case 0:" + "\r\n";
                ValidateContentPanel.Text += "            default:" + "\r\n";
                ValidateContentPanel.Text += "                teaserName = \"content_teaser\";" + "\r\n";
                ValidateContentPanel.Text += "                break;" + "\r\n";
                ValidateContentPanel.Text += "        }" + "\r\n";
                ValidateContentPanel.Text += "      }" + "\r\n";
                ValidateContentPanel.Text += "      var objTeaserEditor = Ektron.ContentDesigner.instances[teaserName];" + "\r\n";
                ValidateContentPanel.Text += "      if (objTeaserEditor && \"function\" == typeof objTeaserEditor.validateContent){" + "\r\n";
                ValidateContentPanel.Text += "          errMessage = objTeaserEditor.validateContent();" + "\r\n";
                ValidateContentPanel.Text += "      }" + "\r\n";
                ValidateContentPanel.Text += "      if (errMessage != null && errMessage != \"\") {" + "\r\n";
                ValidateContentPanel.Text += "          if (\"object\" == typeof errMessage && \"undefined\" == typeof errMessage.code) {" + "\r\n";
                ValidateContentPanel.Text += "              alert(errMessage.join(\"\\n\\n\\n\"));" + "\r\n";
                ValidateContentPanel.Text += "		        return false;" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "          else if (\"object\" == typeof errMessage && \"string\" == typeof errMessage.msg) {" + "\r\n";
                ValidateContentPanel.Text += "		        errReason = errMessage.code;" + "\r\n";
                ValidateContentPanel.Text += "			    errAccess = true;" + "\r\n";
                ValidateContentPanel.Text += "              alert(\"Content is invalid.\" + \"\\n\\n\" + errMessage.msg);" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "          else if (\"string\" == typeof errMessage && errMessage.length > 0) {" + "\r\n";
                ValidateContentPanel.Text += "              alert(errMessage);" + "\r\n";
                ValidateContentPanel.Text += "		        return false;" + "\r\n";
                ValidateContentPanel.Text += "          }" + "\r\n";
                ValidateContentPanel.Text += "      }" + "\r\n";
                ValidateContentPanel.Text += "  }" + "\r\n";
            }
            ValidateContentPanel.Text += "if (errReason != 0 || errReasonT != 0) {" + "\r\n";
            ValidateContentPanel.Text += "	if (errReasonT != 0 && typeof objTeaserInstance != \"undefined\" && objTeaserInstance) {" + "\r\n";
            ValidateContentPanel.Text += "		errMessage = objTeaserInstance.event.message + \"\";" + "\r\n";
            ValidateContentPanel.Text += "	}" + "\r\n";
            ValidateContentPanel.Text += "	if (errReason != 0 && typeof objValidateInstance != \"undefined\" && objValidateInstance) {" + "\r\n";
            ValidateContentPanel.Text += "		errMessage = objValidateInstance.event.message + \"\";" + "\r\n";
            ValidateContentPanel.Text += "	}" + "\r\n";
            ValidateContentPanel.Text += "	if (false == errAccess) {" + "\r\n";
            ValidateContentPanel.Text += "		alert(errContent + \"\\n\"  + errMessage);" + "\r\n";
            ValidateContentPanel.Text += "		$ektron(document).trigger(\"wizardPanelShown\");" + "\r\n";
            ValidateContentPanel.Text += "		return false;" + "\r\n";
            ValidateContentPanel.Text += "	}" + "\r\n";
            ValidateContentPanel.Text += "	else {" + "\r\n";
            if ("2" == settings_data.Accessibility)
            {
                ValidateContentPanel.Text += " if (typeof Button != \"undefined\") {" + "\r\n";
                ValidateContentPanel.Text += "		if (\"publish\" == Button.toLowerCase() || \"submit\" == Button.toLowerCase()) {" + "\r\n";
                ValidateContentPanel.Text += "			alert(errContent);" + "\r\n";
                ValidateContentPanel.Text += "			$ektron(document).trigger(\"wizardPanelShown\");" + "\r\n";
                ValidateContentPanel.Text += "			return false;" + "\r\n";
                ValidateContentPanel.Text += "		}" + "\r\n";
                ValidateContentPanel.Text += "		else { " + "\r\n";
                ValidateContentPanel.Text += "			if (confirm(errContent + \"\\n\" + sInvalidContent)) {" + "\r\n";
                ValidateContentPanel.Text += "				return true;" + "\r\n";
                ValidateContentPanel.Text += "			} " + "\r\n";
                ValidateContentPanel.Text += "			else {" + "\r\n";
                ValidateContentPanel.Text += "			    $ektron(document).trigger(\"wizardPanelShown\");" + "\r\n";
                ValidateContentPanel.Text += "			    return false;" + "\r\n";
                ValidateContentPanel.Text += "			} " + "\r\n";
                ValidateContentPanel.Text += "		}" + "\r\n";
                ValidateContentPanel.Text += " }" + "\r\n";
            }
            else if ("1" == settings_data.Accessibility)
            {
                ValidateContentPanel.Text += " if (confirm(errContent + \"\\n\" + sInvalidContent)) {" + "\r\n";
                ValidateContentPanel.Text += "	return true;" + "\r\n";
                ValidateContentPanel.Text += " } " + "\r\n";
                ValidateContentPanel.Text += " else {$ektron(document).trigger(\"wizardPanelShown\"); return false;} " + "\r\n";
            }
            ValidateContentPanel.Text += "	}" + "\r\n";
            ValidateContentPanel.Text += "}" + "\r\n";
            //Change the action page
            FormAction = (string)("edit.aspx?close=" + Request.QueryString["close"] + "&LangType=" + m_intContentLanguage + "&content_id=" + m_refContentId + (this.TaxonomyOverrideId > 0 ? ("&TaxonomyId=" + this.TaxonomyOverrideId.ToString()) : "") + (this.TaxonomySelectId > 0 ? ("&SelTaxonomyId=" + this.TaxonomySelectId.ToString()) : "") + "&back_file=" + back_file + "&back_action=" + back_action + "&back_folder_id=" + back_folder_id + "&back_id=" + back_id + "&back_form_id=" + back_form_id + "&control=" + controlName + "&buttonid=" + buttonId.Value + "&back_LangType=" + back_LangType + back_callerpage + back_origurl);
            if (Request.QueryString["pullapproval"] != null)
            {
                FormAction += (string)("&pullapproval=" + Request.QueryString["pullapproval"]);
            }
            PostBackPage.Text = "<script>document.forms[0].action = \"" + FormAction + "\";";
            if (Utilities.IsAssetType(lContentType))
            {
                PostBackPage.Text += "document.forms[0].enctype = \"multipart/form-data\";";
            }

            PostBackPage.Text += "</script>";
            LoadingImg.Text = m_refMsg.GetMessage("one moment msg");

            content_title.Value = Server.HtmlDecode(m_strContentTitle);
            if (content_title.Attributes["class"] == null)
            {
                content_title.Attributes.Add("class", "");
            }
            if (lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
            {
                content_title.Attributes["class"] = "masterlayout";
                if (!(m_strType == "update"))
                {
                    content_title.Disabled = true;
                }
                phAlias.Visible = false;
                EditAliasHtml.Visible = false;
            }
            else
            {
                content_title.Attributes.Remove("class");
            }

            if (EnableMultilingual == 1)
            {
                lblLangName.Text = "[" + language_data.Name + "]";
            }
            StringBuilder sbFolderBreadcrumb = new StringBuilder();
            string strDisabled = "";
            if (!(m_strType == "update"))
            {
                QLink_Search.Text = "<td nowrap=\"nowrap\" class=\"checkboxIsSearchable\" >";
                QLink_Search.Text += "<input type=\"hidden\" name=\"AddQlink\" value=\"AddQlink\">";

                if (Request.Cookies[DMSCookieName] != null && Request.Cookies[DMSCookieName].Value == "2010")
                {
                    if (folder_data.IscontentSearchable)
                        QLink_Search.Text += "<input type=\"hidden\" name=\"IsSearchable\" value=\"IsSearchable\">";
                }
                else
                {
                if (security_data.IsAdmin)
                {
                    if (folder_data.IscontentSearchable)
                        QLink_Search.Text += "<input type=\"checkbox\" name=\"IsSearchable\" " + strDisabled + " checked value=\"IsSearchable\" >" + m_refMsg.GetMessage("lbl content searchable"); //m_refMsg.GetMessage("Content Searchable")
                    else
                        QLink_Search.Text += "<input type=\"checkbox\" name=\"IsSearchable\" " + strDisabled + " >" + m_refMsg.GetMessage("lbl content searchable"); //m_refMsg.GetMessage("Content Searchable")
                }
                else
                {
                        //Need to inherit from parent.
                        if (folder_data.IscontentSearchable)
                    QLink_Search.Text += "<input type=\"hidden\" name=\"IsSearchable\" value=\"IsSearchable\">";

                    }
                }
                QLink_Search.Text += "</td>";
            }
            else
            {
                TR_Properties.Visible = false;
                TR_Properties.Height = new Unit(0);
            }

            if (QLink_Search.Text != "")
            {
                QLink_Search.Text = "<table><tr>" + QLink_Search.Text + "</tr></table>";
            }
            content_id.Value = Convert.ToString(m_refContentId);
            eType.Value = m_strType;
            mycollection.Value = strMyCollection;
            addto.Value = strAddToCollectionType;
            content_folder.Value = Convert.ToString(m_intContentFolder);
            content_language.Value = Convert.ToString(intContentLanguage);
            maxcontentsize.Value = iMaxContLength.ToString();
            if (bVer4Editor)
            {
                Ver4Editor.Value = "true";
            }
            else
            {
                Ver4Editor.Value = "false";
            }
            createtask.Value = Request.QueryString["dontcreatetask"];

            EnumeratedHiddenFields.Text = HideVariables();
            eWebEditProJS.Text = EditProJS();

            if (m_intContentType == 2)
            {
                divContentText.Text = m_refMsg.GetMessage("form text");
                divSummaryText.Text = m_refMsg.GetMessage("postback text");
            }
            else
            {
                divContentText.Text = m_refMsg.GetMessage("content text");
                divSummaryText.Text = m_refMsg.GetMessage("Summary text");
            }

            phMetadata.Visible = true;
            if (this.Request.QueryString["type"] == "update")
            {
                aliasContentType = this.content_edit_data.ContType.ToString();
            }

            if ((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias) && Request.QueryString["type"] != "multiple,add" && lContentSubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And Not (m_bIsBlog)
            {
                if ((content_edit_data != null) && (content_edit_data.AssetData != null) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_edit_data.AssetData.FileExtension)))
                {
                    phAlias.Visible = false;
                    EditAliasHtml.Visible = false;
                }
                else
                {
                    phAlias.Visible = true;
                    EditAliasHtml.Visible = true;
                }
            }
            EditContentHtmlScripts();
            EditSummaryHtmlScripts();
            EditMetadataHtmlScripts();
            EditAliasHtmlScripts();
            EditScheduleHtmlScripts();
            EditCommentHtmlScripts();
            EditSubscriptionHtmlScripts();
            EditSelectedTemplate();
            EditTaxonomyScript();

            if (eWebEditProPromptOnUnload == 1)
            {
                jsActionOnUnload.Text = "eWebEditPro.actionOnUnload = EWEP_ONUNLOAD_PROMPT;";
            }

            if (Convert.ToString(m_intContentFolder) != "")
            {
                defaultFolderId.Text = m_intContentFolder.ToString();
            }
            else
            {
                defaultFolderId.Text = "0";
            }

            //Summary_Meta_win
            if (!String.IsNullOrEmpty(Request.QueryString["summary"]))
            {
                Summary_Meta_Win.Text = "<script language=\"JavaScript1.2\">";
                Summary_Meta_Win.Text += "PopUpWindow(\'editsummaryarea.aspx?id=" + m_intItemId + "&LangType=" + m_intContentLanguage + "&editor=true\',\'Summary\',790,580,1,1);";
                Summary_Meta_Win.Text += "</script>";
            }
            if (!String.IsNullOrEmpty(Request.QueryString["meta"]))
            {
                Summary_Meta_Win.Text += "<script language=\"JavaScript1.2\">";
                if (MetaDataNumber > 0)
                {
                    Summary_Meta_Win.Text += "PopUpWindow(\'editmeta_dataarea.aspx?id=" + m_intItemId + "&LangType=" + m_intContentLanguage + "&editor=true\',\'Metadata\',790,580,1,1);";

                }
                else
                {
                    Summary_Meta_Win.Text += "alert(\'No metadata defined\');  ";
                }
                Summary_Meta_Win.Text += "</script>";
            }
            //TAXONOMY DATA
            if (IsAdmin || m_refContApi.EkUserRef.IsARoleMember(Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator), CurrentUserID, false))
            {
                TaxonomyRoleExists = true;
            }
            TaxonomyBaseData[] taxonomy_cat_arr = null;
            if (m_strType != "add" && m_strType != "multiple" && (!(m_strType.IndexOf("add", System.StringComparison.InvariantCultureIgnoreCase) > 0 || m_strType.IndexOf("multiple", System.StringComparison.InvariantCultureIgnoreCase) > 0)) || (m_strType == "add" && m_refContentId > 0))
            {
                int tmpLang = 1033;
                int originalLangID = 1033;
                if (m_strType == "add" && m_refContentId > 0) //New Language
                {
                    if (!(Request.QueryString["con_lang_id"] == null) && Request.QueryString["con_lang_id"] != "")
                    {
                        originalLangID = Convert.ToInt32(Request.QueryString["con_lang_id"]);
                    }
                    tmpLang = m_refContent.RequestInformation.ContentLanguage; //Backup the current langID
                    m_refContent.RequestInformation.ContentLanguage = originalLangID;
                    taxonomy_cat_arr = m_refContent.ReadAllAssignedCategory(m_refContentId);
                    m_refContent.RequestInformation.ContentLanguage = tmpLang;
                }
                else
                {
                    taxonomy_cat_arr = m_refContent.ReadAllAssignedCategory(m_intItemId);
                }
                if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                {
                    foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                    {
                        if (taxonomy_cat.LanguageId == 0 || taxonomy_cat.LanguageId == m_refContent.RequestInformation.ContentLanguage)
                        {
                            if (taxonomyselectedtree.Value == "")
                            {
                                taxonomyselectedtree.Value = Convert.ToString(taxonomy_cat.Id);
                            }
                            else
                            {
                                taxonomyselectedtree.Value = taxonomyselectedtree.Value + "," + Convert.ToString(taxonomy_cat.Id);
                            }
                        }
                    }
                }
                TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
                if (TaxonomyTreeIdList.Trim().Length > 0)
                {
                    if (m_strType == "add" && m_refContentId > 0) //New Language
                    {
                        m_refContent.RequestInformation.ContentLanguage = originalLangID; //Backup the current LangID
                        TaxonomyTreeParentIdList = m_refContent.ReadDisableNodeList(m_refContentId);
                        m_refContent.RequestInformation.ContentLanguage = tmpLang;
                    }
                    else
                    {
                        TaxonomyTreeParentIdList = m_refContent.ReadDisableNodeList(m_intItemId);
                    }
                }
            }
            else
            {
                if (TaxonomySelectId > 0)
                {
                    taxonomyselectedtree.Value = TaxonomySelectId.ToString();
                    TaxonomyTreeIdList = (string)taxonomyselectedtree.Value;
                    taxonomy_cat_arr = m_refContent.GetTaxonomyRecursiveToParent(TaxonomySelectId, m_refContent.RequestInformation.ContentLanguage, 0);
                    if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0)
                    {
                        foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr)
                        {
                            if (TaxonomyTreeParentIdList == "")
                            {
                                TaxonomyTreeParentIdList = Convert.ToString(taxonomy_cat.Id);
                            }
                            else
                            {
                                TaxonomyTreeParentIdList = TaxonomyTreeParentIdList + "," + Convert.ToString(taxonomy_cat.Id);
                            }
                        }
                    }
                }
            }

            TaxonomyRequest taxonomy_request = new TaxonomyRequest();
            TaxonomyBaseData[] taxonomy_data_arr = null;
            Utilities.SetLanguage(m_refContApi);
            taxonomy_request.TaxonomyId = m_intContentFolder;
            taxonomy_request.TaxonomyLanguage = m_refContApi.ContentLanguage;
            taxonomy_data_arr = m_refContent.GetAllFolderTaxonomy(m_intContentFolder);
            bool HideCategoryTab = false;
            if (Request.QueryString["HideCategoryTab"] != null)
            {
                HideCategoryTab = Convert.ToBoolean(Request.QueryString["HideCategoryTab"]);
            }
            if (HideCategoryTab || (taxonomy_data_arr == null || taxonomy_data_arr.Length == 0) && (TaxonomyOverrideId == 0))
            {
                if (!HideCategoryTab && folder_data != null && folder_data.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog) && TaxonomySelectId > 0 && m_intTaxFolderId == folder_data.Id && TaxonomyTreeIdList.Trim().Length > 0)
                {
                    m_intTaxFolderId = 0;
                }
                else
                {
                    phTaxonomy.Visible = false;
                    EditTaxonomyHtml.Visible = false;
                    DisplayTab = false;
                    taxonomyselectedtree.Value = taxonomy_cat_arr != null && taxonomy_cat_arr.Length > 0 && (taxonomy_cat_arr[0].LanguageId == 0 | taxonomy_cat_arr[0].LanguageId == m_refContent.RequestInformation.ContentLanguage) ? taxonomyselectedtree.Value : "";
                }
            }

            //CALL THE TOOLBAR
            if (folder_data == null)
            {
                LoadToolBar("");
            }
            else
            {
                LoadToolBar(folder_data.Name);
            }

            if (lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
            {
                WebEventCont.Text = "true";
                phContent.Visible = false;
                phEditContent.Visible = false;
            }
            //-------------------DisplayTabs Based on selected options from Folder properties----------------------------------
            if (((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) == (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) && folder_data.DisplaySettings != 0)
            {
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Summary) == (int)EkEnumeration.FolderTabDisplaySettings.Summary)
                { phEditSummary.Visible = true; }
                else
                {
                    if (Request.QueryString["form_type"] == null && Request.QueryString["back_form_id"] == null && Request.QueryString["form_id"] == null && m_bIsBlog != true)
                    {
                        phEditSummary.Visible = false;
                        phSummary.Visible = false;
                    }
                }
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.MetaData) == (int)EkEnumeration.FolderTabDisplaySettings.MetaData)
                {if(phMetadata.Visible)
                    phMetadata.Visible = true; }
                else
                {
                    if (!metadataRequired)
                        phMetadata.Visible = false;
                }
                if ((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias) && Request.QueryString["type"] != "multiple,add" && lContentSubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And Not (m_bIsBlog)
                {
                    if (!((content_edit_data != null) && (content_edit_data.AssetData != null) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_edit_data.AssetData.FileExtension))))
                    {
                        if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) == (int)EkEnumeration.FolderTabDisplaySettings.Aliasing)
                        { phAlias.Visible = true; }
                        else
                        {
                            if (!folder_data.AliasRequired)
                                phAlias.Visible = false;
                        }
                    }
                }
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Schedule) == (int)EkEnumeration.FolderTabDisplaySettings.Schedule)
                { PhSchedule.Visible = true; }
                else
                {
                    PhSchedule.Visible = false;
                }
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Comment) == (int)EkEnumeration.FolderTabDisplaySettings.Comment)
                { PhComment.Visible = true; }
                else
                {
                    PhComment.Visible = false;
                }
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Templates) == (int)EkEnumeration.FolderTabDisplaySettings.Templates)
                { phTemplates.Visible = true; }
                else
                {
                    phTemplates.Visible = false;
                }
                if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) == (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy)
                { if(phTaxonomy.Visible)
                    phTaxonomy.Visible = true; }
                else
                {
                    if (!folder_data.IsCategoryRequired)
                        phTaxonomy.Visible = false;
                }
            }

            //-------------------DisplayTabs Based on selected options from Folder properties End------------------------------
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
Пример #2
0
    private void GetQueryStringValues()
    {
        _PageAction = (string)(this.GetQueryStringValue("action").ToLower().Trim());
        _From = (string)(this.GetQueryStringValue("from").ToLower().Trim());
        _OrderBy = this.GetQueryStringValue("orderby");
        _TreeViewId = Request.QueryString["treeViewId"];

        string pagingCurrentPageNumber = this.GetQueryStringValue("currentpage");
        pagingCurrentPageNumber = (string)(pagingCurrentPageNumber == string.Empty ? "1" : pagingCurrentPageNumber);
        int.TryParse(pagingCurrentPageNumber, out _PagingCurrentPageNumber); //_PagingCurrentPageNumber = Convert.ToInt32(pagingCurrentPageNumber)

        string id = this.GetQueryStringValue("id");
        id = (string)((id == string.Empty || id.ToLower() == "undefined") ? "0" : id);
        _Id = Convert.ToInt64(id);

        string contentId = this.GetQueryStringValue("contentid");
        contentId = (string)(contentId == string.Empty ? "0" : contentId);
        _ContentId = Convert.ToInt64(contentId);

        _ContentTypeQuerystringParam = this.GetQueryStringValue(_ContentTypeUrlParam.ToString());
        if (_ContentTypeQuerystringParam != string.Empty)
        {
            if (Information.IsNumeric(_ContentTypeQuerystringParam))
            {
                _ContentTypeSelected = _ContentTypeUrlParam.ToString();
                _ContentTypeSelected = Convert.ToString(_ContentTypeQuerystringParam);
                _ContentApi.SetCookieValue(_ContentTypeUrlParam.ToString(), _ContentTypeQuerystringParam);
            }
            else if (_ContentTypeQuerystringParam.Length > 2 && _ContentTypeQuerystringParam.Substring(0, 3) == "14_")
            {
                _ContentTypeSelected = "14";
                _XmlConfigID = int.Parse(_ContentTypeQuerystringParam.Substring(3, _ContentTypeQuerystringParam.Length - 3));
                _ContentApi.SetCookieValue(_XmlConfigType, Convert.ToString(_XmlConfigID));
            }
        }
        else if (Ektron.Cms.CommonApi.GetEcmCookie()[_ContentTypeUrlParam] != "")
        {
            if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[_ContentTypeUrlParam]))
            {
                _ContentTypeSelected = Convert.ToString(Ektron.Cms.CommonApi.GetEcmCookie()[_ContentTypeUrlParam]);
            }
        }

        string contentSubTypeSelected = Request.QueryString["SubType"];
        if (contentSubTypeSelected == string.Empty)
        {
            contentSubTypeSelected = (string)(Ektron.Cms.CommonApi.GetEcmCookie()["SubType"]);
        }
        else
        {
            _ContentApi.SetCookieValue("SubType", contentSubTypeSelected);
        }

        if (contentSubTypeSelected == String.Empty)
        {
            _ContentSubTypeSelected = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes;
        }
        else
        {
            switch (Convert.ToInt32(contentSubTypeSelected))
            {
                case 1://Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData
                    // this is a Page Layout
                    _ContentSubTypeSelected = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData;
                    break;
                case 3://Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData
                    // this is a Master Page Layout
                    _ContentSubTypeSelected = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData;
                    break;
                case 2:// Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent:
                    // this is a web event, which indicates this is a Calendar Event entry
                    _ContentSubTypeSelected = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent;
                    break;
                default:
                    _ContentSubTypeSelected = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content;
                    break;
            }
        }
    }
Пример #3
0
    private void Process_FormSubmit()
    {
        object dontCreateTask;
        int i = 0;
        int y = 0;
        int isub = 0;
        int ValidCounter = 0;
        string go_live = "";
        string end_date = "";
        string end_date_action = "";
        string strContent = "";
        string strSearchText = "";
        bool ret = false;
        string strTaskName = "";
        bool isAlreadyCreated = false;
        SettingsData site_data;
        Collection page_subscription_data = new Collection();
        Collection page_sub_temp = new Collection();
        Array arrSubscriptions;
        SubscriptionPropertiesData sub_prop_data = new SubscriptionPropertiesData();
        string strContentTeaser = "";
        string strRptDisplay = "";
        string strRpt = "";
        bool bUpdateFormQuestions = false;
        bool bIsReportForm = false;
        bool bLockedContentLink = false;
        string strContentTitle = Request.Form["content_title"];
        string strTextFromDesigner = string.Empty;
        EkEnumeration.CMSContentSubtype subtype = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes;

        try
        {

            dontCreateTask = Request.Form["createtask"];
            m_strType = Request.Form["eType"];

            if ("ContentDesigner" == m_SelectedEditControl)
            {
                string strResponse = Request.Form["response"];
                switch (strResponse)
                {
                    case "message":
                        string strFormDesign;
                        string strXsltDesign;
                        string strFieldList;
                        string strViewXslt;
                        strFormDesign = (string)m_ctlContentDesigner.Content;
                        strXsltDesign = (string)m_ctlSummaryDesigner.Content;
                        strFieldList = m_refContApi.TransformXsltPackage(strFormDesign, Server.MapPath((string)(m_ctlSummaryDesigner.ScriptLocation + "DesignToFieldList.xslt")), true);

                        System.Xml.Xsl.XsltArgumentList objXsltArgs = new System.Xml.Xsl.XsltArgumentList();
                        objXsltArgs.AddParam("srcPath", "", m_ctlSummaryDesigner.ScriptLocation);

                        strViewXslt = m_refContApi.XSLTransform("<root>" + strXsltDesign + "<ektdesignpackage_list>" + strFieldList + "</ektdesignpackage_list></root>", Server.MapPath((string)(m_ctlSummaryDesigner.ScriptLocation + "DesignToViewXSLT.xslt")), true, false, objXsltArgs, false);
                        StringBuilder sbFormResponse = new StringBuilder();
                        sbFormResponse.Append("<ektdesignpackage_forms><ektdesignpackage_form><ektdesignpackage_designs><ektdesignpackage_design>");
                        sbFormResponse.Append(strXsltDesign);
                        sbFormResponse.Append("</ektdesignpackage_design></ektdesignpackage_designs><ektdesignpackage_lists><ektdesignpackage_list>");
                        sbFormResponse.Append(strFieldList);
                        sbFormResponse.Append("</ektdesignpackage_list></ektdesignpackage_lists><ektdesignpackage_views><ektdesignpackage_view></ektdesignpackage_view><ektdesignpackage_view>");
                        sbFormResponse.Append(strViewXslt);
                        sbFormResponse.Append("</ektdesignpackage_view></ektdesignpackage_views></ektdesignpackage_form></ektdesignpackage_forms>");
                        strContentTeaser = sbFormResponse.ToString();
                        break;
                    case "redirect":
                        strContentTeaser = (string)m_ctlFormResponseRedirect.Content;
                        break;
                    case "transfer":
                        strContentTeaser = (string)m_ctlFormResponseTransfer.Content;
                        break;
                    default:
                        strContentTeaser = (string)m_ctlSummaryDesigner.Content;
                        break;
                }
            }
            else
            {
                strContentTeaser = Request.Form["content_teaser"];
            }

            strRptDisplay = Request.Form["report_display_type"]; // Same Window = 1 and New Window = 0
            if (!string.IsNullOrEmpty(strRptDisplay) && strRptDisplay.Substring(0, 1) == ",")
            {
                strRptDisplay = strRptDisplay.Substring(strRptDisplay.Length - (strRptDisplay.Length - 1));
            }
            strRpt = Request.Form["report_type"]; // Data Table = 1, Bar Chart = 2, Pie Chart = 3 and Combined = 4
            if (!string.IsNullOrEmpty(strRpt) && strRpt.Substring(0, 1) == ",")
            {
                strRpt = strRpt.Substring(strRpt.Length - (strRpt.Length - 1));
            }
            if (strRptDisplay == "1")
            {
                strRptDisplay = "_self";
            }
            else
            {
                strRptDisplay = "_blank";
            }

            if (Request.Form["response"] == "report")
            {
                bIsReportForm = true;
                strContentTeaser = "<root><EktReportFormData/><RedirectionLink>";
                strContentTeaser = strContentTeaser + "<a href=\"poll.aspx\" id=\"" + strRpt + "\"";
                strContentTeaser = strContentTeaser + " target = \"" + strRptDisplay + "\"";
                strContentTeaser = strContentTeaser + "></a>";
                strContentTeaser = strContentTeaser + "</RedirectionLink></root>";
            }

            object[] acMetaInfo = new object[4];
            object MetaSelect;
            object MetaSeparator;
            string MetaTextString = "";
            if (!string.IsNullOrEmpty(Request.Form["frm_validcounter"]))
            {
                ValidCounter = System.Convert.ToInt32(Request.Form["frm_validcounter"]);
            }
            else
            {
                ValidCounter = 0;
            }

            page_meta_data = new Collection();
            for (i = 1; i <= ValidCounter; i++)
            {
                acMetaInfo[1] = Request.Form["frm_meta_type_id_" + i];
                acMetaInfo[2] = Request.Form["content_id"];
                MetaSeparator = Request.Form["MetaSeparator_" + i];
                MetaSelect = Request.Form["MetaSelect_" + i];
                if (String.IsNullOrEmpty(MetaSelect.ToString()))
                {
                    MetaTextString = Strings.Replace(Request.Form["frm_text_" + i], ", ", MetaSeparator.ToString(), 1, -1, 0);
                    if (MetaTextString.ToString().Substring(0, 1) == MetaSeparator.ToString())
                    {
                        MetaTextString = MetaTextString.Substring(MetaTextString.Length - (MetaTextString.Length - 1), (MetaTextString.Length - 1));
                    }

                    acMetaInfo[3] = MetaTextString;
                }
                else
                {
                    myMeta = Request.Form["frm_text_" + i];
                    myMeta = Server.HtmlDecode(myMeta);
                    MetaTextString = myMeta.Replace(";", MetaSeparator.ToString());
                    myMeta = EkFunctions.HtmlEncode(MetaTextString);
                    acMetaInfo[3] = MetaTextString;
                }
                page_meta_data.Add(acMetaInfo, i.ToString(), null, null);
                acMetaInfo = new object[4];
            }

            if (!string.IsNullOrEmpty(Request.Form["isblogpost"])) //isblogpost
            {
                i++;
                acMetaInfo[1] = Request.Form["blogposttagsid"];
                acMetaInfo[2] = Request.Form["content_id"];
                MetaSeparator = ";";
                acMetaInfo[3] = Request.Form["blogposttags"];
                page_meta_data.Add(acMetaInfo, i.ToString(), null, null);
                acMetaInfo = new object[4];

                i++;
                acMetaInfo[1] = Request.Form["blogpostcatid"];
                acMetaInfo[2] = Request.Form["content_id"];
                MetaSeparator = ";";
                if (Convert.ToInt32(Request.Form["blogpostcatlen"]) > 0)
                {
                    MetaTextString = "";
                    for (y = 0; y <= Convert.ToInt32(Request.Form["blogpostcatlen"]); y++)
                    {
                        if (!String.IsNullOrEmpty(Request.Form["blogcategories" + y.ToString()]))
                        {
                            MetaTextString += (string)(Strings.Replace(Request.Form["blogcategories" + y.ToString()], ";", "~@~@~", 1, -1, 0) + ";");
                        }
                    }
                    if (MetaTextString.ToString().EndsWith(";"))
                    {
                        MetaTextString = MetaTextString.Substring(0, (MetaTextString.Length - 1));
                    }
                    acMetaInfo[3] = MetaTextString;
                }
                else
                {
                    acMetaInfo[3] = "";
                }
                page_meta_data.Add(acMetaInfo, i.ToString(), null, null);
                acMetaInfo = new object[4];

                i++;
                acMetaInfo[1] = Request.Form["blogposttrackbackid"];
                acMetaInfo[2] = Request.Form["content_id"];
                MetaSeparator = ";";
                acMetaInfo[3] = Request.Form["trackback"];
                page_meta_data.Add(acMetaInfo, i.ToString(), null, null);
                acMetaInfo = new object[4];

                i++;
                acMetaInfo[1] = Request.Form["blogpostchkpingbackid"];
                acMetaInfo[2] = Request.Form["content_id"];
                MetaSeparator = ";";
                if (!String.IsNullOrEmpty(Request.Form["chkpingback"]))
                {
                    acMetaInfo[3] = 1;
                }
                else
                {
                    acMetaInfo[3] = 0;
                }
                page_meta_data.Add(acMetaInfo, i.ToString(), null, null);
                acMetaInfo = new object[4];
            }

            sub_prop_data.BreakInheritance = true;
            if (!String.IsNullOrEmpty(Request.Form["send_notification_button"]))
            {
                sub_prop_data.SendNextNotification = true;
                sub_prop_data.SuspendNextNotification = false;
            }
            else
            {
                sub_prop_data.SendNextNotification = false;
            }
            if (Request.Form["notify_option"] == ("Always"))
            {
                sub_prop_data.NotificationType = Ektron.Cms.Common.EkEnumeration.SubscriptionPropertyNotificationTypes.Always;
            }
            else if (Request.Form["notify_option"] == ("Initial"))
            {
                sub_prop_data.NotificationType = Ektron.Cms.Common.EkEnumeration.SubscriptionPropertyNotificationTypes.Initial;
                if (!(m_strType == "update")) // if new, then set flag to email out
                {
                    sub_prop_data.SendNextNotification = true;
                    sub_prop_data.SuspendNextNotification = false;
                }
                else
                {
                    if (!String.IsNullOrEmpty(Request.Form["send_notification_button"]))
                    {
                        sub_prop_data.SendNextNotification = true;
                        sub_prop_data.SuspendNextNotification = false;
                    }
                    else
                    {
                        sub_prop_data.SendNextNotification = false;
                    }
                }
            }
            else if (Request.Form["notify_option"] == ("Never"))
            {
                sub_prop_data.NotificationType = Ektron.Cms.Common.EkEnumeration.SubscriptionPropertyNotificationTypes.Never;
            }
            if (!String.IsNullOrEmpty(Request.Form["suspend_notification_button"]))
            {
                sub_prop_data.SuspendNextNotification = true;
                sub_prop_data.SendNextNotification = false;
            }
            else
            {
                sub_prop_data.SuspendNextNotification = false;
            }
            sub_prop_data.OptOutID = Convert.ToInt64(Request.Form["notify_optoutid"]);
            if (!String.IsNullOrEmpty(Request.Form["use_message_button"]))
            {
                sub_prop_data.DefaultMessageID = Convert.ToInt64(Request.Form["notify_messageid"]);
            }
            else
            {
                sub_prop_data.DefaultMessageID = 0;
            }
            if (!String.IsNullOrEmpty(Request.Form["use_summary_button"]))
            {
                sub_prop_data.SummaryID = 1;
            }
            else
            {
                sub_prop_data.SummaryID = 0;
            }
            if (!String.IsNullOrEmpty(Request.Form["use_content_button"]))
            {
                sub_prop_data.ContentID = Convert.ToInt64(Request.Form["frm_content_id"]);
            }
            else
            {
                sub_prop_data.ContentID = 0;
            }
            sub_prop_data.UnsubscribeID = Convert.ToInt64(Request.Form["notify_unsubscribeid"]);

            if (!String.IsNullOrEmpty(Request.Form["notify_url"]))
            {
                sub_prop_data.URL = Request.Form["notify_url"];
            }
            else
            {
                sub_prop_data.URL = Request.ServerVariables["HTTP_HOST"];
            }

            if (!String.IsNullOrEmpty(Request.Form["notify_weblocation"]))
            {
                sub_prop_data.FileLocation = Server.MapPath(m_refContApi.AppPath + "subscriptions");
            }
            else
            {
                sub_prop_data.FileLocation = Server.MapPath(m_refContApi.AppPath + "subscriptions");
            }
            if (!String.IsNullOrEmpty(Request.Form["notify_weblocation"]))
            {
                sub_prop_data.WebLocation = Request.Form["notify_weblocation"];
            }
            else
            {
                sub_prop_data.WebLocation = "subscriptions";
            }
            if (!String.IsNullOrEmpty(Request.Form["notify_subject"]))
            {
                sub_prop_data.Subject = Request.Form["notify_subject"];
            }
            else
            {
                sub_prop_data.Subject = "";
            }
            if (!String.IsNullOrEmpty(Request.Form["notify_emailfrom"]))
            {
                sub_prop_data.EmailFrom = Request.Form["notify_emailfrom"];
            }
            else
            {
                sub_prop_data.EmailFrom = "";
            }

            sub_prop_data.UseContentTitle = "";

            if (!String.IsNullOrEmpty(Request.Form["use_contentlink_button"]))
            {
                sub_prop_data.UseContentLink = 1;
            }
            else
            {
                sub_prop_data.UseContentLink = 0;
            }

            if (!String.IsNullOrEmpty(Request.Form["content_sub_assignments"]))
            {
                arrSubscriptions = Strings.Split(Strings.Trim(Request.Form["content_sub_assignments"]), " ", -1, 0);
                if (arrSubscriptions.Length > 0)
                {
                    for (isub = 0; isub <= (arrSubscriptions.Length - 1); isub++)
                    {
                        page_sub_temp = new Collection();
                        page_sub_temp.Add(Int64.Parse(Strings.Mid(arrSubscriptions.GetValue(isub).ToString(), 10)), "ID", null, null);
                        page_subscription_data.Add(page_sub_temp, null, null, null);
                    }
                }
            }
            else
            {
                page_subscription_data = null;
            }
            page_sub_temp = null;

            if (!String.IsNullOrEmpty(Request.Form["go_live"]))
            {
                go_live = DateTime.Parse(Strings.Trim(Request.Form["go_live"])).ToString();
            }
            if (!String.IsNullOrEmpty(Request.Form["end_date"]))
            {
                end_date = DateTime.Parse(Strings.Trim(Request.Form["end_date"])).ToString();
                end_date_action = Request.Form["end_date_action_radio"];
            }
            lContentType = Convert.ToInt32(Request.Form["content_type"]);
            switch (Request.Form["content_subtype"].ToLower())
            {
                case "content":
                    {
                         lContentSubType = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content ;
                         break;
                    }
                case "pagebuilderdata":
                    {
                        lContentSubType = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData  ;
                        break;
                    }
                case "webevent":
                    {
                        lContentSubType = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent  ;
                        break;
                    }
                case "pagebuildermasterdata":
                    {
                        lContentSubType = Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData  ;
                        break;
                    }
                default:
                    {
                        lContentSubType = EkEnumeration.CMSContentSubtype.AllTypes;
                        break;
                    }

            }
            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                asset_info.Add(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i], Strings.Trim(Request.Form["asset_" + Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i].ToString().ToLower()]));
            }

            page_content_data = new Collection();
            if (!String.IsNullOrEmpty(Request.Form["content_id"]))
            {
                page_content_data.Add(Request.Form["content_id"], "ContentID", null, null);
            }
            else
            {
                page_content_data.Add(0, "ContentID", null, null);
            }
            page_content_data.Add(Request.Form["content_language"], "ContentLanguage", null, null);

            if ((lContentType == 1 || lContentType == 3) && (lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent))
            {

                ContentData cb;
                if (m_strType == "add")
                {
                    if (!String.IsNullOrEmpty(Request.QueryString["back_LangType"]))
                    {
                        m_refContApi.ContentLanguage = Convert.ToInt32(Request.QueryString["back_LangType"]);
                    }
                    else
                    {
                        m_refContApi.ContentLanguage = m_refContApi.RequestInformationRef.DefaultContentLanguage;
                    }
                    cb = m_refContApi.GetContentById(Convert.ToInt64(Request.Form["content_id"]), Ektron.Cms.ContentAPI.ContentResultType.Published);
                    m_refContApi.ContentLanguage = m_intContentLanguage;
                }
                else
                {
                    cb = m_refContApi.GetContentById(Convert.ToInt64(Request.Form["content_id"]), Ektron.Cms.ContentAPI.ContentResultType.Staged);
                }
                if (cb != null)
                {
                    subtype = cb.SubType;
                    if (subtype == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || subtype == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || subtype == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
                    {
                        strContent = cb.Html;
                        if (strContentTitle == null)
                        {
                            strContentTitle = cb.Title;
                        }
                        strSearchText = strContentTeaser;
                        page_content_data.Add(subtype, "ContentSubType", null, null);
                    }
                }
            }
            if ("ContentDesigner" == m_SelectedEditControl && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
            {
                strContent = (string)m_ctlContentDesigner.Content;
                if (string.IsNullOrEmpty(strContent) && !string.IsNullOrEmpty(Request.Form["xid"]))
                {
                    strContent = "<root></root>";	   //only for smart form content
                }
                strSearchText = (string)m_ctlContentDesigner.Text;
                strTextFromDesigner = strSearchText;
            }
            else
            {
                if (subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
                {
                    i = 1;
                    while (Strings.Len(Request.Form["hiddencontent" + i]) > 0)
                    {
                        strContent = strContent + Request.Form["hiddencontent" + i];
                        i++;
                    }
                    i = 1;
                    while (Strings.Len(Request.Form["searchtext" + i]) > 0)
                    {
                        strSearchText = strSearchText + Request.Form["searchtext" + i];
                        i = System.Convert.ToInt32(i + 1);
                    }
                }
            }

            page_content_data.Add(lContentType, "ContentType", null, null);
            if (IsMac && !IsBrowserIE && m_SelectedEditControl != "ContentDesigner")
            {
                //Ephox outputs entity name &nbsp; which causes error in Import/Export utility.
                //If we finde more entity name being used we should use code snippet from the eWebEditPro to clean.
                strContent = strContent.Replace("&nbsp;", "&#160;");
            }
            if ((asset_info != null) && (lContentType == Ektron.Cms.Common.EkConstants.CMSContentType_Media))
            {
                strContent = Request.Form["content_html"];
                page_content_data.Add(strContent, "MediaText", null, null);
            }
            if (subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
            {
                strContent = Utilities.WikiQLink(strContent, Convert.ToInt64(Request.Form["content_folder"]));
            }

            if (subtype == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
            {
                //we need to update the inner title to match this title, so we deserialize the event, update the field, and reserialize
                System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(Ektron.Cms.Content.Calendar.EventPersistence.root));
                System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(strContent, System.Xml.XmlNodeType.Document, null);
                Ektron.Cms.Content.Calendar.EventPersistence.root ev;
                ev = (Ektron.Cms.Content.Calendar.EventPersistence.root)xs.Deserialize(reader);

                ev.DisplayTitle = strContentTitle;

                System.IO.MemoryStream stream = new System.IO.MemoryStream();
                System.Xml.XmlWriterSettings writersettings = new System.Xml.XmlWriterSettings();
                writersettings.OmitXmlDeclaration = true;

                using (System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(stream, writersettings))
                {
                    xs.Serialize(xmlWriter, ev);
                }

                stream.Flush();
                stream.Position = 0;
                System.IO.StreamReader streamreader = new System.IO.StreamReader(stream);
                strContent = streamreader.ReadToEnd();
            }

            page_content_data.Add(strContent, "ContentHtml", null, null);
            if (m_strType != "update" || (strContentTeaser.ToLower() == "<br /><!-- wiki summary -->"))
            {
                string strippedTeaser = Utilities.StripHTML(strContentTeaser);
                if ((lContentType == 1 || lContentType == 3) && (subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData && subtype != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent))
                {
                    if (Request.Form["xid"] == null && (strContentTeaser.IndexOf("<img") == -1 && (strippedTeaser == "" || strippedTeaser == "&#160;" || strippedTeaser == "&nbsp;" || (strippedTeaser.ToLower() == "<!-- wiki summary -->"))))
                    {
                        if (strTextFromDesigner != string.Empty)
                        {
                            strContentTeaser = strTextFromDesigner;
                        }
                        else
                        {
                            strContentTeaser = Utilities.AutoSummary(strContent);
                        }
                        if (strContentTeaser != "")
                        {
                            strContentTeaser = "<p>" + strContentTeaser + "</p>";
                        }
                    }
                }
            }
            if ((Request.Form["chkLockedContentLink"] != null) && Request.Form["chkLockedContentLink"] == "on")
            {
                bLockedContentLink = true;
            }
            page_content_data.Add(bLockedContentLink, "LockedContentLink", null, null);
            page_content_data.Add(Request.Form["content_comment"], "Comment", null, null);
            page_content_data.Add(page_meta_data, "ContentMetadata", null, null);
            page_content_data.Add(strContentTeaser, "ContentTeaser", null, null);
            page_content_data.Add(Request.Form["content_folder"], "FolderID", null, null);

            page_content_data.Add(strSearchText, "SearchText", null, null);
            page_content_data.Add(go_live, "GoLive", null, null);
            page_content_data.Add(end_date, "EndDate", null, null);
            page_content_data.Add(end_date_action, "EndDateAction", null, null);
            int nAssetInfoArrayLBound = 0;
            int nAssetInfoArrayUBound = -1;
            int j = 1;
            string strAssetInfo = "";
            Array aryAssetInfoValue;
            int nArrayLBound;
            int nArrayUBound;
            Hashtable cAssetInfoArray = new Hashtable();
            string strKeyName = "";
            for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
            {
                strKeyName = Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i];
                strAssetInfo = Convert.ToString(asset_info[Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]]);
                page_content_data.Add(strAssetInfo.Replace("%2C", ","), strKeyName, null, null);
                if (0 == strAssetInfo.Length && nAssetInfoArrayUBound > nAssetInfoArrayLBound)
                {
                    // This information is not provided at all, so it's not inconsistent.
                    strAssetInfo = "";
                    for (j = 1; j <= nAssetInfoArrayUBound - nAssetInfoArrayLBound; j++)
                    {
                        strAssetInfo += ",";
                    }

                }
                //' Append a space so that an empty string will produce an array of one item
                //' rather than an array with no items. The value will be Trimmed later to
                //' remove the space.
                aryAssetInfoValue = (strAssetInfo + " ").Split(',');

                nArrayLBound = 0;
                nArrayUBound = aryAssetInfoValue.Length - 1;
                if (i == 0)
                {
                    nAssetInfoArrayLBound = System.Convert.ToInt32(nArrayLBound);
                    nAssetInfoArrayUBound = System.Convert.ToInt32(nArrayUBound);
                }
                if (nAssetInfoArrayLBound == nArrayLBound && nAssetInfoArrayUBound == nArrayUBound)
                {
                    cAssetInfoArray.Add(strKeyName, aryAssetInfoValue);
                }
                else
                {
                    Response.Redirect((string)("reterror.asp?info=" + EkFunctions.UrlEncode((string)("Inconsistent number of assets. Value=" + strAssetInfo))), false);
                }
            }
            if (nAssetInfoArrayLBound == nAssetInfoArrayUBound)
            {
                if (0 == strContentTitle.Length)
                {
                    if (Strings.Len(page_content_data["AssetFilename"]) > 0)
                    {
                        strContentTitle = page_content_data["AssetFilename"].ToString();
                    }
                    else
                    {
                        strContentTitle = "No Title";
                    }
                }
            }
            if (strContentTitle.IndexOf("\'") != -1)
            {
                strContentTitle = System.Web.HttpUtility.HtmlEncode(strContentTitle);
            }
            page_content_data.Add(strContentTitle, "ContentTitle", null, null);
            m_strManualAlias = (Request.Form["frm_manalias"] != null ? Request.Form["frm_manalias"].ToString().Trim() : null);
            m_strManualAliasExt = (Request.Form["frm_manaliasExt"] != null ? Request.Form["frm_manaliasExt"].ToString() : null);

            ast_frm_manaliasExt.Value = Request.Form["frm_manaliasExt"];

            //Aliasing logic for 7.6 starts here
            m_prevManualAliasName = (Request.Form["prev_frm_manalias_name"] != null ? Request.Form["prev_frm_manalias_name"].ToString() : "");
            m_prevManualAliasExt = (Request.Form["prev_frm_manalias_ext"] != null ?Request.Form["prev_frm_manalias_ext"].ToString():"");
            m_currManualAliasName = m_strManualAlias;
            m_currManualAliasExt = m_strManualAliasExt;
            if (m_prevManualAliasName == "" && m_currManualAliasName != "" || m_prevManualAliasExt == "" && m_currManualAliasExt != "")
            {
                m_currManualAliasStatus = "New";
            }
            else if (m_prevManualAliasName != "" && m_currManualAliasName != "" && (m_currManualAliasName != m_prevManualAliasName || m_prevManualAliasExt != m_currManualAliasExt))
            {
                m_currManualAliasStatus = "Modified";
            }
            else if (m_prevManualAliasName != "" && m_currManualAliasName == "")
            {
                m_currManualAliasStatus = "Deleted";
            }
            else
            {
                m_currManualAliasStatus = "None";
            }
            if (!string.IsNullOrEmpty(Request.Form["frm_manalias_id"]))
            {
                m_intManualAliasId = System.Convert.ToInt64(Request.Form["frm_manalias_id"]);
            }

            page_content_data.Add(m_strManualAlias, "NewUrlAliasName", null, null);
            page_content_data.Add(m_intManualAliasId, "UrlAliasId", null, null);
            page_content_data.Add(m_strManualAliasExt, "NewUrlAliasExt", null, null);
            page_content_data.Add(m_currManualAliasStatus, "UrlAliasStatus", null, null);
            page_content_data.Add(m_prevManualAliasName, "OldUrlAliasName", null, null);
            page_content_data.Add(m_prevManualAliasExt, "OldUrlAliasExt", null, null);

            page_content_data.Add(m_strManualAlias, "ManualAlias", null, null);
            page_content_data.Add(m_intManualAliasId, "ManualAliasID", null, null);

            if (Request.Form["TaxonomyOverrideId"] != null && Convert.ToInt64(Request.Form["TaxonomyOverrideId"]) != 0)
            {
                TaxonomyOverrideId = Convert.ToInt64(Request.Form["TaxonomyOverrideId"]);
                TaxonomyTreeIdList = TaxonomyOverrideId.ToString();
            }

            if (!string.IsNullOrEmpty(Request.Form[taxonomyselectedtree.UniqueID]))
            {
                TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID];
                if (TaxonomyTreeIdList.Trim().EndsWith(","))
                {
                    TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1);
                }
            }
            if (TaxonomyTreeIdList.Trim() == string.Empty && TaxonomySelectId > 0)
            {
                TaxonomyTreeIdList = TaxonomySelectId.ToString();
            }
            page_content_data.Add(TaxonomyTreeIdList, "Taxonomy", null, null);
            page_content_data.Add(Request.Form["content_image"], "Image", null, null);
            long intContentId = 0;
            int iAsset = 0;
            string strAssetInfoValue = "";
            for (iAsset = nAssetInfoArrayLBound; iAsset <= nAssetInfoArrayUBound; iAsset++)
            {
                if (nAssetInfoArrayLBound < nAssetInfoArrayUBound)
                {
                    for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++)
                    {
                        strKeyName = Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i];
                        strAssetInfoValue = (string)(cAssetInfoArray[strKeyName]); // [iAsset]
                        // Commas were escaped as %2C, so restore them now. See assetevents.js
                        strAssetInfoValue = strAssetInfoValue.Replace("%2C", ",").Trim();
                        if (Ektron.Cms.Common.EkFunctions.DoesKeyExist(page_content_data, strKeyName))
                        {
                            page_content_data.Remove(strKeyName);
                        }
                        page_content_data.Add(strAssetInfoValue, strKeyName, null, null);
                    }
                    page_content_data.Remove("ContentTitle");
                    if (strContentTitle.Length > 0)
                    {
                        page_content_data.Add(strContentTitle + " (" + page_content_data["AssetFilename"] + ")", "ContentTitle", null, null);
                    }
                    else if (Strings.Len(page_content_data["AssetFilename"]) > 0)
                    {
                        page_content_data.Add(page_content_data["AssetFilename"], "ContentTitle", null, null);
                    }
                    else
                    {
                        page_content_data.Add("No Title", "ContentTitle", null, null);
                    }
                }
                if (!string.IsNullOrEmpty(Request.Form["xid"]) && !string.IsNullOrEmpty(Request.Form["templateSelect"]))
                {
                    page_content_data.Add(Request.Form["xid"], "MultiXmlID", null, null);
                    page_content_data.Add(Request.Form["templateSelect"], "MultiTemplateID", null, null);
                }
                else if (!string.IsNullOrEmpty(Request.Form["templateSelect"]))
                {
                    page_content_data.Add(0, "MultiXmlID", null, null);
                    if (lContentSubType == EkEnumeration.CMSContentSubtype.PageBuilderData || lContentSubType == EkEnumeration.CMSContentSubtype.PageBuilderMasterData )
                    {
                            ITemplateModel templmodel = ObjectFactory.GetTemplateModel();
                            TemplateData templdat = templmodel.FindByID(Convert.ToInt64(Request.Form["templateSelect"]));
                            if ((templdat != null))
                            {
                                page_content_data.Add(templdat.Id, "MultiTemplateID", null, null);
                            }
                    }
                    else
                        page_content_data.Add(Request.Form["templateSelect"], "MultiTemplateID", null, null);
                }
                else if (!string.IsNullOrEmpty(Request.Form["xid"]) && lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)
                {
                    page_content_data.Add(Request.Form["xid"], "MultiXmlID", null, null);
                    page_content_data.Add(0, "MultiTemplateID", null, null);
                }

                if (m_strType == "update")
                {
                    m_refContent.SaveContentv2_0(page_content_data);
                    intContentId = Convert.ToInt64(Request.Form["content_id"]);
                }
                else
                {
                    if (iAsset == nAssetInfoArrayLBound)
                    {
                        if (Request.Form["AddQlink"] == "AddQlink")
                        {
                            page_content_data.Add(true, "AddToQlink", null, null);
                        }
                        else
                        {
                            page_content_data.Add(false, "AddToQlink", null, null);
                        }
                        if (Request.Form["IsSearchable"] == "IsSearchable" || Request.Form["IsSearchable"] =="on")
                        {
                            page_content_data.Add(true, "IsSearchable", null, null);
                        }
                        else
                        {
                            page_content_data.Add(false, "IsSearchable", null, null);
                        }
                    }

                    // Update content flagging:
                    object flagDefSelObj = Request.Form["FlaggingDefinitionSel"];
                    if ((flagDefSelObj != null) && Ektron.Cms.Common.EkFunctions.IsNumeric(flagDefSelObj))
                    {
                        page_content_data.Add(Convert.ToInt64(flagDefSelObj.ToString()), "FlagDefId", null, null);
                    }

                    intContentId = m_refContent.AddNewContentv2_0(page_content_data);
                }

                if (string.IsNullOrEmpty(Request.Form["suppress_notification"]))
                {
                    m_refContent.UpdateSubscriptionPropertiesForContent(intContentId, sub_prop_data);
                    m_refContent.UpdateSubscriptionsForContent(intContentId, page_subscription_data);
                }

                // process tag info
                ProcessTags(intContentId, m_intContentLanguage);

                if (m_strPageAction == "checkin")
                {
                    m_refContent.CheckIn(intContentId, "");
                }
                if (m_strPageAction == "publish")
                {
                    m_refContent.CheckIn(intContentId, "");
                    if (ret == false)
                    {
                        if (bIsReportForm)
                        {
                            if (!String.IsNullOrEmpty(Request.Form["renewpoll"]))
                            {
                                if ("true" == Request.Form["renewpoll"].ToLower())
                                {
                                    //this needs to be done before the histogram is updated with the new data.
                                    m_refContApi.EkModuleRef.UpdatePollRev(intContentId);
                                }
                            }
                            bUpdateFormQuestions = m_refContApi.EkModuleRef.UpdateFormFieldQuestions(System.Convert.ToInt64(Request.Form["content_id"]), strContent);
                        }

                        site_data = m_refSiteApi.GetSiteVariables(-1);

                        long PreapprovalGroupID;
                        Collection cPreApproval = new Collection();
                        cPreApproval = m_refContent.GetFolderPreapprovalGroup(Convert.ToInt64(Request.Form["content_folder"]));
                        PreapprovalGroupID = System.Convert.ToInt64(cPreApproval["UserGroupID"]);

                        if (PreapprovalGroupID > 0)
                        {
                            if (Convert.ToString(dontCreateTask) == "")
                            {
                                if (m_intContentLanguage == 1)
                                {
                                    strTaskName = (string)(Request.Form["content_title"] + intContentId + "_Task");
                                }
                                else
                                {
                                    strTaskName = (string)(Request.Form["content_title"] + intContentId + "_Task" + m_intContentLanguage);
                                }
                                m_refTask.ContentLanguage = m_intContentLanguage;
                                m_refTask.LanguageID = m_intContentLanguage;
                                isAlreadyCreated = m_refTask.IsTaskAlreadyCreated(intContentId);
                                if (isAlreadyCreated == false)
                                {
                                    m_refTask.TaskTitle = strTaskName; // Task name would be contentname + content id + _Task
                                    m_refTask.AssignToUserGroupID = PreapprovalGroupID; //Assigned to group defined by
                                    m_refTask.AssignedByUserID = Convert.ToString(CurrentUserID); //Assigned by person creating the task
                                    m_refTask.State = "1"; //Not started
                                    m_refTask.ContentID = intContentId; //Content ID of the content being created
                                    m_refTask.Priority = EkEnumeration.TaskPriority.Normal; //Normal
                                    m_refTask.CreatedByUserID = CurrentUserID; // If task is hopping this will always be created by
                                    m_refTask.ContentLanguage = m_intContentLanguage;
                                    m_refTask.LanguageID = m_intContentLanguage;
                                    ret = m_refTask.AddTask();
                                    ret = m_refContent.SetContentState(intContentId, "T");
                                }
                                else
                                {
                                    ret = m_refContent.SubmitForPublicationv2_0(intContentId, Convert.ToInt64(Request.Form["content_folder"]), "");
                                }

                            }
                            else
                            {
                                ret = m_refContent.SubmitForPublicationv2_0(intContentId, Convert.ToInt64(Request.Form["content_folder"]), "");
                            }
                        }
                        else
                        {
                            string strStatusBefore;
                            string strStatusAfter;
                            Collection colContentState;

                            colContentState = m_refContent.GetContentStatev2_0(intContentId);
                            strStatusBefore = Convert.ToString(colContentState["ContentStatus"]);
                            ret = m_refContent.SubmitForPublicationv2_0(intContentId, Convert.ToInt64(Request.Form["content_folder"]), "");
                            colContentState = m_refContent.GetContentStatev2_0(intContentId);
                            strStatusAfter = Convert.ToString(colContentState["ContentStatus"]);

                            if (strStatusBefore != strStatusAfter && "T" == strStatusAfter)
                            {
                                blnShowTStatusMessage = true;
                            }
                            string markupPath = "";
                            string cacheidentifier = "";
                            string updateContent = "";
                            markupPath = Request.Form["ctlmarkup"];
                            cacheidentifier = Request.Form["cacheidentifier"];
                            if ((markupPath != null) && markupPath.Length > 0)
                            {
                                markupPath = Request.PhysicalApplicationPath + markupPath;
                            }
                            if ((cacheidentifier != null) && cacheidentifier.Length > 0)
                            {
                                if (HttpContext.Current.Cache[cacheidentifier] != null)
                                {
                                    HttpContext.Current.Cache.Remove(cacheidentifier);
                                }
                            }
                            object ekml = null;
                            if ((markupPath != null) && (HttpContext.Current.Cache[markupPath] != null))
                            {
                                ekml = HttpContext.Current.Cache[markupPath];
                                Ektron.Cms.UI.CommonUI.ApiSupport api = new Ektron.Cms.UI.CommonUI.ApiSupport();
                                Ektron.Cms.UI.CommonUI.ApiSupport.ContentResult results = api.LoadContent(intContentId, false);
                                m_refContApi = new ContentAPI();
                                updateContent = this.m_refContApi.FormatOutput((string)ekml.GetType().GetProperty("ContentFormat").GetValue(ekml, null), Request.Form["ctltype"], results.Item);
                                updateContent = this.m_refContApi.WrapAjaxToolBar(updateContent, results.Item, commparams);
                            }
                            else
                            {
                                updateContent = Convert.ToString(colContentState["ContentHtml"]);
                            }
                            if (!String.IsNullOrEmpty(Request.Form["ctlupdateid"]))
                            {
                                Page.ClientScript.RegisterHiddenField("updatefieldcontent", updateContent);
                                StringBuilder strJs = new StringBuilder();
                                strJs.Append("<script language=\"JavaScript1.2\" type=\"text/javascript\"> ").Append("\r\n");
                                strJs.Append(" if (top.opener != null) {").Append("\r\n");
                                strJs.Append("      var objUpdateField = top.opener.document.getElementById(\'" + Request.Form["ctlupdateid"] + "\');").Append("\r\n");
                                strJs.Append("      if (objUpdateField != null) { objUpdateField.innerHTML = document.getElementById(\"updatefieldcontent\").value; }").Append("\r\n");
                                strJs.Append(" }").Append("\r\n");
                                if ((m_bClose) && (m_strPageAction != "save"))
                                {
                                    strJs.Append("document.location.href = \"close.aspx\";").Append("\r\n");
                                }
                                strJs.Append("</script>").Append("\r\n");
                                UpdateFieldJS.Text = strJs.ToString();
                           }
                        }
                    }

                    if (strAddToCollectionType == "menu")
                    {
                        if (strMyCollection != "")
                        {
                            pagedata = new Collection();
                            pagedata.Add(intContentId, "ItemID", null, null);
                            pagedata.Add("content", "ItemType", null, null);
                            pagedata.Add("self", "ItemTarget", null, null);
                            pagedata.Add("", "ItemLink", null, null);
                            pagedata.Add("", "ItemTitle", null, null);
                            pagedata.Add("", "ItemDescription", null, null);
                            ret = m_refContent.AddItemToEcmMenu(strMyCollection, pagedata);
                        }
                    }
                    else
                    {
                        if (strMyCollection != "")
                        {
                            ret = m_refContent.AddItemToEcmCollection(Convert.ToInt64(strMyCollection), intContentId, m_intContentLanguage);
                        }
                    }
                }
            }
            if (m_strPageAction == "summary_save")
            {
                Response.Redirect((string)("edit.aspx?close=" + Request.QueryString["close"] + "&LangType=" + m_intContentLanguage + "&id=" + intContentId + "&type=update&mycollection=" + strMyCollection + "&addto" + strAddToCollectionType + "&back_file=" + back_file + "&back_action=" + back_action + "&back_folder_id=" + back_folder_id + "&back_id=" + back_id + "&back_form_id=" + back_form_id + "&back_LangType=" + back_LangType + "&summary=1" + back_callerpage + back_origurl), false);
            }
            else if (m_strPageAction == "meta_save")
            {
                Response.Redirect((string)("edit.aspx?close=" + Request.QueryString["close"] + "&LangType=" + m_intContentLanguage + "&id=" + intContentId + "&type=update&mycollection=" + strMyCollection + "&addto" + strAddToCollectionType + "&back_file=" + back_file + "&back_action=" + back_action + "&back_folder_id=" + back_folder_id + "&back_id=" + back_id + "&back_form_id=" + back_form_id + "&back_LangType=" + back_LangType + "&meta=1" + back_callerpage + back_origurl), false);
            }
            else if ((!m_bClose) && (m_strPageAction != "save"))
            {
                if (Request.QueryString["pullapproval"] == "true")
                {
                    Response.Redirect(GetBackPage(intContentId), false);
                }
                else
                {
                    if (m_strType == "add" && m_strPageAction == "checkin")
                    {
                        //leave back_action
                    }
                    else if (m_strPageAction != "publish")
                    {
                        if (back_action.ToLower() == "viewform")
                        {
                            back_action = back_action + "&staged=true";
                        }
                        else
                        {
                            back_action = "viewstaged";
                        }

                    }
                    // replaced logic added by todd 3/30/2006 - when you save then checkin content, GetBackPage() isn't aware of contentid and tries
                    // to use 0 which causes all sorts of bad things to happen - bug# 19413 - however if you just checkin before saving it goes to a different page,
                    // so don't replace that (which is the else statement)
                    if (m_strType == "update")
                    {
                        back_id = intContentId;
                        if (controlName == "cbwidget")
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UpdateContentWidget", "UpdateContentWidget(" + intContentId + ",\'" + buttonId.Value + "\');", true);
                        }
                        else
                        {
                            Response.Redirect(GetBackPage(intContentId), false);
                        }

                    }
                    else
                    {
                        Response.Redirect(GetBackPage(intContentId), false);
                    }

                }
            }
            else if (m_strPageAction == "save")
            {
                Response.Redirect((string)("edit.aspx?close=" + Request.QueryString["close"] + "&LangType=" + m_intContentLanguage + "&id=" + intContentId + (this.TaxonomyOverrideId > 0 ? ("&TaxonomyId=" + this.TaxonomyOverrideId.ToString()) : "") + (this.TaxonomySelectId > 0 ? ("&SelTaxonomyId=" + this.TaxonomySelectId.ToString()) : "") + "&type=update&mycollection=" + strMyCollection + "&addto" + strAddToCollectionType + "&back_file=" + back_file + "&back_action=" + back_action + "&back_folder_id=" + back_folder_id + "&back_id=" + back_id + "&back_form_id=" + back_form_id + "&back_LangType=" + back_LangType + back_callerpage + back_origurl + "&control=" + controlName+ "&buttonid=" + buttonId.Value), false);
            }
            if ((m_bClose) && (m_strPageAction != "save"))
            {
                //Close the editor page
                if (String.IsNullOrEmpty( Request.Form["ctlupdateid"]))
                {
                    string strQuery = "";
                    if (TaxonomySelectId > 0)
                    {
                        strQuery = (string)("&__taxonomyid=" + TaxonomySelectId);
                    }
                    else if (TaxonomyOverrideId > 0)
                    {
                        strQuery = (string)("&__taxonomyid=" + TaxonomyOverrideId);
                    }
                    if (controlName == "cbwidget")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UpdateContentWidget", "UpdateContentWidget(" + intContentId + ",\'" + buttonId.Value + "\');", true);
                    }
                    else
                    {
                        Response.Redirect((string)("close.aspx?toggle=true" + strQuery), false);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect((string)("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message) + "&LangType=" + m_intContentLanguage), false);
        }
    }