public void SetLogo(int postId) { ContentPost post = postService.GetById(postId, ctx.owner.Id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } int imgId = ctx.GetInt("imgId"); ContentImg img = imgService.GetImgById(imgId); if (img == null) { echoRedirect(alang("exImgFound")); return; } post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo(post); echoRedirect(lang("opok")); }
public virtual void DeleteImgOne( ContentImg articleImg ) { db.delete( articleImg ); Img.DeleteImgAndThumb( strUtil.Join( sys.Path.DiskPhoto, articleImg.ImgUrl ) ); if (articleImg.ImgUrl.Equals( articleImg.Post.ImgLink )) { this.setPreImgLogo( articleImg ); } }
public virtual void DeleteImgOne(ContentImg articleImg) { db.delete(articleImg); Img.DeleteImgAndThumb(strUtil.Join(sys.Path.DiskPhoto, articleImg.ImgUrl)); if (articleImg.ImgUrl.Equals(articleImg.Post.ImgLink)) { this.setPreImgLogo(articleImg); } }
private String getSetLogoCmd(ContentPost post, ContentImg img) { if (img.ImgUrl.Equals(post.ImgLink)) { return("<span style='font-weight:bold;color:red;'>" + alang("currentCover") + "</span>"); } return(string.Format("<a href='{0}' class=\"putCmd cmd\">" + alang("setCover") + "</a>", to(SetLogo, post.Id) + "?imgId=" + img.Id)); }
private void setNextImgLogo( ContentImg articleImg ) { ContentImg img = db.find<ContentImg>( "Id>" + articleImg.Id + " order by Id" ).first(); if (img != null) { articleImg.Post.ImgLink = img.ImgUrl; this.UpdateImgLogo( articleImg.Post ); } else { articleImg.Post.ImgLink = ""; this.UpdateImgLogo( articleImg.Post ); } }
private void saveLinkPicSingle(string picUrl, string picDesc, ContentPost post, int i) { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = picUrl; img.Description = picDesc; imgService.CreateImg(img); if ((i == 1) && post.HasImg() == false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo(post); } }
public void CreateImgList(int postId) { ContentPost post = postService.GetById(postId, ctx.owner.Id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } if (ctx.GetFiles().Count <= 0) { errors.Add(alang("plsUpImg")); run(AddImgList, postId); return; } for (int i = 0; i < ctx.GetFiles().Count; i++) { Result result = Uploader.SaveImg(ctx.GetFiles()[i]); if (result.HasErrors) { errors.Join(result); } else { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = result.Info.ToString(); img.Description = ctx.Post("Text" + (i + 1)); imgService.CreateImg(img); if ((i == 0) && post.HasImg() == false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo(post); } } } if (errors.Errors.Count >= ctx.GetFiles().Count) { errors.Errors.Clear(); errors.Add(alang("plsUpImg")); run(AddImgList, postId); } else { redirect(AddImgList, postId); } }
public void DeleteImg(int imgId) { ContentImg img = imgService.GetImgById(imgId); if (img == null) { echoRedirect(alang("exImgFound")); return; } imgService.DeleteImgOne(img); echoRedirect(lang("opok")); }
private void setNextImgLogo(ContentImg articleImg) { ContentImg img = db.find <ContentImg>("Id>" + articleImg.Id + " order by Id").first(); if (img != null) { articleImg.Post.ImgLink = img.ImgUrl; this.UpdateImgLogo(articleImg.Post); } else { articleImg.Post.ImgLink = ""; this.UpdateImgLogo(articleImg.Post); } }
public void SetLogo(int imgId) { ContentImg img = imgService.GetImgById(imgId); if (img == null) { echoRedirect(alang("exImgFound")); return; } ContentPost post = img.Post; post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo(post); echoRedirect(lang("opok")); }
private void saveUploadPic(long postId, ContentPost post) { if (ctx.GetFiles().Count <= 0) { errors.Add(alang("plsUpImg")); run(AddImgList, postId); return; } for (int i = 0; i < ctx.GetFiles().Count; i++) { Result result = Uploader.SaveImg(ctx.GetFiles()[i]); if (result.HasErrors) { errors.Join(result); } else { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = result.Info.ToString(); img.Description = ctx.Post("Text" + (i + 1)); imgService.CreateImg(img); if ((i == 0) && post.HasImg() == false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo(post); } } } if (errors.Errors.Count >= ctx.GetFiles().Count) { errors.Errors.Clear(); errors.Add(alang("plsUpImg")); run(AddImgList, postId); } else { redirect(AddImgList, postId); } }
public void DeleteImg(int postId) { ContentPost post = postService.GetById(postId, ctx.owner.Id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } int imgId = ctx.GetInt("imgId"); ContentImg img = imgService.GetImgById(imgId); if (img == null) { echoRedirect(alang("exImgFound")); return; } imgService.DeleteImgOne(img); echoRedirect(lang("opok")); HtmlHelper.SetPostToContext(ctx, post); }
private void saveLinkPicSingle( string picUrl, string picDesc, ContentPost post, int i ) { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = picUrl; img.Description = picDesc; imgService.CreateImg( img ); if ((i == 1) && post.HasImg() == false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo( post ); } }
private void saveUploadPic( long postId, ContentPost post ) { if (ctx.GetFiles().Count <= 0) { errors.Add( alang( "plsUpImg" ) ); run( AddImgList, postId ); return; } for (int i = 0; i < ctx.GetFiles().Count; i++) { Result result = Uploader.SaveImg( ctx.GetFiles()[i] ); if (result.HasErrors) { errors.Join( result ); } else { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = result.Info.ToString(); img.Description = ctx.Post( "Text" + (i + 1) ); imgService.CreateImg( img ); if ((i == 0) && post.HasImg() == false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo( post ); } } } if (errors.Errors.Count >= ctx.GetFiles().Count) { errors.Errors.Clear(); errors.Add( alang( "plsUpImg" ) ); run( AddImgList, postId ); } else { redirect( AddImgList, postId ); } }
public void CreateImgList( int postId ) { ContentPost post = postService.GetById( postId, ctx.owner.Id ); if (post == null) { echoRedirect( lang( "exDataNotFound" ) ); return; } if (ctx.GetFiles().Count <= 0) { errors.Add( alang( "plsUpImg" ) ); run(AddImgList, postId ); return; } for (int i = 0; i < ctx.GetFiles().Count; i++) { Result result = Uploader.SaveImg( ctx.GetFiles()[i] ); if (result.HasErrors) { errors.Join( result ); } else { ContentImg img = new ContentImg(); img.Post = post; img.ImgUrl = result.Info.ToString(); img.Description = ctx.Post( "Text" + (i + 1) ); imgService.CreateImg( img ); if ((i == 0) && post.HasImg()==false) { post.ImgLink = img.ImgUrl; imgService.UpdateImgLogo( post ); } } } if (errors.Errors.Count >= ctx.GetFiles().Count) { errors.Errors.Clear(); errors.Add( alang( "plsUpImg" ) ); run( AddImgList, postId ); } else { redirect( AddImgList, postId ); } }
public virtual void CreateImg( ContentImg img ) { db.insert( img ); }
private String getSetLogoCmd( ContentPost post, ContentImg img ) { if (img.ImgUrl.Equals( post.ImgLink )) { return "<span style='font-weight:bold;color:red;'>" + alang( "currentCover" ) + "</span>"; } return string.Format( "<a href='{0}' class=\"putCmd cmd\">" + alang( "setCover" ) + "</a>", to( SetLogo, post.Id ) + "?imgId=" + img.Id ); }
public virtual void CreateImg(ContentImg img) { db.insert(img); }