Exemplo n.º 1
0
        public string Render(Uri url, IFileViewerOptions options)
        {
            var  pollIdString = url.Segments[url.Segments.Length - 1];
            Guid pollId;

            if (!Guid.TryParse(pollIdString, out pollId))
            {
                throw new FileViewerNotSupportedException();
            }

            var poll = InternalApi.PollingService.GetPoll(pollId);

            if (poll != null)
            {
                return(string.Format("<div style=\"width:{1}\"><div class=\"ui-poll\" data-pollid=\"{0}\" data-showname=\"true\" data-readonly=\"{2}\"></div></div>",
                                     poll.Id.ToString(),
                                     options.Width.HasValue && options.Width.Value > 0 ? options.Width.Value.ToString() + "px" : "inherit",
                                     options.ViewType == FileViewerViewType.Preview ? "true" : "false"
                                     ));
            }
            else
            {
                return(string.Empty);
            }
        }
        public string Render(Uri url, IFileViewerOptions options)
        {
            if (options.ViewType == FileViewerViewType.Preview)
            {
                return(string.Format(@"<div>GitHub Gist Embed for <a href=""{0}""</a>Gist</a></div>", url));
            }

            return(string.Format(@"<script src=""{0}.js""></script>", url));
        }
        public string Render(Uri url, IFileViewerOptions options)
        {
            if (options.ViewType != FileViewerViewType.Preview)
                return CreateRenderedViewerMarkup(url, options.Width.HasValue ? options.Width.Value : 0, options.Height.HasValue ? options.Height.Value : 0);

            HttpContext current = HttpContext.Current;

            if (current != null)
            {
                return PublicApi.UI.GetResizedImageHtml(current.Response.ApplyAppPathModifier(this.GetPreviewImageUrl(url)), options.Height.HasValue ? options.Height.Value : 0, options.Width.HasValue ? options.Width.Value : 0);
            }

            return string.Empty;
        }
Exemplo n.º 4
0
        public string Render(Uri url, IFileViewerOptions options)
        {
            if (options.ViewType != FileViewerViewType.Preview)
            {
                return(CreateRenderedViewerMarkup(url, options.Width.HasValue ? options.Width.Value : 0, options.Height.HasValue ? options.Height.Value : 0));
            }

            HttpContext current = HttpContext.Current;

            if (current != null)
            {
                return(PublicApi.UI.GetResizedImageHtml(current.Response.ApplyAppPathModifier(this.GetPreviewImageUrl(url)), options.Height.HasValue ? options.Height.Value : 0, options.Width.HasValue ? options.Width.Value : 0));
            }

            return(string.Empty);
        }
Exemplo n.º 5
0
        public string Render(Uri url, IFileViewerOptions options)
        {
            var pollIdString = url.Segments[url.Segments.Length - 1];
            Guid pollId;
            if (!Guid.TryParse(pollIdString, out pollId))
                throw new FileViewerNotSupportedException();

            var poll = InternalApi.PollingService.GetPoll(pollId);
            if (poll != null)
                return string.Format("<div style=\"width:{1}\"><div class=\"ui-poll\" data-pollid=\"{0}\" data-showname=\"true\" data-readonly=\"{2}\"></div></div>",
                    poll.Id.ToString(),
                    options.Width.HasValue && options.Width.Value > 0 ? options.Width.Value.ToString() + "px" : "inherit",
                    options.ViewType == FileViewerViewType.Preview ? "true" : "false"
                    );
            else
                return string.Empty;
        }
Exemplo n.º 6
0
 public FileViewerMediaType GetMediaType(ICentralizedFile file, IFileViewerOptions options)
 {
     return(FileViewerMediaType.Empty);
 }
Exemplo n.º 7
0
 public string Render(ICentralizedFile file, IFileViewerOptions options)
 {
     return(string.Empty);
 }
 public FileViewerMediaType GetMediaType(ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
Exemplo n.º 9
0
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     return(FileViewerMediaType.Video);
 }
 public FileViewerMediaType GetMediaType(ICentralizedFile file, IFileViewerOptions options)
 {
     return FileViewerMediaType.Empty;
 }
