public static String getTypeIcon(IPageAdminSection sectionController, ContentPost post) { String typeIcon = sectionController.GetSectionIcon(post.SectionId); if (strUtil.HasText(typeIcon)) { return(typeIcon); } if (post.TypeName == typeof(ContentVideo).FullName) { return(iconVideo); } if (post.TypeName == typeof(ContentImg).FullName) { return(iconPic); } if (post.TypeName == typeof(ContentPoll).FullName) { return(iconPoll); } if (post.HasImg()) { return(iconPic); } return(""); }
private String getStatus( ContentPost post ) { if (post.HasImg()==false) return ""; return "<img src=\""+strUtil.Join( sys.Path.Img, "img.gif" )+"\" />"; }
private void bindDetail(int id, ContentPost post) { String content; String pageSeparator = getPageSeparator(post.Content); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent(post, pageSeparator); } if (post.HasImg()) { String imgUrl = post.GetImgMedium(); if (content.IndexOf(imgUrl) < 0) { content = string.Format("<div class=\"post-detail-content-pic\"><img src=\"{0}\" /></div>", imgUrl) + content; } } set("post.Content", content); }
private String getStatus(ContentPost post) { if (post.HasImg() == false) { return(""); } return("<img src=\"" + strUtil.Join(sys.Path.Img, "img.gif") + "\" />"); }
private void bindDetail(int id, ContentPost post) { set("post.Title", post.GetTitle()); set("post.Author", post.Author); set("post.Created", post.Created); String tag = post.Tag.List.Count > 0 ? tag = "tag: " + post.Tag.HtmlString : ""; String src = getSrc(post); String replies = getReplies(post); set("post.Tag", tag); set("post.Replies", replies); set("post.Hits", post.Hits); set("post.Source", src); if (post.Creator != null) { set("post.Submitter", string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", Link.ToMember(post.Creator), post.Creator.Name)); } else { set("post.Submitter", "ÎÞ"); } bindSummary(post); String content; String pageSeparator = getPageSeparator(post.Content); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent(post, pageSeparator); } if (post.HasImg()) { content = string.Format("<div style=\"text-align:center;\"><img src=\"{0}\" />", post.GetImgMedium()) + "</div>" + content; } if (post.IsAttachmentLogin == 1 && ctx.viewer.IsLogin == false) { content += "<div class=\"downloadWarning\"><div>" + alang("downloadNeedLogin") + "</div></div>"; } else { content = addAttachment(post, content); } set("post.Content", content); }
public static String getTypeIcon( IPageAdminSection sectionController, ContentPost post ) { String typeIcon = sectionController.GetSectionIcon( post.SectionId ); if (strUtil.HasText( typeIcon )) return typeIcon; if (post.TypeName == typeof( ContentVideo ).FullName) return iconVideo; if (post.TypeName == typeof( ContentImg ).FullName) return iconPic; if (post.TypeName == typeof( ContentPoll ).FullName) return iconPoll; if (post.HasImg()) return iconPic; return ""; }
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 static String getTypeIcon(ContentPost post) { if (post.TypeName == typeof(ContentVideo).FullName) { return(iconVideo); } if (post.TypeName == typeof(ContentImg).FullName) { return(iconPic); } if (post.HasImg()) { return(iconPic); } return(""); }
private void bindDetail( int id, ContentPost post ) { String content; String pageSeparator = getPageSeparator( post.Content ); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent( post, pageSeparator ); } if (post.HasImg()) { content = string.Format( "<div style=\"text-align:center;\"><img src=\"{0}\" />", post.GetImgMedium() ) + "</div>" + content; } set( "post.Content", content ); }
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); } }
private void bindDetail(int id, ContentPost post) { String content; String pageSeparator = getPageSeparator(post.Content); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent(post, pageSeparator); } if (post.HasImg()) { content = string.Format("<div style=\"text-align:center;\"><img src=\"{0}\" />", post.GetImgMedium()) + "</div>" + content; } set("post.Content", content); }
private void bindDetail( int id, ContentPost post ) { String content; String pageSeparator = getPageSeparator( post.Content ); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent( post, pageSeparator ); } if (post.HasImg()) { String imgUrl = post.GetImgMedium(); if (content.IndexOf( imgUrl ) < 0) { content = string.Format( "<div class=\"post-detail-content-pic\"><img src=\"{0}\" /></div>", imgUrl ) + content; } } set( "post.Content", content ); }
public static ContentPost ValidateVideo(ContentPost post, MvcContext ctx) { if (strUtil.IsNullOrEmpty(post.Title)) { ctx.errors.Add(lang.get("exName")); } if (post.HasImg() == false) { ctx.errors.Add(ctx.controller.alang("exVideoImgUrl")); } if (strUtil.IsNullOrEmpty(post.SourceLink)) { ctx.errors.Add(ctx.controller.alang("exVideoLink")); } post.CategoryId = PostCategory.Video; post.TypeName = typeof(ContentVideo).FullName; return(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 static String getTypeIcon( ContentPost post ) { if (post.TypeName == typeof( ContentVideo ).FullName) return iconVideo; if (post.TypeName == typeof( ContentImg ).FullName) return iconPic; if (post.HasImg()) return iconPic; return ""; }
public static ContentPost ValidateVideo( ContentPost post, MvcContext ctx ) { if (strUtil.IsNullOrEmpty( post.Title )) ctx.errors.Add( lang.get( "exName" ) ); if (post.HasImg()==false) ctx.errors.Add( ctx.controller.alang( "exVideoImgUrl" ) ); if (strUtil.IsNullOrEmpty( post.SourceLink )) ctx.errors.Add( ctx.controller.alang( "exVideoLink" ) ); post.CategoryId = PostCategory.Video; post.TypeName = typeof( ContentVideo ).FullName; return post; }
private void bindDetail( int id, ContentPost post ) { set( "post.Title", post.GetTitle() ); set( "post.Author", post.Author ); set( "post.Created", post.Created ); String tag = post.Tag.List.Count > 0 ? tag = "tag: " + post.Tag.HtmlString : ""; String src = getSrc( post ); String replies = getReplies( post ); set( "post.Tag", tag ); set( "post.Replies", replies ); set( "post.Hits", post.Hits ); set( "post.Source", src ); if (post.Creator != null) { set( "post.Submitter", string.Format( "<a href=\"{0}\" target=\"_blank\">{1}</a>", Link.ToMember( post.Creator ), post.Creator.Name ) ); } else { set( "post.Submitter", "ÎÞ" ); } bindSummary( post ); String content; String pageSeparator = getPageSeparator( post.Content ); if (pageSeparator == null) { content = post.Content; } else { content = getPagedContent( post, pageSeparator ); } if (post.HasImg()) { content = string.Format( "<div style=\"text-align:center;\"><img src=\"{0}\" />", post.GetImgMedium() ) + "</div>" + content; } if (post.IsAttachmentLogin == 1 && ctx.viewer.IsLogin == false) { content += "<div class=\"downloadWarning\"><div>" + alang( "downloadNeedLogin" ) + "</div></div>"; } else { content = addAttachment( post, content ); } set( "post.Content", content ); }