// Show directories as album name instead of pin. public override DirectoryItem ResolveRootDirectoryAsTree(string path) { Album album = new Album(); try { DirectoryItem orgDir = base.ResolveRootDirectoryAsTree(path); string pin = ""; int firstSlash = GetNthIndex(path, '/', 3); int secondSlash = GetNthIndex(path, '/', 4); if (secondSlash > firstSlash) { pin = path.Substring(firstSlash, (secondSlash - firstSlash)) + " : "; } else { pin = orgDir.Name + " : "; } orgDir.Name = pin + album.GetAlbumName(orgDir.Name); return(orgDir); } catch (UnauthorizedAccessException) { //Eat access exceptions. //return new DirectoryItem(); return(null); } }
protected void RadFileExplorerAlbum_ExplorerPopulated(object sender, Telerik.Web.UI.RadFileExplorerPopulatedEventArgs e) { if (e.ControlName == "tree") { albumPin = Request.QueryString["pin"]; if (!String.IsNullOrEmpty(albumPin)) { Album album = new Album(); albumName = album.GetAlbumName(albumPin); RadTreeNode node = RadFileExplorerAlbum.TreeView.FindNodeByText(albumName); if (node != null) { node.Selected = true; node.Focus(); node.Expanded = true; RadFileExplorerAlbum.InitialPath = node.FullPath; } } } }
public string GetAlbumName(string pin) { Album album = new Album(); return album.GetAlbumName(pin); }
// Show directories as album name instead of pin. public override DirectoryItem ResolveRootDirectoryAsTree(string path) { Album album = new Album(); try { DirectoryItem orgDir = base.ResolveRootDirectoryAsTree(path); string pin = ""; int firstSlash = GetNthIndex(path, '/', 3); int secondSlash = GetNthIndex(path, '/', 4); if (secondSlash > firstSlash) { pin = path.Substring(firstSlash, (secondSlash - firstSlash)) + " : "; } else { pin = orgDir.Name + " : "; } orgDir.Name = pin + album.GetAlbumName(orgDir.Name); return orgDir; } catch (UnauthorizedAccessException) { //Eat access exceptions. //return new DirectoryItem(); return null; } }
protected void Page_Load(object sender, EventArgs e) { Album album = new Album(); userFolder = rootDir; albumPin = Request.QueryString["pin"]; if (!IsPostBack) { LabelAlbumPin.Text = albumPin; if (User.Identity.IsAuthenticated) { string userId = User.Identity.GetUserId(); userFolder += userId + "/"; if (!String.IsNullOrEmpty(albumPin)) { string albumUserId = album.GetAlbumUserId(albumPin); if (albumUserId == userId) { //This album pin belongs to the current users //RadFileExplorerAlbum.InitialPath = Page.ResolveUrl(userFolder); RadFileExplorerAlbum.Configuration.MaxUploadFileSize = GetUploadLimit(userId); RadFileExplorerAlbum.Configuration.ViewPaths = getFolderArray(Request.MapPath(userFolder)); RadFileExplorerAlbum.Configuration.UploadPaths = new string[] { userFolder }; RadFileExplorerAlbum.Configuration.DeletePaths = new string[] { userFolder }; } else // The user is logged in but its not their album. ViewAnotherUsersAlbum(albumPin); LabelAlbumPin.Text = albumPin; RadTextBoxAlbumName.Text = album.GetAlbumName(albumPin); } else { // Load users root folder. RadFileExplorerAlbum.Configuration.MaxUploadFileSize = GetUploadLimit(userId); RadFileExplorerAlbum.Configuration.ViewPaths = getFolderArray(Request.MapPath(userFolder)); RadFileExplorerAlbum.Configuration.UploadPaths = new string[] { userFolder }; RadFileExplorerAlbum.Configuration.DeletePaths = new string[] { userFolder }; } } else { if (!String.IsNullOrEmpty(albumPin)) { // The user is not logged in therefor its another users pin. ViewAnotherUsersAlbum(albumPin); LabelAlbumPin.Text = albumPin; RadTextBoxAlbumName.Text = album.GetAlbumName(albumPin); } else { // The user is not logged in and no pin is given. Redirect. Response.Redirect("~/Default.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { Album album = new Album(); userFolder = rootDir; albumPin = Request.QueryString["pin"]; if (!IsPostBack) { LabelAlbumPin.Text = albumPin; if (User.Identity.IsAuthenticated) { string userId = User.Identity.GetUserId(); userFolder += userId + "/"; if (!String.IsNullOrEmpty(albumPin)) { string albumUserId = album.GetAlbumUserId(albumPin); if (albumUserId == userId) { //This album pin belongs to the current users //RadFileExplorerAlbum.InitialPath = Page.ResolveUrl(userFolder); RadFileExplorerAlbum.Configuration.MaxUploadFileSize = GetUploadLimit(userId); RadFileExplorerAlbum.Configuration.ViewPaths = getFolderArray(Request.MapPath(userFolder)); RadFileExplorerAlbum.Configuration.UploadPaths = new string[] { userFolder }; RadFileExplorerAlbum.Configuration.DeletePaths = new string[] { userFolder }; } else { // The user is logged in but its not their album. ViewAnotherUsersAlbum(albumPin); } LabelAlbumPin.Text = albumPin; RadTextBoxAlbumName.Text = album.GetAlbumName(albumPin); } else { // Load users root folder. RadFileExplorerAlbum.Configuration.MaxUploadFileSize = GetUploadLimit(userId); RadFileExplorerAlbum.Configuration.ViewPaths = getFolderArray(Request.MapPath(userFolder)); RadFileExplorerAlbum.Configuration.UploadPaths = new string[] { userFolder }; RadFileExplorerAlbum.Configuration.DeletePaths = new string[] { userFolder }; } } else { if (!String.IsNullOrEmpty(albumPin)) { // The user is not logged in therefor its another users pin. ViewAnotherUsersAlbum(albumPin); LabelAlbumPin.Text = albumPin; RadTextBoxAlbumName.Text = album.GetAlbumName(albumPin); } else { // The user is not logged in and no pin is given. Redirect. Response.Redirect("~/Default.aspx"); } } } }
public string GetAlbumName(string pin) { Album album = new Album(); return(album.GetAlbumName(pin)); }