Exemplo n.º 11
0
 public string Render(Evolution.Extensibility.Storage.Version1.ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
Exemplo n.º 12
0
 public FileViewerMediaType GetMediaType(Evolution.Extensibility.Storage.Version1.ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
Exemplo n.º 13
0
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     return FileViewerMediaType.Video;
 }
 public string Render(ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
 public string Render(ICentralizedFile file, IFileViewerOptions options)
 {
     return string.Empty;
 }
Exemplo n.º 16
0
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
Exemplo n.º 17
0
 public string Render(Uri url, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     return options.ViewType == FileViewerViewType.Preview ? FileViewerMediaType.Image : FileViewerMediaType.Video;
 }
Exemplo n.º 19
0
        public string Render(ICentralizedFile file, IFileViewerOptions options)
        {
            var appData = Telligent.Evolution.Mobile.ServiceLocator.Get <Telligent.Evolution.Mobile.App.Services.IAppDataService>().Get(file);

            if (appData == null || appData.Image == null)
            {
                throw new FileViewerNotSupportedException();
            }

            if (options.ViewType == FileViewerViewType.Preview)
            {
                return(Telligent.Evolution.Extensibility.Api.Version1.PublicApi.UI.GetResizedImageHtml(CentralizedFileStorage.GetGenericDownloadUrl(appData.Image), options.Width.HasValue ? options.Width.Value : 0, options.Height.HasValue ? options.Height.Value : 0, new UiGetResizedImageHtmlOptions {
                    ResizeMethod = "ZoomAndCrop", OutputIsPersisted = options.OutputIsPersisted
                }));
            }
            else
            {
                StringBuilder html       = new StringBuilder();
                string        installUrl = null;

                var installer = PluginManager.Get <AppInstaller>().FirstOrDefault();
                if (installer != null)
                {
                    installUrl = installer.FormatInstallationUrl(appData);
                }

                if (!string.IsNullOrEmpty(installUrl))
                {
                    html.Append("<a href=\"");
                    html.Append(PublicApi.Html.Encode(installUrl));
                    html.Append("\" style=\"display:inline-block; background-color: #f3f3f3; color: #555; text-align: center; text-decoration: none; padding: 2px; border-radius: 10px;\" class=\"app-viewer with-install\">");
                }
                else
                {
                    html.Append("<span class=\"app-view without-install\">");
                }

                html.Append(Telligent.Evolution.Extensibility.Api.Version1.PublicApi.UI.GetResizedImageHtml(CentralizedFileStorage.GetGenericDownloadUrl(appData.Image), options.Width.HasValue ? options.Width.Value : 0, options.Height.HasValue ? options.Height.Value : 0, new UiGetResizedImageHtmlOptions
                {
                    ResizeMethod      = "ScaleDown",
                    OutputIsPersisted = options.OutputIsPersisted,
                    HtmlAttributes    = new Dictionary <string, string>
                    {
                        { "style", "border-radius: 10px; display: inline-block;" }
                    }
                }));

                if (!string.IsNullOrEmpty(installUrl))
                {
                    html.Append("<div style=\"padding: 8px;\">");

                    if (appData.IsDirectlyInstallable)
                    {
                        html.Append(_translation.GetLanguageResourceValue("ota_install"));
                    }
                    else
                    {
                        html.Append(_translation.GetLanguageResourceValue("itunes_install"));
                    }

                    html.Append("</div></a>");
                }
                else
                {
                    html.Append("</span>");
                }

                return(html.ToString());
            }
        }
Exemplo n.º 20
0
 public FileViewerMediaType GetMediaType(Evolution.Extensibility.Storage.Version1.ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
Exemplo n.º 21
0
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     return(options.ViewType == FileViewerViewType.Preview ? FileViewerMediaType.Image : FileViewerMediaType.Video);
 }
Exemplo n.º 22
0
 public string Render(Evolution.Extensibility.Storage.Version1.ICentralizedFile file, IFileViewerOptions options)
 {
     throw new FileViewerNotSupportedException();
 }
 public FileViewerMediaType GetMediaType(Uri url, IFileViewerOptions options)
 {
     return(FileViewerMediaType.Document);
 }