private void Page_Load(object sender, EventArgs e) { // The base page has already created the module, we only have to cast it here to the right type. _galleryModule = Module as GalleryModule; _photoService = _galleryModule.GetPhotoService(); if (Request.QueryString["AlbumId"] != null) { _albumid = Int32.Parse(Request.QueryString["AlbumId"]); } if (_albumid > 0) { btnNew.Attributes.Add("onclick", String.Format( "document.location.href='AdminPhoto.aspx{0}&AlbumId={1}&PhotoId=-1'", GetBaseQueryString(), _albumid)); if (!IsPostBack) { BindFiles(); } } }
protected void Page_Load(object sender, EventArgs e) { _galleryModule = Module as GalleryModule; if (_galleryModule == null) { _galleryModule = _moduleLoader.GetModuleFromClassName("CMS.Modules.Gallery.GalleryModule") as GalleryModule; } _albumService = _galleryModule.GetAlbumService(); _photoService = _galleryModule.GetPhotoService(); if (Module != null) { btnCancel.Attributes.Add("onclick", String.Format("document.location.href='AdminGallery.aspx{0}'", GetBaseQueryString())); btnMassImport.Click += btnMassImport_Click; if (Request.QueryString["AlbumId"] == null) { return; } int albumId = Int32.Parse(Request.QueryString["AlbumId"]); if (albumId == 0 || albumId == -1) { return; } _album = _albumService.GetAlbumById(albumId); if (!IsPostBack) { BindAlbum(); } btnDelete.Visible = true; btnDelete.Attributes.Add("onclick", "return confirm('Are you sure?');"); if (!IsPostBack) { DisplayFastImportPanel(); } if (_album.Id > 0) { FileUploaderAJAXPhotos.Visible = true; } else { FileUploaderAJAXPhotos.Visible = false; } Session["GalleryPath"] = _galleryModule.PathBuilder.GetAlbumVirtualDirectory(_album.Id); } if (FileUploaderAJAXPhotos.IsPosting && Session["GalleryPath"] != null) { FileHelper.ManageAjaxPost(FileUploaderAJAXPhotos, 2000, Session["GalleryPath"] + "\\ToImport", HttpPostedFileAJAX.fileType.image, false, false); } }
protected override void OnLoad(EventArgs e) { this._galleryModule = base.Module as GalleryModule; // Register stylesheet string cssfile = GalleryModule.ThemePath + "gallery.css"; RegisterStylesheet("gallerycss", cssfile); base.OnLoad(e); }
protected void Page_Load(object sender, EventArgs e) { module = Module as GalleryModule; //module = _moduleLoader.GetModuleFromClassName("CMS.Modules.User.UserModule") as UserModule; if (!IsPostBack) { if (module != null) { GetDataSource(); rptAlbums.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { _galleryModule = Module as GalleryModule; _album = _galleryModule.GetAlbumService().GetAlbumById(_galleryModule.CurrentAlbumId); if (_album.PhotoCount == 0) { Visible = false; return; } rptReviews.DataSource = _album.Comments; rptReviews.DataBind(); //GetXmlPath }
private void Page_Load(object sender, EventArgs e) { this._galleryModule = base.Module as GalleryModule; _albumService = _galleryModule.GetAlbumService(); _photoService = _galleryModule.GetPhotoService(); if (Request.QueryString["AlbumId"] != null) { this._albumId = Int32.Parse(Request.QueryString["AlbumId"]); } if (Request.QueryString["PhotoId"] != null) { this._photoId = Int32.Parse(Request.QueryString["PhotoId"]); } if (this._photoId > 0) { this._photo = _photoService.GetPhotoById(this._photoId); if (!this.IsPostBack) { BindPhoto(); } imThumb.ImageUrl = base.Page.ResolveUrl( _galleryModule.VirtualPath( _galleryModule.PathBuilder.GetThumbPath(_photo))); this.btnDelete.Visible = true; this.btnDelete.Attributes.Add("onclick", "return confirm('Are you sure?');"); } else { // It is possible that a new file is already uploaded and in the database. The // tempPhotoId parameter in the viewstate should indicate this. if (ViewState["tempPhotoId"] != null) { int tempPhotoId = (int)ViewState["tempPhotoId"]; this._photo = _photoService.GetPhotoById(tempPhotoId); } else { // New file. this._photo = new Photo(); } this.btnDelete.Visible = false; this.imThumb.Visible = false; } }
protected void pgrAlbums_CacheEmpty(object sender, EventArgs e) { AlbumService albumService = GalleryModule.GetAlbumService(); if (_albumList == null) { _albumList = albumService.GetAlbumList(true); } if (_albumList != null) { AlbumDataList.DataSource = _albumList; } }
private void PhotoDetailsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } Photo photo = e.Item.DataItem as Photo; if (photo == null) { return; } Literal litImage = e.Item.FindControl("litImage") as Literal; if (litImage != null) { litImage.Text = "<img"; litImage.Text += " src=\"" + base.Page.ResolveUrl( base.GalleryModule.VirtualPath( base.GalleryModule.PathBuilder.GetPath(photo))) + "\""; litImage.Text += " width=\"" + photo.ImageWidth + "\""; litImage.Text += " height=\"" + photo.ImageHeight + "\""; litImage.Text += " alt=\"" + photo.Size + " " + base.GetText("strBytes") + "\""; litImage.Text += " class=\"photo_198\""; litImage.Text += " style=\"border:4px solid white\""; litImage.Text += " />"; } litTitle = e.Item.FindControl("litTitle") as Literal; if (litTitle != null) { litTitle.Text = photo.DisplayTitle; litTitle.Text += " (" + Convert.ToString(CurrentPage + 1) + '/' + _photolist.Count + ")"; } using (HyperLink hplDownload = e.Item.FindControl("hplDownload") as HyperLink) { if (hplDownload != null) { hplDownload.NavigateUrl = base.Page.ResolveUrl(GalleryModule.VirtualPath(GalleryModule.PathBuilder.GetPhotoOriginPath(photo))); } } base.PhotoService.IncreaseNrOfViews(photo); }
private void BindAlbums() { AlbumService albumService = GalleryModule.GetAlbumService(); if (_albumList == null) { _albumList = albumService.GetAlbumList(true); } if (_albumList != null) { AlbumDataList.DataSource = _albumList; AlbumDataList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // The base page has already created the module, we only have to cast it here to the right type. _galleryModule = base.Module as GalleryModule; _albumService = _galleryModule.GetAlbumService(); btnNew.Attributes.Add("onclick", String.Format("document.location.href='AdminAlbum.aspx{0}&AlbumId=-1'", base.GetBaseQueryString())); if (!IsPostBack) { textBoxTitle.Text = Request.QueryString["title"]; rptAlbums.DataSource = _albumService.GetAlbumList(false, Request.QueryString["title"]); rptAlbums.DataBind(); } DefaultButton.SetDefault(Page, textBoxTitle, btnSearch); }
protected void PhotoDataList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Photo photo = (Photo)e.Item.DataItem; string vieuwUrl = UrlHelper.GetUrlFromSection(GalleryModule.Section) + "/" + photo.Album.Id + "/" + photo.Id; HyperLink hplFile = (HyperLink)e.Item.FindControl("hplFile"); hplFile.NavigateUrl = vieuwUrl; if (!(Page is PageEngine)) { hplFile.Target = "_blank"; } Literal litImage = (Literal)e.Item.FindControl("litImage"); litImage.Text = "<img"; litImage.Text += " src=\"" + base.Page.ResolveUrl( GalleryModule.VirtualPath( GalleryModule.PathBuilder.GetThumbPath(photo))) + "\""; litImage.Text += " width=\"" + photo.ThumbWidth + "\""; litImage.Text += " height=\"" + photo.ThumbHeight + "\""; litImage.Text += " alt=\"" + photo.Title + "\""; litImage.Text += " />"; Literal litImageLabel = (Literal)e.Item.FindControl("litImageLabel"); litImageLabel.Text = photo.DisplayTitle; // only add number of views if configuration is set to show it if (GalleryModule.AlbumSettings.ShowNumberOfViews) { // no point showing it when there's no views if (photo.NrOfViews > 0) { litImageLabel.Text += " (" + photo.NrOfViews + base.GetText("strViews") + ")"; } } } }
public virtual void SetGalleryModule(GalleryModule galleryModule) { _galleryModule = galleryModule; }
public Album(GalleryModule galleryModule) : this() { _galleryModule = galleryModule; }