private void RegisterTypes() { string exts = _pluginEnvironment.SettingStore.ReadString("FilePlugin", "MSWordExts"); exts = (exts.Length == 0) ? ".doc,.rtf" : exts + ",.doc,.rtf"; FileTypesMap.GetInstance().RegisterFileResourceType(cMSWordFile, "Source", exts.Split(',')); }
void IResourceDisplayer.DisplayResource(Control displayPane, IResource resource) { _navigateComplete = false; _highlightWords = false; if (_MSWord != null) { try { _MSWord.Quit(ref FALSE, ref MissingValue, ref MissingValue); } catch (Exception exception) { _tracer.TraceException(exception); } _MSWord = null; } _strFileName = FileResource.GetSourceFile(resource, _pluginEnvironment); if (_strFileName != null) { _savedEditFlags = FileTypesMap.GetEditFlags("Word.Document"); FileTypesMap.SetEditFlags("Word.Document", _savedEditFlags | 0x10000); // FTA_OpenIsSafe _refreshTimer.Start(); AxIEBrowser.AxCIEBrowserCtl preview = (AxIEBrowser.AxCIEBrowserCtl)displayPane; preview.Navigate(_strFileName); } }
public void rptFiles_ItemDataBound(object sender, RepeaterItemEventArgs e) { var redirectionUrl = (RedirectionUrl)e.Item.DataItem; var downloadUrl = UrlHelper.GetUrlFromSection(RedirectionModule.Section) + "/redirect/" + redirectionUrl.Id; var hplFileImg = (HyperLink)e.Item.FindControl("hplFileImg"); hplFileImg.NavigateUrl = downloadUrl; hplFileImg.ImageUrl = base.Page.ResolveUrl("~/Modules/Downloads/Images/" + FileTypesMap.GetIconFilename(System.IO.Path.GetExtension(redirectionUrl.Url))); var hplFile = (HyperLink)e.Item.FindControl("hplFile"); hplFile.NavigateUrl = downloadUrl; var lblDateModified = (Label)e.Item.FindControl("lblDateModified"); lblDateModified.Text = TimeZoneUtil.AdjustDateToUserTimeZone( redirectionUrl.DatePublished, this.Page.User.Identity).ToString(); var lblPublisher = (Label)e.Item.FindControl("lblPublisher"); lblPublisher.Text += " Published at " + redirectionUrl.Publisher.FullName; var lblNumberOfDownloads = (Label)e.Item.FindControl("lblNumberOfDownloads"); lblNumberOfDownloads.Text += "Downloads: " + redirectionUrl.NumberOfDownloads; }
public void Dispose() { FileTypesMap.GetInstance().DeregisterFileResourceType(cMSWordFile, _pluginEnvironment); try { if (_MSWord != null) { _MSWord.Quit(ref FALSE, ref MissingValue, ref MissingValue); } } catch (Exception exception) { _tracer.TraceException(exception); } }
private void rptFiles_ItemDataBound(object sender, RepeaterItemEventArgs e) { FileResource file = e.Item.DataItem as FileResource; if (file != null && file.IsViewAllowed(base.Page.User)) { string downloadUrl = file.GetContentUrl(); string fileDetails = file.FileName + " (" + file.Length + " bytes)"; HyperLink hplFileImg = e.Item.FindControl("hplFileImg") as HyperLink; hplFileImg.NavigateUrl = downloadUrl; hplFileImg.ImageUrl = base.Page.ResolveUrl("~/Modules/Downloads/Images/" + FileTypesMap.GetIconFilename(Path.GetExtension(file.FileName))); hplFileImg.Text = fileDetails; HyperLink hplFile = e.Item.FindControl("hplFile") as HyperLink; hplFile.NavigateUrl = downloadUrl; hplFile.ToolTip = fileDetails; Panel pnlFileDetails = e.Item.FindControl("pnlFileDetails") as Panel; pnlFileDetails.Visible = (this.Module.ShowDateModified || this.Module.ShowPublisher || this.Module.ShowNumberOfDownloads); if (this.Module.ShowDateModified) { Label lblDateModified = e.Item.FindControl("lblDateModified") as Label; lblDateModified.Visible = true; lblDateModified.Text = TimeZoneUtil.AdjustDateToUserTimeZone( file.PublishedAt.Value, this.Page.User.Identity).ToString(); } if (this.Module.ShowPublisher) { Label lblPublisher = e.Item.FindControl("lblPublisher") as Label; lblPublisher.Visible = true; lblPublisher.Text += base.GetText("PUBLISHEDBY") + " " + file.ModifiedBy.FullName; } if (this.Module.ShowNumberOfDownloads) { Label lblNumberOfDownloads = e.Item.FindControl("lblNumberOfDownloads") as Label; lblNumberOfDownloads.Visible = true; lblNumberOfDownloads.Text += base.GetText("NUMBEROFDOWNLOADS") + ": " + file.DownloadCount; } } else { e.Item.Visible = false; } }
void IResourceDisplayer.EndDisplayResource(Control displayPane, IResource resource) { if (_savedEditFlags != -1) { FileTypesMap.SetEditFlags("Word.Document", _savedEditFlags); _savedEditFlags = -1; } if (_strFileName != null) { try { _cleanup = true; _cleanupResource = resource; _preview.Navigate("about:blank"); } catch (Exception exception) { _tracer.TraceException(exception); } } }