protected void lbnOK_Click(object sender, EventArgs e) { //ensure path works before saving changes if (!VerifyPath()) return; try { FileConfigurationController ctrl = new FileConfigurationController(); List<FileConfiguration> configs = ctrl.GetItems(PortalId) as List<FileConfiguration>; FileConfiguration config = null; if (configs.Count > 0) { config = configs[0]; } else { config = new FileConfiguration(); config.ID = -1; } config.FilesLocation = txtFilesLocation.Text; config.LastModifiedByUserName = UserInfo.DisplayName; config.LastModifiedDate = System.DateTime.Now; config.PortalID = PortalId; config.StorageType = radStorageLocation.SelectedValue; if (config.ID == -1) { ctrl.Create(config); } else { ctrl.Update(config); } //refresh cac SynchronizeModule(); //Redirect back to the portal home page this.Response.Redirect(Globals.NavigateURL(), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void Page_Load(System.Object sender, System.EventArgs e) { if (!Page.IsPostBack) { try { FileConfigurationController ctrl = new FileConfigurationController(); List<FileConfiguration> configs = ctrl.GetItems(PortalId) as List<FileConfiguration>; if (configs.Count > 0) { txtFilesLocation.Text = configs[0].FilesLocation; LockFormWithExistingConfig(); radStorageLocation.SelectedValue = configs[0].StorageType; } SetTextEditable(); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } }
private void SetTextEditable() { switch (radStorageLocation.SelectedValue) { case "Portal": txtFilesLocation.Text = "~/portals/" + PortalId.ToString() + "/QDocsPro/"; txtFilesLocation.Enabled = false; break; default: txtFilesLocation.Enabled = true; FileConfigurationController ctrl = new FileConfigurationController(); List<FileConfiguration> configs = ctrl.GetItems(PortalId) as List<FileConfiguration>; if (configs.Count > 0) { txtFilesLocation.Text = configs[0].FilesLocation; } break; } }
protected void RadImageEditor1_ImageSaving(object sender, ImageEditorSavingEventArgs e) { System.Drawing.Image modifiedImage = e.Image.Image; string strName = e.FileName; string strFormat = "image/unknown"; long imageLength; var imgguid = modifiedImage.RawFormat.Guid; foreach (ImageCodecInfo codec in ImageCodecInfo.GetImageDecoders()) { if (codec.FormatID == imgguid) { strFormat = codec.MimeType; break; } } //get parameters if (this.Request.QueryString["File"] != null) { _FileID = Int32.Parse(this.Request.QueryString["File"]); } if (this.Request.QueryString["Parent"] != null) { _ParentID = Int32.Parse(this.Request.QueryString["Parent"]); } //get current/root file DNNQuickApps.Modules.QuickDocsPro.FileController objQuickFiles = new DNNQuickApps.Modules.QuickDocsPro.FileController(); File objOriginalFile = objQuickFiles.Get(_FileID); objOriginalFile.LastModifiedDate = System.DateTime.Now; objOriginalFile.LastModifiedByUserID = UserId; if (UserId != -1) { objOriginalFile.LastModifiedByUserName = UserInfo.DisplayName; } else { objOriginalFile.LastModifiedByUserName = "******"; } //increment version number objOriginalFile.VersionNumber = objOriginalFile.VersionNumber + 1; //objOriginalFile.AttachmentName = fileUpload.FileName; //create file version and copy attributes from current version DNNQuickApps.Modules.QuickDocsPro.File objFile = new DNNQuickApps.Modules.QuickDocsPro.File(); if ((string)Settings["IsSearchable"] != null) { if (!Convert.ToBoolean(Settings["IsSearchable"].ToString())) { objFile.ModuleID = ModuleId; } } objFile.PortalID = PortalId; objFile.Name = strName; objFile.CreatedByUserID = objOriginalFile.LastModifiedByUserID; objFile.CreatedDate = objOriginalFile.LastModifiedDate; objFile.CreatedByUserName = objOriginalFile.LastModifiedByUserName; objFile.LastModifiedDate = objOriginalFile.LastModifiedDate; objFile.LastModifiedByUserID = objOriginalFile.LastModifiedByUserID; objFile.LastModifiedByUserName = objOriginalFile.LastModifiedByUserName; objFile.VersionsToKeep = -1; objFile.VersionNumber = objOriginalFile.VersionNumber; objFile.ItemType = objOriginalFile.ItemType; objFile.HomeFolderUserID = objOriginalFile.HomeFolderUserID; objFile.RoleID = objOriginalFile.RoleID; //Set parent to root/current file objFile.ParentID = _FileID; objQuickFiles.Update(objOriginalFile); objQuickFiles.Create(objFile); //upload file version FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; if (configs[0].StorageType == "UNC") { objFile.CreatePath(configs[0].FilesLocation); string strPath = configs[0].FilesLocation + objFile.GetFullPath(); e.Image.Image.Save(strPath); //fileUpload.SaveAs(configs[0].FilesLocation + objFile.GetFullPath()); imageLength = new System.IO.FileInfo(strPath).Length; } else { objFile.CreatePath(Server.MapPath(configs[0].FilesLocation)); string strPath = configs[0].FilesLocation + objFile.GetFullPath(); e.Image.Image.Save(Server.MapPath(strPath)); //fileUpload.SaveAs(Server.MapPath(configs[0].FilesLocation) + objFile.GetFullPath()); imageLength = new System.IO.FileInfo(Server.MapPath(strPath)).Length; } List<string> fileNameAndExtension = objFile.GetFileNameAndExtension(objOriginalFile.Name);//fileUpload.FileName); objFile.AttachmentPath = objFile.GetFullPath(); objFile.FileType = strFormat; // fileUpload.PostedFile.ContentType; objFile.FileLength = (int)imageLength; //fileUpload.PostedFile.ContentLength; objFile.Name = strName;//fileNameAndExtension[0]; objFile.Extension = objOriginalFile.Extension;// fileNameAndExtension[1]; objFile.AttachmentName = String.Format("{0}.{1}", objFile.Name, objFile.Extension); //.AttachmentName; // fileUpload.FileName; objOriginalFile.AttachmentPath = objFile.GetFullPath(); objOriginalFile.FileType = strFormat; //fileUpload.PostedFile.ContentType; objOriginalFile.FileLength = (int)imageLength;//fileUpload.PostedFile.ContentLength; //Don't change file name or extension when uploading new image version, only version gets new file name //objOriginalFile.Name = fileNameAndExtension[0]; //objOriginalFile.Extension = fileNameAndExtension[1]; objQuickFiles.Update(objOriginalFile); objQuickFiles.Update(objFile); //this.Response.RedirectLocation = Globals.NavigateURL(this.TabId, "", "Folder=" + _ParentID.ToString(), "ModuleID=" + ModuleId, "View=" + _view, "UserID=" + _userIDParameter, "GroupID=" + _roleIDParameter); DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "New version saved successfully.", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess); e.Cancel = true; }
protected void lbnOK_Click(object sender, EventArgs e) { try { //check file type first //if (fileUpload.HasFile) //{ // string strAllowedFiles = DotNetNuke.Entities.Controllers.HostController.Instance.GetString("FileExtensions"); // string[] strSearchPatterns = strAllowedFiles.Split(','); // string uploadType = fileUpload.PostedFile.FileName.Substring(fileUpload.PostedFile.FileName.LastIndexOf('.')+1); // if (!strAllowedFiles.Contains(uploadType)) // { // DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "File type not allowed", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); // return; // } //} //create file DNNQuickApps.Modules.QuickDocsPro.FileController objQuickFiles = new DNNQuickApps.Modules.QuickDocsPro.FileController(); DNNQuickApps.Modules.QuickDocsPro.File objFile = new DNNQuickApps.Modules.QuickDocsPro.File(); //if (!Convert.ToBoolean(Settings["IsSearchable"].ToString())) //{ // objFile.ModuleID = ModuleId; //} objFile.PortalID = PortalId; objFile.CreatedByUserID = UserId; objFile.CreatedDate = System.DateTime.Now; objFile.LastModifiedDate = System.DateTime.Now; objFile.LastModifiedByUserID = UserId; objFile.VersionsToKeep = -1; objFile.VersionNumber = 1; //check files type (shared, user, groups) String strFilesModuleType = Settings["FilesMode"].ToString(); if (strFilesModuleType == "UserFiles" || strFilesModuleType == "GroupFiles") { if (strFilesModuleType == "UserFiles") { //get UserID parameter if (this.Request.QueryString["UserID"] != null) { _userIDParameter = Convert.ToInt32(this.Request.QueryString["UserID"]); } objFile.HomeFolderUserID = _userIDParameter; } else //group files { //get UserID parameter if (this.Request.QueryString["GroupID"] != null) { _roleIDParameter = Convert.ToInt32(this.Request.QueryString["GroupID"]); } objFile.RoleID = _roleIDParameter; } } if (UserId != -1) { objFile.CreatedByUserName = UserInfo.DisplayName; objFile.LastModifiedByUserName = UserInfo.DisplayName; } else { objFile.CreatedByUserName = "******"; objFile.LastModifiedByUserName = "******"; } //create file or folder if (this.Request.QueryString["Type"] != null) { ItemType = Convert.ToInt32(this.Request.QueryString["Type"]); } if (ItemType == 1)//File { //check file exists if (asyncFileUpload.UploadedFiles.Count == 0) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Please select a valid file to upload", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); return; } objFile.Name = "File Upload"; objFile.ItemType = 1; } else if (ItemType == 0) //folder { objFile.Name = txtName.Text; objFile.ItemType = 0; objFile.IsFolder = true; } else if (ItemType == 2) //Hyperlink { objFile.Name = txtName.Text; objFile.ItemType = 2; objFile.LinkURL = txtHyperlink.Text; } else { Response.Redirect(Globals.NavigateURL(), true); } if (this.Request.QueryString["Parent"] != null) { ParentID = Int32.Parse(this.Request.QueryString["Parent"]); } objFile.ParentID = ParentID; objFile.Description = ""; //create file objQuickFiles.Create(objFile); if (ItemType == 1) //file { //create file version and copy attributes from current version DNNQuickApps.Modules.QuickDocsPro.File objVersionFile = new DNNQuickApps.Modules.QuickDocsPro.File(); //if (!Convert.ToBoolean(Settings["IsSearchable"].ToString())) //{ // objVersionFile.ModuleID = ModuleId; //} objVersionFile.PortalID = PortalId; objVersionFile.CreatedByUserID = objFile.CreatedByUserID; objVersionFile.CreatedDate = objFile.LastModifiedDate; objVersionFile.CreatedByUserName = objFile.CreatedByUserName; objVersionFile.LastModifiedDate = objFile.LastModifiedDate; objVersionFile.LastModifiedByUserID = objFile.LastModifiedByUserID; objVersionFile.LastModifiedByUserName = objFile.LastModifiedByUserName; objVersionFile.LinkURL = objFile.LinkURL; objVersionFile.ItemType = objFile.ItemType; objVersionFile.VersionsToKeep = -1; objVersionFile.VersionNumber = objFile.VersionNumber; objVersionFile.ParentID = objFile.ID; objVersionFile.Name = "Version Upload"; objVersionFile.Description = objFile.Description; objVersionFile.HomeFolderUserID = objFile.HomeFolderUserID; objVersionFile.RoleID = objFile.RoleID; objQuickFiles.Create(objVersionFile); //upload file version FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; if (configs[0].StorageType == "UNC") { objVersionFile.CreatePath(configs[0].FilesLocation); //fileUpload.SaveAs(configs[0].FilesLocation + objVersionFile.GetFullPath()); asyncFileUpload.UploadedFiles[0].SaveAs(configs[0].FilesLocation + objVersionFile.GetFullPath()); } else { objVersionFile.CreatePath(Server.MapPath(configs[0].FilesLocation)); //fileUpload.SaveAs(Server.MapPath(configs[0].FilesLocation) + objVersionFile.GetFullPath()); asyncFileUpload.UploadedFiles[0].SaveAs(Server.MapPath(configs[0].FilesLocation) + objVersionFile.GetFullPath()); } //List<string> fileNameAndExtension = objVersionFile.GetFileNameAndExtension(fileUpload.FileName); List<string> fileNameAndExtension = objVersionFile.GetFileNameAndExtension(asyncFileUpload.UploadedFiles[0].FileName); objVersionFile.AttachmentName = asyncFileUpload.UploadedFiles[0].FileName;// fileUpload.FileName; objVersionFile.AttachmentPath = objVersionFile.GetFullPath(); objVersionFile.FileType = asyncFileUpload.UploadedFiles[0].ContentType;// fileUpload.PostedFile.ContentType; objVersionFile.FileLength = (int)asyncFileUpload.UploadedFiles[0].ContentLength;// fileUpload.PostedFile.ContentLength; objVersionFile.Name = fileNameAndExtension[0]; objVersionFile.Extension = fileNameAndExtension[1]; objFile.AttachmentPath = objVersionFile.GetFullPath(); objFile.FileType = asyncFileUpload.UploadedFiles[0].ContentType;// fileUpload.PostedFile.ContentType; objFile.FileLength = (int)asyncFileUpload.UploadedFiles[0].ContentLength;// fileUpload.PostedFile.ContentLength; objFile.Name = fileNameAndExtension[0]; objFile.Extension = fileNameAndExtension[1]; objQuickFiles.Update(objVersionFile); objQuickFiles.Update(objFile); } //create permissions PermissionController objQuickPermissions = new PermissionController(); foreach (GridViewRow row in gridPermissions.Rows) { if ((((CheckBox)row.FindControl("chkCanSee")).Checked)) { Permission perm = new Permission(); perm.CanSee = true; perm.CanAddFiles = ((CheckBox)row.FindControl("chkCanAddFolders")).Checked; perm.CanAddFolders = ((CheckBox)row.FindControl("chkCanAddItems")).Checked; perm.CanModify = ((CheckBox)row.FindControl("chkCanModify")).Checked; perm.CanDelete = ((CheckBox)row.FindControl("chkCanDelete")).Checked; perm.CanModifyPermission = ((CheckBox)row.FindControl("chkCanModifyPermission")).Checked; perm.FileID = objFile.ID; int userID = Int32.Parse(row.Cells[8].Text); int roleID = Int32.Parse(row.Cells[10].Text); string userName = row.Cells[9].Text; string roleName = row.Cells[11].Text; if (userID > 0) { perm.UserID = userID; perm.UserName = userName; } if (roleID > 0) { perm.RoleID = roleID; perm.RoleName = roleName; } objQuickPermissions.Create(perm); } } //refresh cac SynchronizeModule(); //Redirect back to the parent folder page //Redirect back to the portal home page string strItemType = "Folder"; switch (ItemType) { case 0: strItemType = "Folder"; break; case 1: strItemType = "File"; break; case 2: strItemType = "Hyperlink"; break; } #region "Audit" //Audit: Create Item AuditController ctrlAudit = new AuditController(); Audit createAudit = new Audit() { EventDate = objFile.CreatedDate, EventDetails = "File name: " + objFile.Name, EventName = "Created", FileID = objFile.ID, UserID = UserId }; ctrlAudit.Create(createAudit); #endregion string successMessage = String.Format("Success=New {0} '{1}' created.", strItemType, objFile.Name); this.Response.Redirect(Globals.NavigateURL(this.TabId, "", "Folder=" + objFile.ParentID, "ModuleID=" + ModuleId.ToString(), "UserID=" + _userIDParameter, "GroupID=" + _roleIDParameter, successMessage), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private void OpenFile(int fileID, int versionNumber, string strMode) { FileController ctrl = new FileController(); File file; File requestedFile = ctrl.Get(fileID); if (versionNumber == -1) { if (requestedFile.ItemType == 1) //file, don't need version of link { file = ctrl.GetCurrentVersion(fileID); } else { file = requestedFile; //set open to requested file } } else { file = ctrl.GetVersion(fileID, versionNumber); } FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; if (file != null) { if (requestedFile.CanSee(UserId, PortalId, PortalSettings.AdministratorRoleId, true)) { if (file.ItemType == 2) //hyperlink { #region "Audit" //Audit: Create Item AuditController ctrlAudit = new AuditController(); Audit viewAudit = new Audit() { EventDate = System.DateTime.Now, EventDetails = "", EventName = "Opened Link", FileID = requestedFile.ID, UserID = UserId }; ctrlAudit.Create(viewAudit); #endregion Response.Redirect(file.LinkURL); } if (file.ItemType == 1) //file { #region "Audit" //Audit: Create Item AuditController ctrlAudit = new AuditController(); Audit viewAudit; if (versionNumber == -1) { viewAudit = new Audit() { EventDate = System.DateTime.Now, EventDetails = "", EventName = "Downloaded", FileID = requestedFile.ID, UserID = UserId }; } else { viewAudit = new Audit() { EventDate = System.DateTime.Now, EventDetails = "Version: " + file.VersionNumber, EventName = "Downloaded Version", FileID = requestedFile.ID, UserID = UserId }; } ctrlAudit.Create(viewAudit); #endregion bool canOpenFileType = false; switch (file.FileType.ToLower()) { case "text/plain": canOpenFileType = true; break; case "text/html": canOpenFileType = true; break; case "text/xml": canOpenFileType = true; break; case "image/gif": canOpenFileType = true; break; case "image/jpeg": canOpenFileType = true; break; case "image/tiff": canOpenFileType = true; break; case "image/bmp": canOpenFileType = true; break; case "image/png": canOpenFileType = true; break; } if (strMode == "Open" && canOpenFileType == true) { Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.ContentType = file.FileType; Response.AddHeader("Content-Length", file.FileLength.ToString()); //Response.Flush(); //Response.AppendHeader("content-disposition", String.Format("inline; filename={0}.{1}", requestedFile.Name, file.Extension)); //Set the appropriate ContentType. //Response.ContentType = file.FileType; //Get the physical path to the file. string FilePath = MapPath(configs[0].FilesLocation + file.AttachmentPath); //Write the file directly to the HTTP content output stream. Response.WriteFile(FilePath); } else { Response.Clear(); //Response.ClearHeaders(); //Response.ClearContent(); Response.ContentType = file.FileType; Response.AddHeader("Content-Length", file.FileLength.ToString()); //Response.Flush(); Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.{1}", requestedFile.Name, file.Extension)); Response.Flush(); Response.TransmitFile(configs[0].FilesLocation + file.AttachmentPath); } //Response.Flush(); Response.End(); } } else { //Response.Redirect(Globals.NavigateURL("TabId", "", "WarningMessage=You do not have permission to the requested object.")); ShowUserErrorMessage("You do not have permission to the requested object.", ModuleId); } } else { //Response.Redirect(Globals.NavigateURL("TabId", "", "WarningMessage=The requested object does not exist.")); ShowUserErrorMessage("The requested object does not exist.", ModuleId); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// ----------------------------------------------------------------------------- protected void Page_Load(object sender, System.EventArgs e) { try { #region Check Registration and Trial Period string strProductName = "QuickDocs Pro"; //check registration try { switch (DNNQuickApps.Modules.RegistrationClient.API.IsRegistered(PortalAlias.HTTPAlias, strProductName, "QD_MODULESGALORE")) { case RegistrationClientAPIResult.Registered: break; case RegistrationClientAPIResult.Localhost: ModuleController ctrl1 = new ModuleController(); ModuleInfo info1 = ctrl1.GetModule(ModuleId); ShowMessage("<a href=\"http://www.dnnquickapps.com\">DNNQuickApps.com</a> QuickDocsPro - Using Developer License", ModuleId); break; case RegistrationClientAPIResult.NotRegistered: string strMessage; ModuleController ctrl = new ModuleController(); ModuleInfo info = ctrl.GetModule(ModuleId); if (info.CreatedOnDate < System.DateTime.Now.AddDays(-30)) { strMessage = String.Format("The trial period has expired for Product: <b>{1}</b> on Site Alias: <b>{0}</b> and the module is not registered. Visit <a href=\"http://www.DNNQuickApps.com\">DNNQuickApps.com</a> to purchase a license and register.", PortalAlias.HTTPAlias, strProductName); ShowUserErrorMessage(strMessage, ModuleId); HideAllFileControls(); return; } else { DateTime expirationDate = info.CreatedOnDate.AddDays(30); int daysRemaining = (expirationDate.DayOfYear + (expirationDate.Year * 365)) - (System.DateTime.Now.DayOfYear + (System.DateTime.Now.Year * 365)); strMessage = String.Format("{0} days remaining in trial for Product: <b>{2}</b> on Site Alias: <b>{1}</b>. Visit <a href=\"http://www.dnnquickapps.com\">DNNQuickApps.com</a> to purchase a license and register.", daysRemaining, PortalAlias.HTTPAlias, strProductName); ShowMessage(strMessage, ModuleId); } break; } } catch (Exception ex) { ShowUserErrorMessage("Problem loading registration codes from DNNQuickApps.com QuickRegistration Client.", ModuleId); HideAllFileControls(); return; } #endregion #region Verify module configuration and get module settings //check if files is configured FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; if (configs.Count == 0) { ShowMessage(String.Format("The Files module has not been configured for this portal. Go to the <a href=\"{0}\">Portal Settings</a> to complete setup.", EditUrl("PortalSettings")), ModuleId); HideAllFileControls(); return; } //files mode if (Settings["FilesMode"] != null) { _strFilesMode = Settings["FilesMode"].ToString(); } else { ShowMessage(String.Format("This Files module has not been setup. Go to the <a href=\"{0}\">Module Settings</a> to complete setup.", EditUrl(TabId, "Module", false, "moduleId=" + ModuleId)), ModuleId); HideAllFileControls(); return; } //get module root folder ID _moduleRootFolderID = GetModuleRootFolderID(_strFilesMode); #endregion #region Get query string parameters //Determine ItemId of CustomerSelfService to Update if (this.Request.QueryString["Folder"] != null) //if none, then _parent = -1 { _parentID = Int32.Parse(this.Request.QueryString["Folder"]); } //check for userID if (this.Request.QueryString["UserID"] != null) //if none, then _userIDParam = -1 { _userIDParameter = Int32.Parse(this.Request.QueryString["UserID"]); } //check for groupID if (this.Request.QueryString["GroupID"] != null) //if none, then _roleIDParam = -1 { _roleIDParameter = Int32.Parse(this.Request.QueryString["GroupID"]); } //check for trash view if (this.Request.QueryString["View"] != null) { _view = this.Request.QueryString["View"]; } //sort field if (this.Request.QueryString["Sort"] != null) { _sortType = this.Request.QueryString["sort"]; } //ModuleID param bool boolModuleIDMatched = false; //used to determine if query strings apply to this instance if (this.Request.QueryString["ModuleID"] != null) { _moduleID = Int32.Parse(this.Request.QueryString["ModuleID"]); if (_moduleID == ModuleId) { boolModuleIDMatched = true; } } else { _moduleID = ModuleId; boolModuleIDMatched = true; } //look for success message if (this.Request.QueryString["Success"] != null && boolModuleIDMatched == true) { _messageSuccess = this.Request.QueryString["Success"]; ShowUserSuccessMessage(_messageSuccess, ModuleId); } #endregion FileController objQuickFiles = new FileController(); #region Resolve the current parent ID //get parent folder //after this, _parentID has the correct folder if (_parentID != -1) //folder parameter found { objQuickFiles = new FileController(); //Verify permission to object File parentFolder = objQuickFiles.Get(_parentID); if (parentFolder == null)//folder does not exist { ShowUserErrorMessage("The requested object does not exist.", ModuleId); HideAllFileControls(); return; } //current user can't see the folder if (!parentFolder.CanSee(UserId, PortalId, PortalSettings.AdministratorRoleId, true)) { ShowUserErrorMessage("You do not have sufficient permission to view this object.", ModuleId); HideAllFileControls(); return; } //todo: verify parentID/folder exists under module folder or file ID when passed as a parameter } else //set to module root folder { _parentID = _moduleRootFolderID; } //show root folder if specifc module folder is selected and this module is not //specified moduleid, //supports multiple file modules on one page if (_moduleID != Null.NullInteger && !boolModuleIDMatched) { _parentID = _moduleRootFolderID; } #endregion #region Get Root Folder and Files Collection //declare files collection List<File> colQuickFiles; //check for alternate view and build files collection if (_view == "trash") { if (UserInfo.IsInRole(PortalSettings.AdministratorRoleName)) { colQuickFiles = objQuickFiles.GetItemsInTrash(UserId, PortalId, PortalSettings.AdministratorRoleId) as List<File>; _colQuickFiles = colQuickFiles; } else { ShowUserErrorMessage("You do not have sufficient permission to view this object.", ModuleId); HideAllFileControls(); return; } } else { //if parentid still -1, return null and hide controls if (_parentID != -1) { switch (_strFilesMode) { case "UserFiles": colQuickFiles = objQuickFiles.GetUserItemsByParent(_parentID, UserId, PortalId, PortalSettings.AdministratorRoleId, _sortType, _userIDParameter) as List<File>; break; case "GroupFiles": colQuickFiles = objQuickFiles.GetGroupItemsByParent(_parentID, UserId, PortalId, PortalSettings.AdministratorRoleId, _sortType, _roleIDParameter) as List<File>; break; default: colQuickFiles = objQuickFiles.GetItemsByParent(_parentID, UserId, PortalId, PortalSettings.AdministratorRoleId, _sortType) as List<File>; break; } _colQuickFiles = colQuickFiles; } else { HideAllFileControls(); ShowMessage(String.Format("This Files module is not configured correctly. Go to the <a href=\"{0}\">Module Settings</a> to fix setup.", EditUrl(TabId, "Module", false, "moduleId=" + ModuleId)), ModuleId); return; } } #endregion radLVFiles.DataSource = colQuickFiles; if (!Page.IsPostBack) { #region Set Theme //get theme string skinName = "Default"; if (Settings["Theme"] != null) { //skinManager.Skin = (String)Settings["Theme"]; skinName = (String)Settings["Theme"]; } radMenuBreadCrumbs.Skin = skinName; radLVFiles.Skin = skinName; radMenuNewItems.Skin = skinName; radExplorerSplitter.Skin = skinName; #endregion // bind the content to the repeater radLVFiles.DataBind(); #region Check for query string message and display if module id matches //check for message if (boolModuleIDMatched) { if (Session["SuccessMessage"] != null) { ShowUserSuccessMessage(Session["SuccessMessage"].ToString(), ModuleId); Session["SuccessMessage"] = null; } if (Session["WarningMessage"] != null) { ShowUserErrorMessage(Session["WarningMessage"].ToString(), ModuleId); Session["WarningMessage"] = null; } } #endregion #region Add Delete Confirmation to Delete button //delete confirmation if (_view == "trash") { //lbnDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to permanently delete the selected item(s)?');"); lnkViewTrashOrFiles.Text = "View Files"; lnkViewTrashOrFiles.NavigateUrl = Globals.NavigateURL(TabId, "", "View=default", "UserId=" + _userIDParameter); imgTrashOrFiles.ImageUrl = "images/folder_16_hot.png"; } else { //lbnDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you wish to delete the selected item(s)?');"); lnkViewTrashOrFiles.Text = "View Trash"; lnkViewTrashOrFiles.NavigateUrl = Globals.NavigateURL(TabId, "", "View=trash", "UserId=" + _userIDParameter); imgTrashOrFiles.ImageUrl = "images/trash_16_hot.png"; } #endregion #region Set New Action URLs switch (_strFilesMode) { case "UserFiles": SetNewFileURL(EditUrl("Type", "1", "New", "Parent=" + _parentID.ToString(), "UserID=" + _userIDParameter)); SetNewFolderURL(EditUrl("Type", "0", "New", "Parent=" + _parentID.ToString(), "UserID=" + _userIDParameter)); SetNewHyperlinkURL(EditUrl("Type", "2", "New", "Parent=" + _parentID.ToString(), "UserID=" + _userIDParameter)); break; case "GroupFiles": SetNewFileURL(EditUrl("Type", "1", "New", "Parent=" + _parentID.ToString(), "GroupID=" + _roleIDParameter)); SetNewFolderURL(EditUrl("Type", "0", "New", "Parent=" + _parentID.ToString(), "GroupID=" + _roleIDParameter)); SetNewHyperlinkURL(EditUrl("Type", "2", "New", "Parent=" + _parentID.ToString(), "GroupID=" + _roleIDParameter)); break; case "SharedFiles": SetNewFileURL(EditUrl("Type", "1", "New", "Parent=" + _parentID.ToString())); SetNewFolderURL(EditUrl("Type", "0", "New", "Parent=" + _parentID.ToString())); SetNewHyperlinkURL(EditUrl("Type", "2", "New", "Parent=" + _parentID.ToString())); break; } #endregion File currentFolder = objQuickFiles.Get(_parentID); ApplyPermissions(currentFolder, _view); //onlyl add breadcrumbs and folder detail if view is not trash if (_view == "trash") { return; } #region create breadcrumbs drop-down List<File> reorderedBreadcrumbs = new List<File>(); //get module root folder and current folder File topFolder = objQuickFiles.Get(_moduleRootFolderID); List<File> breadcrumbs = objQuickFiles.GetParentBreadcrumbs(_parentID, UserId, PortalId, PortalSettings.AdministratorRoleId, _moduleRootFolderID); int countBreadCrumbs = breadcrumbs.Count; int s = 0; for (int i = countBreadCrumbs - 1; i >= 0; i--) { reorderedBreadcrumbs.Add(breadcrumbs[i]); s++; } if (reorderedBreadcrumbs.Count > 1) { //Add up button RadMenuItem menuUp = new RadMenuItem(); menuUp.ImageUrl = "images/folder_up_16_hot.png"; menuUp.Value = reorderedBreadcrumbs[reorderedBreadcrumbs.Count - 2].ID.ToString(); menuUp.Text = ".."; //menuUp.Text = reorderedBreadcrumbs[reorderedBreadcrumbs.Count - 2].Name + " ›"; //› ► menuUp.ToolTip = "Go to the parent folder: " + reorderedBreadcrumbs[reorderedBreadcrumbs.Count - 2].Name; switch (_strFilesMode) { case "UserFiles": menuUp.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + menuUp.Value, "ModuleID=" + ModuleId.ToString(), "UserID=" + _userIDParameter); break; case "GroupFiles": menuUp.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + menuUp.Value, "ModuleID=" + ModuleId.ToString(), "GroupID=" + _roleIDParameter); break; default: menuUp.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + menuUp.Value, "ModuleID=" + ModuleId.ToString()); break; } //menuUp.PopOutImageUrl = "~/images/arrow-right.png"; if (menuUp.Text.Length > 30) { menuUp.Text = menuUp.Text.Substring(0, 29) + "..."; } radMenuBreadCrumbs.Items.Add(menuUp); } //Menu version RadMenuItem topLevel = new RadMenuItem(reorderedBreadcrumbs[reorderedBreadcrumbs.Count - 1].Name); topLevel.ImageUrl = "images/folder_16_hot.png"; topLevel.Value = "topLevel"; if (topLevel.Text.Length > 30) { topLevel.Text = topLevel.Text.Substring(0, 29) + "..."; } radMenuBreadCrumbs.Items.Add(topLevel); if (reorderedBreadcrumbs.Count > 1) { int intLevel = 1; foreach (File breadcrumb in reorderedBreadcrumbs) { RadMenuItem nextItem = new RadMenuItem(); nextItem.Text = breadcrumb.Name; nextItem.Value = breadcrumb.ID.ToString(); nextItem.ImageUrl = String.Format("images/breadcrumb{0}.gif", intLevel); switch (_strFilesMode) { case "UserFiles": nextItem.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + nextItem.Value, "ModuleID=" + ModuleId.ToString(), "UserID=" + _userIDParameter); break; case "GroupFiles": nextItem.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + nextItem.Value, "ModuleID=" + ModuleId.ToString(), "GroupID=" + _roleIDParameter); break; default: nextItem.NavigateUrl = Globals.NavigateURL(TabId, "", "Folder=" + nextItem.Value, "ModuleID=" + ModuleId.ToString()); break; } topLevel.Items.Add(nextItem); intLevel++; } //select last child item topLevel.Items[topLevel.Items.Count - 1].Selected = true; } else { topLevel.Enabled = false; } #endregion //ADD folder properties if not root folder if (_parentID != _moduleRootFolderID) { RadMenuItem folderProperties = new RadMenuItem(); folderProperties.ImageUrl = "images/info_16_hot.png"; switch (_strFilesMode) { case "UserFiles": folderProperties.NavigateUrl = EditUrl("ID", _parentID.ToString(), "Details", "Parent=" + _parentID.ToString(), "UserID=" + _userIDParameter); break; case "GroupFiles": folderProperties.NavigateUrl = EditUrl("ID", _parentID.ToString(), "Details", "Parent=" + _parentID.ToString(), "GroupID=" + _roleIDParameter); break; default: folderProperties.NavigateUrl = EditUrl("ID", _parentID.ToString(), "Details", "Parent=" + _parentID.ToString()); break; } folderProperties.ToolTip = "View folder details"; folderProperties.Text = ""; radMenuBreadCrumbs.Items.Add(folderProperties); //lnkFolderSettings.NavigateUrl = EditUrl("ID", _parentID.ToString(), "Details", "Parent=" + _parentID.ToString()); } #region Open File Action //check for file open action if (this.Request.QueryString["Open"] != null) { _openID = Int32.Parse(this.Request.QueryString["Open"]); if (this.Request.QueryString["Version"] != null) { OpenFile(_openID, Int32.Parse(this.Request.QueryString["Version"]), "Open"); } else { OpenFile(_openID, -1, "Open"); } } if (this.Request.QueryString["Download"] != null) { _openID = Int32.Parse(this.Request.QueryString["Download"]); if (this.Request.QueryString["Version"] != null) { OpenFile(_openID, Int32.Parse(this.Request.QueryString["Version"]), "Download"); } else { OpenFile(_openID, -1, "Download"); } } #endregion } } catch (Exception exc) { //Module failed to load Exceptions.ProcessModuleLoadException(this, exc); } }
protected void lbnOK_Click(object sender, EventArgs e) { try { //check file exists if (asyncFileUpload.UploadedFiles.Count == 0) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Please select a valid file to upload", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); return; } //get parameters if (this.Request.QueryString["File"] != null) { FileID = Int32.Parse(this.Request.QueryString["File"]); } if (this.Request.QueryString["Parent"] != null) { ParentID = Int32.Parse(this.Request.QueryString["Parent"]); } //get current/root file DNNQuickApps.Modules.QuickDocsPro.FileController objQuickFiles = new DNNQuickApps.Modules.QuickDocsPro.FileController(); File objOriginalFile = objQuickFiles.Get(FileID); objOriginalFile.LastModifiedDate = System.DateTime.Now; objOriginalFile.LastModifiedByUserID = UserId; if (UserId != -1) { objOriginalFile.LastModifiedByUserName = UserInfo.DisplayName; } else { objOriginalFile.LastModifiedByUserName = "******"; } //increment version number objOriginalFile.VersionNumber = objOriginalFile.VersionNumber + 1; objOriginalFile.AttachmentName = asyncFileUpload.UploadedFiles[0].FileName;// fileUpload.FileName; //create file version and copy attributes from current version DNNQuickApps.Modules.QuickDocsPro.File objFile = new DNNQuickApps.Modules.QuickDocsPro.File(); //if (!Convert.ToBoolean(Settings["IsSearchable"].ToString())) //{ // objFile.ModuleID = ModuleId; //} objFile.PortalID = PortalId; objFile.Name = objOriginalFile.Name; objFile.CreatedByUserID = objOriginalFile.LastModifiedByUserID; objFile.CreatedDate = objOriginalFile.LastModifiedDate; objFile.CreatedByUserName = objOriginalFile.LastModifiedByUserName; objFile.LastModifiedDate = objOriginalFile.LastModifiedDate; objFile.LastModifiedByUserID = objOriginalFile.LastModifiedByUserID; objFile.LastModifiedByUserName = objOriginalFile.LastModifiedByUserName; objFile.VersionsToKeep = -1; objFile.VersionNumber = objOriginalFile.VersionNumber; objFile.ItemType = objOriginalFile.ItemType; objFile.HomeFolderUserID = objOriginalFile.HomeFolderUserID; objFile.RoleID = objOriginalFile.RoleID; //Set parent to root/current file objFile.ParentID = FileID; objQuickFiles.Update(objOriginalFile); objQuickFiles.Create(objFile); //upload file version FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; if (configs[0].StorageType == "UNC") { objFile.CreatePath(configs[0].FilesLocation); //fileUpload.SaveAs(configs[0].FilesLocation + objFile.GetFullPath()); asyncFileUpload.UploadedFiles[0].SaveAs(configs[0].FilesLocation + objFile.GetFullPath()); } else { objFile.CreatePath(Server.MapPath(configs[0].FilesLocation)); //fileUpload.SaveAs(Server.MapPath(configs[0].FilesLocation) + objFile.GetFullPath()); asyncFileUpload.UploadedFiles[0].SaveAs(Server.MapPath(configs[0].FilesLocation) + objFile.GetFullPath()); } //List<string> fileNameAndExtension = objFile.GetFileNameAndExtension(fileUpload.FileName); List<string> fileNameAndExtension = objFile.GetFileNameAndExtension(asyncFileUpload.UploadedFiles[0].FileName); objFile.AttachmentName = asyncFileUpload.UploadedFiles[0].FileName;// fileUpload.FileName; objFile.AttachmentPath = objFile.GetFullPath(); objFile.FileType = asyncFileUpload.UploadedFiles[0].ContentType;// fileUpload.PostedFile.ContentType; objFile.FileLength = (int)asyncFileUpload.UploadedFiles[0].ContentLength;// fileUpload.PostedFile.ContentLength; objFile.Name = fileNameAndExtension[0]; objFile.Extension = fileNameAndExtension[1]; objOriginalFile.AttachmentPath = objFile.GetFullPath(); objOriginalFile.FileType = asyncFileUpload.UploadedFiles[0].ContentType; //fileUpload.PostedFile.ContentType; objOriginalFile.FileLength = (int)asyncFileUpload.UploadedFiles[0].ContentLength; //fileUpload.PostedFile.ContentLength; //Don't change file name when uploading new version, only version gets new file name //objOriginalFile.Name = fileNameAndExtension[0]; objOriginalFile.Extension = fileNameAndExtension[1]; objQuickFiles.Update(objOriginalFile); objQuickFiles.Update(objFile); #region "Audit" //Audit: New Version Item AuditController ctrlAudit = new AuditController(); Audit versionAudit = new Audit() { EventDate = objOriginalFile.LastModifiedDate, EventDetails = "File name: " + objFile.Name, EventName = "Added Version", FileID = objOriginalFile.ID, UserID = UserId }; ctrlAudit.Create(versionAudit); #endregion //refresh cac SynchronizeModule(); //Redirect back to the portal home page this.Response.Redirect(Globals.NavigateURL(this.TabId, "", "Folder=" + ParentID, "ModuleID=" + ModuleId.ToString(), "UserID=" + _userIDParameter, "GroupID=" + _roleIDParameter, "Success=New version uploaded for file: " + objOriginalFile.Name), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void lbnDelete_Click(object sender, EventArgs e) { if (this.Request.QueryString["File"] != null) { _FileID = Int32.Parse(this.Request.QueryString["File"]); } FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(PortalId) as List<FileConfiguration>; if (_FileID == configs[0].RootSharedFolderID || _FileID == configs[0].RootGroupsFolderID || _FileID == configs[0].RootUsersFolderID) { DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Error: Can not delete a protected folder", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); lbnDelete.Visible = false; lbnOK.Visible = false; lbnCancel.Visible = true; return; } FileController fileCtrl = new FileController(); File file = fileCtrl.Get(_FileID); _filesToDelete = new List<File>(); DeleteChildren(file); foreach (File toDelete in _filesToDelete) { fileCtrl.Delete(toDelete); } string strMessage; if (_permanentlyDeletedFilesCount > 0) { strMessage = String.Format("Permanently deleted {0} item(s).", _permanentlyDeletedFilesCount); } else { strMessage = String.Format("Successfully deleted {0} item(s) and skipped {1} item(s).", _deletedFilesCount, _notDeletedFilesCount); } DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, strMessage, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess); lbnDelete.Visible = false; lbnOK.Visible = true; lbnCancel.Visible = false; }
public File CreateRootGroupsFolder(int userID, int portalID) { //create folder FileController ctrl = new FileController(); UserController ctrlUser = new UserController(); UserInfo user = ctrlUser.GetUser(portalID, userID); //create root shared folder File rootPortalFolder = new File(); //rootPortalFolder.ChildCount = 0; rootPortalFolder.CreatedByUserID = userID; rootPortalFolder.CreatedByUserName = user.DisplayName; rootPortalFolder.CreatedDate = System.DateTime.Now; rootPortalFolder.IsInTrash = false; rootPortalFolder.IsFolder = true; rootPortalFolder.ItemType = 0; rootPortalFolder.LastModifiedByUserID = userID; rootPortalFolder.LastModifiedByUserName = user.DisplayName; rootPortalFolder.LastModifiedDate = System.DateTime.Now; rootPortalFolder.Name = "Groups Root Folder"; rootPortalFolder.Description = ""; rootPortalFolder.ParentID = GetRootPortalFolder(portalID, userID).ID; rootPortalFolder.PortalID = portalID; ctrl.Create(rootPortalFolder); //add permissions //admins only //update files config FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(portalID) as List<FileConfiguration>; configs[0].RootGroupsFolderID = rootPortalFolder.ID; ctrlConfig.Update(configs[0]); //unify existing user folders under default users folder foreach (var userFolder in ctrl.GetV702GroupFolders(portalID)) { userFolder.ParentID = rootPortalFolder.ID; ctrl.Update(userFolder); } //return default new root users folder return rootPortalFolder; }
public File GetRootUsersFolder(int portalId, int userID) { FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(portalId) as List<FileConfiguration>; var rootUsersFolder = Get(configs[0].RootUsersFolderID); if (rootUsersFolder != null) { return rootUsersFolder; } return CreateRootUsersFolder(userID, portalId); }
public File CreateRootSharedFolder(int userID, int portalID) { FileController ctrl = new FileController(); UserController ctrlUser = new UserController(); UserInfo user = ctrlUser.GetUser(portalID, userID); //create root shared folder File rootPortalFolder = new File(); //rootPortalFolder.ChildCount = 0; rootPortalFolder.CreatedByUserID = userID; rootPortalFolder.CreatedByUserName = user.DisplayName; rootPortalFolder.CreatedDate = System.DateTime.Now; rootPortalFolder.IsInTrash = false; rootPortalFolder.IsFolder = true; rootPortalFolder.ItemType = 0; rootPortalFolder.LastModifiedByUserID = userID; rootPortalFolder.LastModifiedByUserName = user.DisplayName; rootPortalFolder.LastModifiedDate = System.DateTime.Now; rootPortalFolder.Name = "Site Root Folder"; rootPortalFolder.Description = ""; rootPortalFolder.ParentID = -1; rootPortalFolder.PortalID = portalID; ctrl.Create(rootPortalFolder); //add default permission PermissionController ctrlPerm = new PermissionController(); Permission perm = new Permission(); perm.CanAddFiles = true; perm.CanAddFolders = true; perm.CanSee = true; perm.FileID = rootPortalFolder.ID; perm.PortalID = portalID; perm.RoleID = 1000000; perm.RoleName = "All Users"; ctrlPerm.Create(perm); //update files config FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(portalID) as List<FileConfiguration>; configs[0].RootUsersFolderID = rootPortalFolder.ID; ctrlConfig.Update(configs[0]); return rootPortalFolder; }
private void PopulateTree(int searchValue) { FileController fileCtrl = new FileController(); FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(PortalId) as List<FileConfiguration>; if (configs.Count > 0) { //check for root shared folder var rootFolder = fileCtrl.GetRootPortalFolder(PortalId, UserId); //if none exists, create if (rootFolder == null) { rootFolder = fileCtrl.CreateRootSharedFolder(UserId, PortalId); } configs[0].RootSharedFolderID = rootFolder.ID; //check root users folder if (configs[0].RootUsersFolderID == 0) { //if none exists, create configs[0].RootUsersFolderID = fileCtrl.CreateRootUsersFolder(UserId, PortalId).ID; } //check root groups folder if (configs[0].RootGroupsFolderID == 0) { //if none exists, create configs[0].RootGroupsFolderID = fileCtrl.CreateRootGroupsFolder(UserId, PortalId).ID; } //update config ctrlConfig.Update(configs[0]); } File rootFile = new File(); rootFile.ID = -1; rootFile.Name = "QuickDocsPro"; List<File> listFiles = fileCtrl.GetItemsByParent(rootFile.ID, UserId, PortalId, PortalSettings.AdministratorRoleId, "Asc") as List<File>; System.Web.UI.WebControls.TreeNode rootNode = new System.Web.UI.WebControls.TreeNode(rootFile.Name, rootFile.ID.ToString(), "images/window_16_hot.png"); rootNode.Expanded = false; treeFolders.Nodes.Add(rootNode); populateChildren(rootNode, searchValue, configs[0]); if (rootNode.Value == searchValue.ToString()) { rootNode.Selected = true; } }
protected void lbnDeleteVersions_Click(object sender, EventArgs e) { FileController fileCtrl = new FileController(); foreach (GridViewRow row in gridVersions.Rows) { CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); if (chkSelect.Checked == false) continue; File file = fileCtrl.Get(Int32.Parse(row.Cells[0].Text)); if (file != null) { //check if at least one version exists FileController ctrl = new FileController(); List<File> parentFileVersions = ctrl.GetVersions(file.ParentID, UserId, PortalId, PortalSettings.AdministratorRoleId, ""); if (parentFileVersions.Count > 1) { //2 or more versions exist, delete version FileConfigurationController configCtrl = new FileConfigurationController(); List<FileConfiguration> configs = configCtrl.GetItems(PortalId) as List<FileConfiguration>; fileCtrl.DeleteVersion(file, configs[0].FilesLocation); } else { //1 or fewer versions exist, do not delete and show error message ShowUserErrorMessage("Can't delete last version. At least one version of the file must exist."); } } } BindVersions(fileCtrl.Get(Int32.Parse(this.Request.QueryString["ID"]))); }