Esempio n. 1
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        try
        {
            bool fileChanged = true;
            string assetId;
            List<AssetFileData> assetIdFileNameList = null;
            List<AssetFileData> tempAssetIdFileNameList = new List<AssetFileData>();
            m_refContent = AppUI.EkContentRef;
            if (Request.Form["type"] != null)
            {
                actionType = (string)(Request.Form["type"].Trim().ToLower());
            }

            if (Request.Form["requireMetaTaxonomy"] != null)
            {
                isCallerDmsDragDropCtl = true;
            }

            m_refContApi = new ContentAPI();
            m_refMsg = m_refContApi.EkMsgRef;
            if (!String.IsNullOrEmpty(Request.Form["content_language"]))
            {

                ContentLanguage = Convert.ToInt32(Request.Form["content_language"]);
                if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                {
                    ContentLanguage = AppUI.DefaultContentLanguage;
                }
                AppUI.ContentLanguage = ContentLanguage;
                m_refContApi.ContentLanguage = ContentLanguage;

            }
            if (actionType.ToLower() == "add" && (Request.QueryString["SelTaxonomyId"] != null) && Request.QueryString["SelTaxonomyId"] != "")
            {
                TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]);
            }
            userId = Convert.ToInt64(Ektron.Cms.CommonApi.GetEcmCookie()["user_id"]);
            loginToken = Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()["unique_id"]);

            if ((Request.Form["taxonomyselectedtree"] != null) && Request.Form["taxonomyselectedtree"].ToString().Length > 1)
            {
                jsTaxonomyIdReloadFrame.Text = Request.Form["taxonomyselectedtree"].ToString();
                if (Request.Form["taxonomyselectedtree"].ToString().Split(",".ToCharArray()) != null)
                {
                    jsTaxonomyId.Text = (Request.Form["taxonomyselectedtree"].ToString().Split(",".ToCharArray()))[0];
                }
            }

            if (Request.Form["editaction"] == "cancel")
            {
                Session.Remove(Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments");
                if ((actionType != "add") && (Request.Form["content_id"] != "" && Convert.ToInt64(Request.Form["content_id"]) > 0))
                {
                    string status = m_refContApi.GetContentStatusById(Convert.ToInt64(Request.Form["content_id"]));
                    if (status.ToLower() == "o") //28710 - if asset is a office file status = "A" on saving in word
                    {
                        m_refContent.UndoCheckOutv2_0(Convert.ToInt64(Request.Form["content_id"]));
                    }
                    if (Request.Form["FromEE"] == "true" || Request.QueryString["close"] == "true")
                    {
                        if (Request.QueryString["close"] == "true")
                        {
                            Response.Redirect("close.aspx?reload=true", false);
                            return;
                        }
                        else
                        {
                            Response.Redirect("close.aspx", false);
                            return;
                        }
                    }
                    else
                    {
                        Response.Redirect((string)("content.aspx?id=" + Request.Form["content_id"] + "&action=viewstaged&LangType=" + m_refContApi.ContentLanguage), false);
                        return;
                    }
                }
                else
                {
                    if (Request.Form["FromEE"] == "true" || Request.QueryString["close"] == "true")
                    {
                        if (Request.QueryString["close"] == "true")
                        {
                            Response.Redirect("close.aspx?reload=true", false);
                            return;
                        }
                        else
                        {
                            Response.Redirect("close.aspx", false);
                            return;
                        }
                    }
                    else
                    {
                        Response.Redirect((string)("content.aspx?id=" + Request.Form["content_folder"] + "&action=ViewContentByCategory&LangType=" + m_refContApi.ContentLanguage), false);
                        return;
                    }
                }
            }

            int i;
            for (i = 0; i <= m_AssetInfoKeys.Length - 1; i++)
            {
                asset_info.Add(m_AssetInfoKeys[i], "");
            }
            if (actionType != "multiple,add")
            {
                if ((Request.Form["asset_assetid"] != null) && (Request.Form["asset_assetid"].Length > 1))
                {
                    assetId = Request.Form["asset_assetid"];
                }
                else
                {
                    assetId = System.Guid.NewGuid().ToString();
                }
                Response.Expires = -1;
                Response.AddHeader("Pragma", "no-cache");
                Response.AddHeader("cache-control", "no-store");
                string ErrDescription = "";
                string filename;
                if (Request.Files["fileupload"] != null)
                {
                    fileChanged = true;
                    filename = Request.Files["fileupload"].FileName;

                    string[] DMSFileTypes = DocumentManagerData.Instance.FileTypes.Replace("*","").Split(',');
                    bool IsFileTypeAllowed = false;

                    if (DMSFileTypes != null && !string.IsNullOrEmpty(filename))
                    {
                        if (Array.FindIndex(DMSFileTypes, x => x.ToString().Trim().ToLower() == filename.Substring(filename.IndexOf(".")).ToLower()) >= 0)
                        {
                            IsFileTypeAllowed = true;
                        }
                    }

                    if (actionType == "add")
                    {
                        Ektron.ASM.AssetConfig.AssetData astData = new Ektron.ASM.AssetConfig.AssetData();
                        astData = m_refContent.GetAssetDataBasedOnFileName(Path.GetFileName(filename), Convert.ToInt64(Request.Form["content_folder"]), -1);
                        if (astData != null && astData.ID != "" && astData.Name != "")
                        {
                            ErrDescription = "A content with title: " + astData.Name + " and ID: " + astData.ID + " already exists with the file name: " + Path.GetFileName(filename) + ". Please use a different filename.";
                            Response.Redirect((string)("reterror.aspx?info=" + ErrDescription), false);
                            return;
                        }
                    }
                    if (filename.Trim() == "")
                    {
                        fileChanged = false;
                        filename = (string)(Request.Form["oldfilename"].ToString());
                    }
                    else
                    {
                        if (!IsFileTypeAllowed)
                        {
                            EkException.LogException(String.Format("Attempt at uploading unallowed file type occurred from user id: {0}", this.userId));
                            ErrDescription = "The file has not been uploaded. Please see administrator.";
                            Response.Redirect("reterror.aspx?info=" + ErrDescription, false);
                            return;
                        }
                        try
                        {
                            string docFilePath = DocumentManagerData.Instance.WebSharePath;
                            if (!System.IO.Path.IsPathRooted(docFilePath))
                            {
                                docFilePath = Ektron.ASM.AssetConfig.Utilities.UrlHelper.GetAppPhysicalPath() + docFilePath;
                            }
                            string destFileName = docFilePath + Path.GetFileName(filename) + assetId;
                            using (BinaryReader br = new BinaryReader(Request.Files["fileupload"].InputStream))
                            {
                                byte[] buf;
                                using (BinaryWriter binaryWriter = new BinaryWriter(File.Open(destFileName, FileMode.Create)))
                                {
                                    buf = br.ReadBytes(bufSize);

                                    if (EkFunctions.IsImage(Path.GetExtension(filename)))
                                    {
                                        System.IO.Stream streamTmp=new System.IO.MemoryStream(buf);
                                        if (!EkFunctions.isImageStreamValid(streamTmp))
                                        {
                                            streamTmp.Flush();
                                            streamTmp.Close();
                                            throw new Exception("The image is corrupted or not in correct format.");
                                        }
                                        streamTmp.Flush();
                                        streamTmp.Close();
                                    }

                                    int index = 0;
                                    while (buf.Length > 0)
                                    {
                                        binaryWriter.Write(buf, 0, buf.Length);
                                        index += buf.Length;
                                        buf = br.ReadBytes(bufSize);
                                    }
                                    binaryWriter.Flush();
                                    binaryWriter.Close();
                                }

                                br.Close();
                            }
                        }
                        catch (Exception ex)
                        {

                            throw ex;
                        }
                    }
                }
                else
                {
                    filename = (string)(Request.Form["filename"].ToString());
                    fileChanged = false;
                }
                ProcessPage(filename, assetId, fileChanged, null);
            }
            else
            {
                bool isOfc2010 = false;
                if (Request.Cookies[DMSCookieName] != null && !string.IsNullOrEmpty(Request.Cookies[DMSCookieName].Value))
                {
                    if (Request.Cookies[DMSCookieName].Value == "2010")
                    {
                        isOfc2010 = true;
                    }
                }
                if (isOfc2010)
                {
                    ProcessUploadOffice2010();
                }
                else
                {
                    #region originalupload
                    if (Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments"] != null)
                    {
                        assetIdFileNameList = (List<AssetFileData>)Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments"];
                        Session.Remove(Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments");
                    }
                    //If coming from photo/image gallery, do not upload any files if a single invalid file is found
                    if ((Request.Form["isImage"] != null) && Request.Form["isImage"].ToString() == "1")
                    {
                        List<string> allFilesList = null;
                        if (Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "AllPostedFiles"] != null)
                        {
                            allFilesList = (List<string>)Session[userId + loginToken + "AllPostedFiles"];
                            Session.Remove(Convert.ToString(userId) + Convert.ToString(loginToken) + "AllPostedFiles");
                        }
                        string invalidFilesMsg = "";
                        if (allFilesList != null)
                        {
                            for (int index = 0; index <= allFilesList.Count - 1; index++)
                            {
                                if (!EkFunctions.IsImage(Path.GetExtension(System.Convert.ToString(allFilesList[index]))))
                                {
                                    invalidFilesMsg = System.Convert.ToString(allFilesList[index]);
                                    this.jsInvalidFiles.Text = "Only images can be uploaded here, invalid file type found: " + invalidFilesMsg.Replace("\\", "\\\\").Replace("\'", "\\\'") + "\\nNo images have been uploaded.";
                                    this.uxAlertInvalidFileType.Visible = true;
                                    this.uxCloseThickBox.Visible = true;
                                    return;
                                }
                            }
                        }
                    }
                    if (assetIdFileNameList != null && assetIdFileNameList.Count > 0)
                    {
                        for (int index = 0; index <= assetIdFileNameList.Count - 1; index++)
                        {
                            if (assetIdFileNameList[index].FileName.IndexOfAny(new char[] { '&', '%', '+' }) > -1)
                            {
                                this.jsInvalidFiles.Text = "Some files with &,+ or % could not be uploaded";
                                this.uxAlertInvalidFileType.Visible = true;
                            }
                            else
                            {
                                tempAssetIdFileNameList.Add(assetIdFileNameList[index]);
                            }
                        }
                        assetIdFileNameList = tempAssetIdFileNameList;
                    }
                    fileChanged = true;
                    if ((assetIdFileNameList != null) && assetIdFileNameList.Count > 0)
                    {
                        ProcessPage("", "", true, assetIdFileNameList);
                    }
                    else
                    {
                        //if any files were rejected
                        if (Request.Form["FromEE"] == "true" || Request.QueryString["close"] == "true")
                        {
                            if (Request.QueryString["close"] == "true")
                            {
                                Response.Redirect("close.aspx?reload=true", false);
                            }
                            else
                            {
                                Response.Redirect("close.aspx", false);
                            }
                        }
                        else
                        {
                            if (isCallerDmsDragDropCtl == true)
                            {
                                if ((Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles"] != null) && Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles"].ToString() != "")
                                {
                                    this.jsInvalidFiles.Text = m_refMsg.GetMessage("lbl error message for multiupload") + " " + Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles"].ToString().Replace("\\", "\\\\").Replace("\'", "\\\'");
                                    this.jsInvalidFiles.Text += "\\n" + m_refMsg.GetMessage("js:cannot add file with add and plus");
                                    this.uxAlertInvalidFileType.Visible = true;
                                    Session.Remove(Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles");
                                    this.uxCloseThickBox.Visible = true;
                                }
                                else
                                {
                                    Response.Redirect(Request.UrlReferrer.PathAndQuery + ((Request.UrlReferrer.PathAndQuery.IndexOf("showtab") > -1) ? "" : "&showtab=multiple"), false);
                                }

                            }
                            else
                            {
                                if ((Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles"] == null) || Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "RejectedFiles"].ToString() == "")
                                {
                                    if ((Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments"] == null) || Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "Attachments"].ToString() == "")
                                    {
                                        if (Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "NoFilesToUpload"] == null)
                                        {
                                            Session.Add(Convert.ToString(userId) + Convert.ToString(loginToken) + "NoFilesToUpload", "NoFilesToUpload");
                                        }
                                        else
                                        {
                                            Session[Convert.ToString(userId) + Convert.ToString(loginToken) + "NoFilesToUpload"] = "NoFilesToUpload";
                                        }
                                    }
                                }
                                Response.Redirect((string)("content.aspx?id=" + Request.Form["content_folder"] + "&action=ViewContentByCategory&LangType=" + ContentLanguage), false);
                            }
                        }
                    }
                    #endregion
                }
            }

        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message.ToString());
        }
    }
Esempio n. 2
0
    public bool ViewContent()
    {
        if (!(Request.QueryString["id"] == null))
        {
            m_intId = Convert.ToInt64(Request.QueryString["id"]);
            if (m_intId == 0)
            {
                if (!(Request.QueryString["contentid"] == null))
                {
                    m_intId = Convert.ToInt64(Request.QueryString["contentid"]);
                }
            }
        }

        if (!(Request.QueryString["action"] == null))
        {
            m_strPageAction = Convert.ToString(Request.QueryString["action"]).ToLower().Trim();
        }
        if (!(Request.QueryString["orderby"] == null))
        {
            m_strOrderBy = Convert.ToString(Request.QueryString["orderby"]);
        }
        if (!(Request.QueryString["LangType"] == null))
        {
            if (Request.QueryString["LangType"] != "")
            {
                ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
            }
            else
            {
                if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                }
            }
        }
        else
        {
            if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
            {
                ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
            }
        }
        if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
        }
        else
        {
            m_refContentApi.ContentLanguage = ContentLanguage;
        }
        if (!(Request.QueryString["cancelaction"] == null))
        {
            if (Convert.ToString(Request.QueryString["cancelaction"]).ToLower() == "undocheckout")
            {
                bool retval = false;
                m_refContent = m_refContentApi.EkContentRef;
                retval = m_refContent.UndoCheckOutv2_0(m_intId);
            }
        }
        language_data = (new SiteAPI()).GetLanguageById(ContentLanguage);
        LanguageName = language_data.Name;
        m_refContent = m_refContentApi.EkContentRef;
        TaskExists = m_refContent.DoesTaskExistForContent(m_intId);

        CurrentUserId = m_refContentApi.UserId;
        AppImgPath = m_refContentApi.AppImgPath;
        SitePath = m_refContentApi.SitePath;
        EnableMultilingual = m_refContentApi.EnableMultilingual;
        if (!(Request.QueryString["callerpage"] == null))
        {
            CallerPage = AntiXss.UrlEncode(Request.QueryString["callerpage"]);
        }

        if (CallerPage == "")
        {
            if (!(Request.QueryString["calledfrom"] == null))
            {
                CallerPage = AntiXss.UrlEncode(Request.QueryString["calledfrom"]);
            }
        }
        if (!(Request.QueryString["folder_id"] == null))
        {
            if (Request.QueryString["folder_id"] != "")
            {
                m_intFolderId = Convert.ToInt64(Request.QueryString["folder_id"]);
            }
        }
        if (m_intFolderId == -1)
        {
            //let try again to get folder id
            if (!(Request.QueryString["fldid"] == null))
            {
                if (Request.QueryString["fldid"] != "")
                {
                    m_intFolderId = Convert.ToInt64(Request.QueryString["fldid"]);
                }
            }
        }
        Display_ViewContent();
        return true;
    }
Esempio n. 3
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        bool bAddingNew = false;
        string tempStr;
        string referrerStr;
        try
        {
            //INITIALIZE THE VARIABLES
            if (Request.Browser.Type.IndexOf("IE") != -1)
            {
                IsBrowserIE = true;
            }
            jsIsMac.Text = "false";
            if (Request.Browser.Platform.IndexOf("Win") == -1)
            {
                IsMac = true;
            }
            // Ensure that this is not a browser refresh (Mac-Safari bug causes
            // the editor to load after publishing, if the browser is refreshing):
            if (IsMac && !IsBrowserIE)
            {
                referrerStr = Request.Url.LocalPath;
                if (referrerStr != null)
                {
                    tempStr = referrerStr.Substring(referrerStr.LastIndexOf("/"));
                    if (tempStr == "/workarea.aspx")
                    {
                        tempStr = referrerStr.Replace(tempStr, "/dashboard.aspx");
                        Response.Redirect(tempStr, false);
                        return;
                    }
                }
            }

            if (m_SelectedEditControl != "ContentDesigner")
            {
                m_ctlContentPane.Controls.Remove(m_ctlContentDesigner);
                m_ctlSummaryStandard.Controls.Remove(m_ctlSummaryDesigner);
                m_ctlSummaryRedirect.Controls.Remove(m_ctlFormResponseRedirect);
                m_ctlSummaryTransfer.Controls.Remove(m_ctlFormResponseTransfer);
            }

            Response.Expires = -1;
            Response.AddHeader("Pragma", "no-cache");
            Response.AddHeader("cache-control", "no-store");

            //THE NEXT THREE LINES MUST BE REMOVED BEFORE THE RELEASE
            if (Request.ServerVariables["Query_String"] == "")
            {
                return;
            }

            if (IsMac)
            {
                jsIsMac.Text = "true";
            }

            // Note: To fix a problem with the Ephox Editors on the
            // Mac-running-Safari (assumed if "IsMac and not IsBrowserIE")
            // we need to use different styles for the DIV-tags holding
            // the editors, etc., otherwise they frequently draw themselves
            // when they should remain hidden. These values cause problems
            // with the PC/Win/IE combination, (the summary editor fails to
            // provide a client area for the user to view/edit) so they cannot
            // cannot be used everywhere, hence our use of alternate style classes:
            // Pass class names to javascript:
            jsSelectedDivStyleClass.Text = m_sSelectedDivStyleClass;
            jsUnSelectedDivStyleClass.Text = m_sUnSelectedDivStyleClass;

            m_refContApi = new ContentAPI();
            m_refSiteApi = new SiteAPI();
            m_refContent = m_refContApi.EkContentRef;
            m_refSite = m_refContApi.EkSiteRef;
            m_refTask = m_refContApi.EkTaskRef;

            CurrentUserID = m_refContApi.UserId;
            AppImgPath = m_refContApi.AppImgPath;
            SitePath = m_refContApi.SitePath;
            Appname = m_refContApi.AppName;
            AppeWebPath = m_refContApi.ApplicationPath + m_refContApi.AppeWebPath;
            AppPath = m_refContApi.AppPath;
            EnableMultilingual = m_refContApi.EnableMultilingual;
            StyleSheetJS.Text = m_refStyle.GetClientScript();
            EnhancedMetadataScript.Text = CustomFields.GetEnhancedMetadataScript();
            EnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea();
            lbl_GenericTitleLabel.Text = m_refMsg.GetMessage("generic title label");

            if (!(Request.QueryString["id"] == null))
            {
                m_intItemId = Convert.ToInt64(Request.QueryString["id"]);
                m_intTaxFolderId = m_intItemId;
            }
            if (!(Request.QueryString["LangType"] == null))
            {
                if (Request.QueryString["LangType"] != "")
                {
                    m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                    m_refContApi.SetCookieValue("LastValidLanguageID", m_intContentLanguage.ToString());
                }
                else
                {
                    if (m_refContApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID"));
                    }
                }
            }
            else
            {
                if (m_refContApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID"));
                }
            }
            if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || m_intContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
            {
                m_intContentLanguage = m_refContApi.DefaultContentLanguage;
            }
            if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refContApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refContApi.ContentLanguage = m_intContentLanguage;
            }
            if (!String.IsNullOrEmpty(Request.QueryString["folder_id"]))
            {
                m_intFolderId = Convert.ToInt64(Request.QueryString["folder_id"]);
            }

            if (Request.QueryString["form_type"] != null)
            {
                bNewPoll = System.Convert.ToBoolean("poll" == Convert.ToString(Request.QueryString["form_type"]).Trim().ToLower());
            }
            if (Request.QueryString["new"] != null)
            {
                bAddingNew = System.Convert.ToBoolean("true" == Convert.ToString(Request.QueryString["new"]).Trim().ToLower());
            }
            if (Request.QueryString["poll"] != null)
            {
                bReNewPoll = System.Convert.ToBoolean("renew" == Convert.ToString(Request.QueryString["poll"]).Trim().ToLower());
            }
            if (Request.Form["editaction"] != null)
            {
                m_strPageAction = Convert.ToString(Request.Form["editaction"]).ToLower().Trim();
            }
            if (Request.QueryString["translate"] != null)
            {
                translate.Value = "true";
            }
            if (Request.QueryString["type"] != null)
            {
                m_strType = Convert.ToString(Request.QueryString["type"]).ToLower().Trim();
            }
            else if (Request.Form["eType"] != null)
            {
                m_strType = Convert.ToString(Request.Form["eType"]).ToLower().Trim();
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ctlupdateid"]))
            {
                commparams = (string)("&ctlupdateid=" + Request.QueryString["ctlupdateid"] + "&ctlmarkup=" + Request.QueryString["ctlmarkup"] + "&cltid=" + Request.QueryString["cltid"] + "&ctltype=" + Request.QueryString["ctltype"]);
                updateFieldId = Request.QueryString["ctlupdateid"];
                Page.ClientScript.RegisterHiddenField("ctlupdateid", updateFieldId);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["cacheidentifier"]))
            {
                Page.ClientScript.RegisterHiddenField("cacheidentifier", Request.QueryString["cacheidentifier"]);
            }
            else
            {
                if ((Request.QueryString["mycollection"] != null) && (Request.QueryString["addto"] != null) && (Request.QueryString["type"] != null))
                {
                    if (Request.QueryString["type"] == "add" && Request.QueryString["addto"] == "menu")
                    {
                        Page.ClientScript.RegisterHiddenField("cacheidentifier", "menu_" + Request.QueryString["mycollection"] + m_intContentLanguage + "_mnu");
                    }
                }
            }

            //destination.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx";
            //PostURL.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx";
            //NextUsing.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "content.aspx";

            if (Request.Cookies[DMSCookieName] != null && !string.IsNullOrEmpty(Request.Cookies[DMSCookieName].Value))
            {

                if (Request.Cookies[DMSCookieName].Value == "2010")
                {
                    Ektron.Cms.Controls.ExplorerDragDrop edd = new Ektron.Cms.Controls.ExplorerDragDrop();
                    edd.ContentLanguage = this.m_intContentLanguage;
                    if (!string.IsNullOrEmpty(Request.QueryString["folderid"]))
                    {
                        destination.Value = edd.GetFolderPath(Int64.Parse(Request.QueryString["folderid"])).Replace(Page.Request.Url.GetLeftPart(UriPartial.Authority), "");
                        putopts.Value = "false";
                    }
                    //btnMUpload.OnClientClick = "return MultipleDocumentUpload(0);";
                    //lbtn_toggleVersion.Attributes.Add("onclick", string.Format(_messageHelper.GetMessage("js office version toggle confirm format"), _messageHelper.GetMessage("li text office 2010 name")));
                }
                else
                {
                    destination.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx";
                    PostURL.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx";
                    NextUsing.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "content.aspx";
                    putopts.Value = "true";
                    //btnMUpload.OnClientClick = "return MultipleDocumentUpload(1);";
                    //lbtn_toggleVersion.Attributes.Add("onclick", string.Format(_messageHelper.GetMessage("js office version toggle confirm format"), _messageHelper.GetMessage("li text other office ver name")));

                }
                //tabMultipleDMS.Controls.Add(linebreak);
            }

            if (!String.IsNullOrEmpty(Request.QueryString["ctlmarkup"]))
            {
                Page.ClientScript.RegisterHiddenField("ctlmarkup", Request.QueryString["ctlmarkup"]);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ctltype"]))
            {
                Page.ClientScript.RegisterHiddenField("ctltype", Request.QueryString["ctltype"]);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["cltid"]))
            {
                Page.ClientScript.RegisterHiddenField("cltid", Request.QueryString["cltid"]);
            }

            if (m_strType == "update")
            {
                m_refContentId = m_intItemId;
            }
            else
            {
                if (!String.IsNullOrEmpty(Request.QueryString["content_id"]))
                {
                    m_refContentId = Convert.ToInt64(Request.QueryString["content_id"]);
                }
            }

            if (Request.QueryString["xid"] != null)
            {
                m_intXmlConfigId = Convert.ToInt64(Request.QueryString["xid"]);
            }
            else if (Request.Form["SelectedXid"] != null)
            {
                m_intXmlConfigId = Convert.ToInt64(Request.Form["SelectedXid"]);
            }
            else
            {
                if (Request.QueryString["type"] == "add")
                {
                    if (Request.QueryString["AllowHTML"] != "1")
                    {
                        m_intXmlConfigId = Utilities.GetDefaultXmlConfig(Convert.ToInt64(Request.QueryString["id"]));
                        if (m_intXmlConfigId == 0)
                        {
                            m_intXmlConfigId = -1;
                        }
                    }
                }
            }
            if (!String.IsNullOrEmpty(Request.QueryString["mycollection"]))
            {
                strMyCollection = Request.QueryString["mycollection"];
            }
            else if (!String.IsNullOrEmpty(Request.Form["mycollection"]))
            {
                strMyCollection = Request.Form["mycollection"];
            }
            if (!String.IsNullOrEmpty(Request.QueryString["addto"]))
            {
                strAddToCollectionType = Request.QueryString["addto"];
            }
            else if (!String.IsNullOrEmpty(Request.Form["addto"]))
            {
                strAddToCollectionType = Request.Form["addto"];
            }
            if (Request.QueryString["close"] == "false")
            {
                m_bClose = false;
            }
            if (Request.QueryString["back_folder_id"] != null)
            {
                back_folder_id = Convert.ToInt64(Request.QueryString["back_folder_id"]);
                m_intTaxFolderId = back_folder_id;
            }
            if (Request.QueryString["back_id"] != null)
            {
                back_id = Convert.ToInt64(Request.QueryString["back_id"]);
            }
            if (Request.QueryString["back_file"] != null)
            {
                back_file = Request.QueryString["back_file"];
            }
            if (Request.QueryString["back_action"] != null)
            {
                back_action = Request.QueryString["back_action"];
                if (back_action.ToLower() == "viewcontentbycategory" || back_action.ToLower() == "viewarchivecontentbycategory")
                {
                    back_folder_id = back_id;
                }
            }
            if (Request.QueryString["control"] != null)
            {
                controlName = Request.QueryString["control"];
            }
            if (Request.QueryString["buttonid"] != null)
            {
                buttonId.Value = Request.QueryString["buttonid"];
            }
            if (Request.QueryString["back_form_id"] != null)
            {
                back_form_id = Convert.ToInt64(Request.QueryString["back_form_id"]);
            }
            if (Request.QueryString["back_LangType"] != null)
            {
                back_LangType = Convert.ToInt32(Request.QueryString["back_LangType"]);
            }
            else
            {
                back_LangType = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]);
            }
            if (Request.QueryString["back_callerpage"] != null)
            {
                back_callerpage = (string)("&back_callerpage=" + Request.QueryString["back_callerpage"]);
            }
            if (Request.QueryString["back_page"] != null)
            {
                back_callerpage = back_callerpage + "&back_page=" + Request.QueryString["back_page"];
            }
            if (Request.QueryString["back_origurl"] != null)
            {
                back_origurl = (string)("&back_origurl=" + EkFunctions.UrlEncode(Request.QueryString["back_origurl"]));
            }
            if (!String.IsNullOrEmpty(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
            {
                if (Ektron.Cms.Common.EkFunctions.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                {
                    g_ContentTypeSelected = System.Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                    m_refContApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, g_ContentTypeSelected.ToString());
                }
            }
            else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "")
            {
                if (Ektron.Cms.Common.EkFunctions.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                {
                    g_ContentTypeSelected = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                }
            }
            if (Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes == g_ContentTypeSelected)
            {
                if (Request.QueryString["multi"] != null)
                {
                    if ("" == Request.QueryString["multi"])
                    {
                        lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content; //set content type to "content" as default value
                    }
                    else
                    {
                        lContentType = Convert.ToInt32(Request.QueryString["multi"]);
                        if (lContentType == 9876)
                        {
                            lContentType = 103;
                        }
                    }
                }
                else
                {
                    lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                }
            }
            else
            {
                lContentType = g_ContentTypeSelected;
                if (lContentType == 9876)
                {
                    lContentType = 103;
                }
            }

            language_data = m_refSiteApi.GetLanguageById(m_intContentLanguage);
            if (this.m_strType.ToLower() == "add" && (!String.IsNullOrEmpty(Request.QueryString["SelTaxonomyId"])))
            {
                TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]);
            }
            SettingsData settings_data;
            settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);

            int UserLocale;
            UserLocale = m_refSiteApi.RequestInformationRef.UserCulture;
            AppLocaleString = GetLocaleFileString(UserLocale.ToString());
            jsMaxLengthMsg.Text = m_refMsg.GetMessage("js err encoded title exceeds max length");
            jsContentLanguage.Text = Convert.ToString((short)m_intContentLanguage);
            jsId.Text = Convert.ToString(m_intItemId);
            jsDefaultContentLanguage.Text = Convert.ToString(m_refContApi.DefaultContentLanguage);
            jsType.Text = Convert.ToString((short)m_intContentType);
            phAlias.Visible = false;
            Page.Title = m_refContApi.AppName + " " + m_refMsg.GetMessage("edit content page title") + " \"" + Ektron.Cms.CommonApi.GetEcmCookie()["username"] + "\"";
            string editaction = "";
            if (Request.Form["editaction"] != null)
            {
                editaction = Request.Form["editaction"];
            }
            if ("workoffline" == editaction || "cancel" == editaction || ("" == Convert.ToString(m_intItemId) && "" == editaction))
            {
                if (m_strType == "update")
                {
                    ret = m_refContent.UndoCheckOutv2_0(Convert.ToInt64(Request.Form["content_id"]));
                    blnUndoCheckOut_complete = true;
                }
                if (!m_bClose)
                {
                    ClosePanel.Text = "<script language=javascript>" + "\r\n" + "ResizeFrame(1); // Show the navigation-tree frame." + "\r\n" + "</script>";
                    Response.Redirect(GetBackPage(Convert.ToInt64(Request.Form["content_id"])), false);
                }
                else
                {
                    Response.Redirect("close.aspx", false);
                }
            }
            else if ((m_strPageAction == "save") || (m_strPageAction == "checkin") || (m_strPageAction == "publish") || (m_strPageAction == "summary_save") || (m_strPageAction == "meta_save"))
            {
                Process_FormSubmit();
                if (m_bClose && m_strPageAction != "save")
                {
                    if (updateFieldId != "")
                    {
                        string strQuery = "";
                        if (TaxonomySelectId > 0)
                        {
                            strQuery = (string)("&__taxonomyid=" + TaxonomySelectId);
                        }
                        else if (TaxonomyOverrideId > 0)
                        {
                            strQuery = (string)("&__taxonomyid=" + TaxonomyOverrideId);
                        }
                        Response.Redirect((string)("close.aspx?toggle=true" + strQuery), false);
                    }
                }
            }
            else
            {
                Display_EditControls();

                if (!(Page.IsPostBack) && bAddingNew)
                {
                    if (Request.QueryString["form_type"] != null)
                    {
                        newformwizard ucNewFormWizard;
                        ucNewFormWizard = (newformwizard)(LoadControl("controls/forms/newformwizard.ascx"));
                        ucNewFormWizard.ID = "ProgressSteps";
                        phNewFormWizard.Controls.Add(ucNewFormWizard);
                        if (bNewPoll)
                        {
                            PollHtmlScript();
                        }
                    }
                }
            }

            PermissionData cPerms;
            cPerms = m_refContApi.LoadPermissions(m_intContentFolder, "folder", 0);
            m_ctlContentDesigner.FolderId = m_intContentFolder;
            if (2 == m_intContentType)
            {
                m_ctlContentDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.Designer;
            }
            else if (editorPackage.Length > 0)
            {
                m_ctlContentDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.DataEntry;
            }
            else
            {
                m_ctlContentDesigner.ToolsFile = m_refContApi.ApplicationPath + "ContentDesigner/configurations/StandardEdit.aspx?wiki=1";
            }
            m_ctlContentDesigner.SetPermissions(cPerms);
            m_ctlContentDesigner.AllowFonts = true;
            m_ctlSummaryDesigner.FolderId = m_intContentFolder;
            if (2 == m_intContentType)
            {
                m_ctlSummaryDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.XsltDesigner;
            }
            else if (m_bIsBlog)
            {
                m_ctlSummaryDesigner.ToolsFile = m_refContApi.ApplicationPath + "ContentDesigner/configurations/InterfaceBlog.aspx?WMV=1";
            }
            else
            {
                m_ctlSummaryDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.Standard;
            }
            m_ctlSummaryDesigner.SetPermissions(cPerms);
            m_ctlSummaryDesigner.AllowFonts = true;
            m_ctlFormResponseRedirect.FolderId = m_intContentFolder;
            m_ctlFormResponseRedirect.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.NoToolbars;
            m_ctlFormResponseRedirect.SetPermissions(cPerms);
            m_ctlFormResponseRedirect.AllowFonts = true;
            m_ctlFormResponseTransfer.FolderId = m_intContentFolder;
            m_ctlFormResponseTransfer.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.NoToolbars;
            m_ctlFormResponseTransfer.SetPermissions(cPerms);
            m_ctlFormResponseTransfer.AllowFonts = true;
            m_ctlContentValidator.Text = m_refMsg.GetMessage("content size exceeded");
            m_ctlSummaryValidator.Text = m_refMsg.GetMessage("content size exceeded");
            g_ContentTypeSelected = Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes;
            m_refContApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, g_ContentTypeSelected.ToString());
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }