Exemplo n.º 1
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            var fileName = (sender as LinkButton).CommandName;

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            var file = Wiki.GetFile(fileName);

            Wiki.RemoveFile(fileName);
            if (file != null && !string.IsNullOrEmpty(file.FileLocation))
            {
                try
                {
                    EditFile.DeleteContent(file.FileLocation, ConfigLocation, PageWikiSection, TenantId, HttpContext.Current);
                }
                catch
                {
                }
            }
            BindRepeater();
        }
Exemplo n.º 2
0
        protected string GetFileLink()
        {
            var file = Wiki.GetFile(FileName);

            if (file == null)
            {
                RisePageEmptyEvent();
                return(string.Empty); // "nonefile.png";
            }

            var ext = file.FileLocation.Split('.')[file.FileLocation.Split('.').Length - 1];

            if (!string.IsNullOrEmpty(ext) && !WikiFileHandler.ImageExtentions.Contains(ext.ToLower()))
            {
                return(string.Format(@"<a class=""linkMedium"" href=""{0}"" title=""{1}"">{2}</a>",
                                     ResolveUrl(string.Format(ImageHandlerUrlFormat, FileName)),
                                     file.FileName,
                                     Resources.WikiUCResource.wikiFileDownloadCaption));
            }

            return(string.Format(@"<img src=""{0}"" style=""max-width:300px; max-height:200px"" />",
                                 ResolveUrl(string.Format(ImageHandlerUrlFormat, FileName))));
        }