protected void btnNext_Click(object sender, System.EventArgs e)
    {
        Ektron.Cms.CommonApi api = new Ektron.Cms.CommonApi();
            string desc = "";
            int width = 800;
            string address = "";
            int isimage = 0;
            this.panelImageProperties.Visible = true;
            this.panelDragDrop.Visible = false;
            if (Request.QueryString["prop"] == "image")
            {
                isimage = 1;
            }
            if ((Request.QueryString["type"] != null)&& Request.QueryString["type"] == "update")
            {
                long id = 0;
                if (Request.QueryString["id"] != null)
                {
                    id = Convert.ToInt64(Request.QueryString["id"]);

                    Ektron.Cms.ContentEditData data;
                    Ektron.Cms.ContentAPI apiContent = new Ektron.Cms.ContentAPI();
                    int metaId = 0;
                    data = apiContent.GetContentForEditing(id);
                    if (this.ekImagegalleryTitle.Value.IndexOf("<") != -1 || this.ekImagegalleryTitle.Value.IndexOf(">") != -1 || this.ekImagegalleryTitle.Value.IndexOf("\'") != -1 || this.ekImagegalleryTitle.Value.IndexOf("\"") != -1)
                    {
                        this.ekImagegalleryTitle.Value = this.ekImagegalleryTitle.Value.Replace("<", "").Replace(">", "").Replace("\'", "").Replace("\"", "");
                    }
                    data.Title = (string) this.ekImagegalleryTitle.Value;
                    data.Teaser = (string) ctlEditor.Content;
                    content_teaser.Value = ctlEditor.Content;
                    data.FileChanged = false;
                    apiContent.SaveContent(data);
                    if (Request.QueryString["prop"] == "image")
                    {
                        isimage = 1;
                        foreach (Ektron.Cms.ContentMetaData item in data.MetaData)
                        {
                            if (item.TypeName.ToLower() == "mapaddress")
                            {
                                metaId = Convert.ToInt32(item.TypeId);
                                break;
                            }
                        }
                        if (metaId > 0)
                        {
                            apiContent.UpdateContentMetaData(data.Id, metaId, (string) this.ekImagegalleryAddress.Value);
                        }
                    }
                    apiContent.PublishContentById(id, data.FolderId, data.LanguageId, "", api.UserId, "");
                    this.ctlEditor.Visible = false; //so that the content designer will not be initialized again.
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close_box", "Close();", true);
                }
            }
            else
            {
                desc = (string) ctlEditor.Content;
                if (Request.Form["ekImagegalleryImageWidth"] != null)
                {
                    width = System.Convert.ToInt32(Request.Form["ekImagegalleryImageWidth"].ToString());
                }
                if (Request.Form["ekImagegalleryAddress"] != null)
                {
                    address = (string) (Request.Form["ekImagegalleryAddress"].ToString());
                }

                string[] imageProp = new string[4];
                imageProp[0] = width.ToString(); //width
                imageProp[1] = "-1"; //height
                imageProp[2] = address; //mapaddress
                imageProp[3] = desc; //Descriptions

                Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Remove(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta");
                Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Add(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta", imageProp);

                this.ctlEditor.Visible = false; //so that the content designer will not be initialized again.
                string _doHide = string.Empty;
                string _galleryString = string.Empty;
                if (! (Request.QueryString["hidecancel"] == null) && Request.QueryString["hidecancel"] == "true")
                {
                    _doHide = "&hidecancel=true";
                }
                if (! (Request.QueryString["isimagegallery"] == null) && Request.QueryString["isimagegallery"] == "true")
                {
                    _galleryString = "&isimagegallery=true";
                }

                Response.Redirect(m_refContApi.AppPath + "DragDropCtl.aspx?mode=0&folder_id=" + Request.QueryString["folderiD"] + "&lang_id=" + m_refContApi.ContentLanguage + "&TaxonomyId=" + Request.QueryString["TaxonomyId"] + "&isimage=" + isimage + _doHide + _galleryString);
            }
    }
예제 #2
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //30257- This document should never be cached.  When content status changes
            //the page is refreshed to show change in status.  This change does
            //not appear when page is cached.
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            long contentid = 0;
            //long folderid = 0;
            int ContentLanguage = -1;
            CommonApi AppUI = new CommonApi();
            Ektron.Cms.ContentAPI content_api = new Ektron.Cms.ContentAPI();

            if (! (Request.QueryString["id"] == null))
            {
                contentid = Convert.ToInt64(Request.QueryString["id"]);

                if ((!(Request.QueryString["LangType"] == null)) && (int.TryParse(Request.QueryString["LangType"], out ContentLanguage)) && (ContentLanguage > 0))
                {
                    if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                    {
                        ContentLanguage = AppUI.DefaultContentLanguage;
                    }
                    AppUI.ContentLanguage = ContentLanguage;
                    content_api.ContentLanguage = ContentLanguage;
                }
                else
                {
                    ContentLanguage = AppUI.DefaultContentLanguage;
                }
                content_edit_data = content_api.GetContentForEditing(contentid);
                if (! (Request.QueryString["executeActiveX"] == null) && Request.QueryString["executeActiveX"] == "true" )
                {
                    string strfilename;
                    AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService();
                    Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(content_edit_data.AssetData.Id);
                    strfilename = (string) (GetFolderPath(content_edit_data.FolderId) + assetData.Handle);
                    string sJS = "";
                    if (Page.Request.UserAgent.ToLower().Contains("firefox"))
                    {
                        sJS = "editDocumentWithProgIDNoUI('" + getFilePath(content_edit_data.FolderId) + assetData.Handle + "', '', 'SharePoint.OpenDocuments', '0', '" + getSiteAddress() + "', '0');";
                        string backURL = content_api.AppPath + Page.Request.QueryString["back_callerpage"] + "?" + Page.Request.QueryString["back_origurl"];
                        sJS += "window.location.href='" + this.Request.UrlReferrer + "'";
                    }else
                    {
                        sJS = "editInMSOffice(\'" + strfilename + "\');";
                    }
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "ShowInOffice", sJS.ToString(), true);
                }
            }
    }