protected void Page_Load(object sender, EventArgs e) { var user = SPContext.Current.Web.CurrentUser; if ((user != null) && user.IsSiteAdmin) { if (!IsPostBack) { chkAlwaysGoThrough.Checked = FileTypesUtility.GetGoThroughValue(); _fileTypes = FileTypesUtility.GetFileTypes(); lstFileTypes.DataSource = _fileTypes.Keys; lstFileTypes.DataBind(); lstFileTypes.SelectedIndex = 0; } } else { var source = string.Format(@"Source={0}/_layouts/ExtentrixWebIntrface/Pages/ContentRedirectionAdminPage.aspx", SPContext.Current.Web.Url); SPUtility.Redirect("/_layouts/AccessDenied.aspx", SPRedirectFlags.Default, Context, source); } }
protected void DeleteFileType_Button(object sender, EventArgs e) { if (lstFileTypes.SelectedIndex >= 0) { FileTypesUtility.DeleteFileType(lstFileTypes.SelectedValue); _fileTypes = FileTypesUtility.GetFileTypes(); lstFileTypes.DataSource = _fileTypes.Keys; lstFileTypes.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (SPContext.Current.IsPopUI) { var queryString = Request.QueryString; try { string action = queryString[ActionKey]; if (action == "New") { if (!Page.IsPostBack) { var applications = FileTypesUtility.GetAllApplications(); foreach (var key in applications.Keys) { var app = applications[key]; ApplicationsList.Items.Add(new ListItem(app.DisplayName, app.InternalName)); } ApplicationsList.Items[0].Selected = true; } } else if (action == "Edit") { if (Page.Session[PublishedApps] == null) { _apps = FileTypesUtility.GetPublishedApplications(Page.Request.LogonUserIdentity); Page.Session[PublishedApps] = _apps; } else { _apps = Page.Session[PublishedApps] as PublishedApplication[]; } if (!Page.IsPostBack) { foreach (var app in _apps) { ApplicationsList.Items.Add(new ListItem(app.Item.FreindlyName, app.AppName)); } ApplicationsList.Items[0].Selected = true; } } } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Extentrix", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace); PageLogger.Error("An error occured during contetent redirection", ex); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { _service = new WebServiceAPI(); var queryString = Request.QueryString; try { string action = queryString[ActionKey]; switch (action) { case "New": string appName = queryString[DocumentAppKey]; var app = FileTypesUtility.GetApplicationByName(appName); LaunchApplication(Page.Request.LogonUserIdentity, GetCurrentHost(), app); break; case "Edit": string fileType = queryString[FileTypeKey]; app = FileTypesUtility.GetApplicationByFileType(fileType); string fileUrl = queryString[FileUrlKey]; LaunchApplicationWithParameter(Page.Request.LogonUserIdentity, GetCurrentHost(), app, fileUrl); break; case "EditThrough": appName = queryString[DocumentAppKey]; string farmName = queryString[DocumentFarmKey]; app = new RedirectionApplication() { InternalName = appName, FarmName = farmName }; fileUrl = queryString[FileUrlKey]; LaunchApplicationWithParameter(Page.Request.LogonUserIdentity, GetCurrentHost(), app, fileUrl); break; } } catch (ThreadAbortException) { //Do nothing } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Extentrix", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace); PageLogger.Error("An error occured during contetent redirection", ex); } } }
protected void Save_OnClick(object sender, EventArgs e) { string appName = dropDownAppName.SelectedValue; PublishedApplication publishedApp = _apps.First(app => app.AppName == appName); RedirectionApplication redirectionApp = new RedirectionApplication() { InternalName = publishedApp.AppName, DisplayName = publishedApp.Item.FreindlyName, FarmName = publishedApp.FarmName }; FileTypesUtility.AddFileType(txtFileType.Text, redirectionApp); string script = "<script type='text/javascript'>window.frameElement.commitPopup('1');</script>"; CloseModalDialog(script); }
protected void Page_Load(object sender, EventArgs e) { if (Page.Session[PublishedApps] == null) { _apps = FileTypesUtility.GetPublishedApplications(Page.Request.LogonUserIdentity); Page.Session[PublishedApps] = _apps; } else { _apps = Page.Session[PublishedApps] as PublishedApplication[]; } if (!IsPostBack) { dropDownAppName.DataSource = _apps; dropDownAppName.DataTextField = "AppName"; dropDownAppName.DataBind(); } }
protected void GoThrough_CheckedChanged(object sender, EventArgs e) { FileTypesUtility.SetGoThroughValue(chkAlwaysGoThrough.Checked); }