protected void ddlFileEncodings_SelectedIndexChanged(object sender, EventArgs e) { try { string path = (string)ViewState["EditFile"]; txtEditFileContent.Text = GetFileContent(path, ddlFileEncodings.SelectedValue); EditFileModal.Show(); } catch (Exception ex) { messageBox.ShowErrorMessage("FILES_READ_FILE", ex); } }
protected void gvFiles_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "browse") { string fileName = (string)e.CommandArgument; litPath.Text += HttpContext.Current.Server.HtmlEncode((litPath.Text != "\\") ? ("\\" + fileName) : fileName); BindPath(); } else if (e.CommandName == "download") { string path = GetFullRelativePath((string)e.CommandArgument); Response.Redirect(NavigateURL(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "DownloadFile=" + Server.UrlEncode(path))); } else if (e.CommandName == "edit_file") { // read file content try { string path = GetFullRelativePath((string)e.CommandArgument); ViewState["EditFile"] = path; txtEditFileContent.Text = GetFileContent(path, ddlFileEncodings.SelectedValue); // show edit panel EditFileModal.Show(); } catch (Exception ex) { messageBox.ShowErrorMessage("FILES_READ_FILE", ex); } } else if (e.CommandName == "edit_permissions") { // read file content try { string path = GetFullRelativePath((string)e.CommandArgument); ViewState["EditPermissions"] = path; UserPermission[] users = ES.Services.Files.GetFilePermissions(PanelSecurity.PackageId, path); gvFilePermissions.DataSource = users; gvFilePermissions.DataBind(); // show permissions panel PermissionsFileModal.Show(); } catch (Exception ex) { messageBox.ShowErrorMessage("FILES_READ_PERMISSIONS", ex); } } else if (e.CommandName == "rename") { RenameFileModal.Show(); ViewState["RenameFile"] = (string)e.CommandArgument; txtRenameFile.Text = (string)e.CommandArgument; } }