Esempio n. 1
0
    private void Process_DoMoveContent()
    {
        string strContentIds = "";
            long intMoveFolderId = 0;
            string FolderPath = "";

            try
            {
                strContentIds = Request.Form[contentids.UniqueID];
                m_refContent = m_refContentApi.EkContentRef;
                intMoveFolderId = m_refContent.GetFolderID(Request.Form["move_folder_id"]);

                if (Request.Form[hdnCopyAll.UniqueID] == "true")
                {
                    bool publishContent = false;
                    if (! (Request.Form["btn_PublishCopiedContent"] == null) && Request.Form["btn_PublishCopiedContent"].ToString() == "on")
                    {
                        publishContent = true;
                    }
                    m_refContent.CopyAllLanguageContent(m_intId, intMoveFolderId, publishContent);
                }
                else
                {
                    if (! (Request.Form[RadBtnMoveCopyValue.UniqueID] == null) && Request.Form[RadBtnMoveCopyValue.UniqueID].ToString() == "copy")
                    {
                        bool bPublish = false;
                        if (! (Request.Form["btn_PublishCopiedContent"] == null) && Request.Form["btn_PublishCopiedContent"].ToString() == "on")
                        {
                            bPublish = true;
                        }
                        m_refContent.CopyContentByID(strContentIds, ContentLanguage, intMoveFolderId, bPublish);
                    }
                    else
                    {
                        m_refContent.MoveContent(strContentIds, ContentLanguage, intMoveFolderId);
                    }
                }

                FolderPath = m_refContent.GetFolderPath(intMoveFolderId);
                if ((FolderPath.Substring(FolderPath.Length - 1, 1) == "\\"))
                {
                    FolderPath = FolderPath.Substring(FolderPath.Length - FolderPath.Length - 1, FolderPath.Length - 1);
                }
                FolderPath = FolderPath.Replace("\\", "\\\\");

                if (CallerPage.ToLower() == "webpage")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseScript", GetCloseScript());
                }
                else if ((CallerPage != "content.aspx") && (CallerPage != "cmsform.aspx") && (CallerPage != "")) //TODO:Verify
                {
                    if (CallerPage.Trim().Length == 0)
                    {
                        CallerPage = "Cmsform.aspx";
                    }
                    Response.Redirect(CallerPage + "?LangType=" + ContentLanguage + "&action=ViewAllFormsByFolderID&folder_id=" + intMoveFolderId + "&reloadtrees=Content,Library&TreeNav=" + FolderPath, false);
                }
                else
                {
                    Response.Redirect((string) ("content.aspx?LangType=" + ContentLanguage + "&action=ViewContentByCategory&id=" + intMoveFolderId + "&reloadtrees=Content,Library&TreeNav=" + FolderPath), false);
                }
            }
            catch (Exception ex)
            {
                int intError;
                string strError;
                strError = "because a record with the same title exists in the destination folder";
                intError = ex.Message.IndexOf(strError);
                if (intError > -1)
                {
                    strError = ex.Message.Substring(0, intError + strError.Length);
                    Response.Redirect((string) ("reterror.aspx?info=" + EkFunctions.UrlEncode(strError + ".") + "&LangType=" + ContentLanguage), false);
                }
                else
                {
                    Response.Redirect((string) ("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message) + "&LangType=" + ContentLanguage), false);
                }

            }
    }