Beispiel #1
0
 public TransitReference(DBlog.Data.Reference o)
     : base(o.Id)
 {
     Url = o.Url;
     Word = o.Word;
     Result = o.Result;
 }
Beispiel #2
0
 public TransitBrowser(DBlog.Data.Browser o)
     : base(o.Id)
 {
     Name = o.Name;
     Version = o.Version;
     Platform = o.Platform;
 }
Beispiel #3
0
        public TransitImage(ISession session, DBlog.Data.Image o, bool withthumbnail, bool withdata, bool hasaccess)
            : base(o.Id)
        {
            Name = o.Name;
            Path = o.Path;

            Counter = TransitCounter.GetAssociatedCounter<DBlog.Data.Image, ImageCounter>(
                session, o.Id);

            if (hasaccess)
            {
                Preferred = o.Preferred;
                Description = o.Description;
                Modified = o.Modified;

                CommentsCount = 0;

                // hack: disable comments, using disqus
                //CommentsCount = new CountQuery(session, typeof(ImageComment), "ImageComment")
                //    .Add(Expression.Eq("Image.Id", o.Id))
                //    .Execute<int>();

                if (withthumbnail)
                {
                    Thumbnail = o.Thumbnail;
                }

                if (withdata)
                {
                    Data = o.Data;
                }
            }
        }
Beispiel #4
0
 public TransitFeedItem(DBlog.Data.FeedItem o)
     : base(o.Id)
 {
     Link = o.Link;
     Title = o.Title;
     Description = o.Description;
     FeedId = o.Feed.Id;
 }
Beispiel #5
0
 public TransitReferrerHost(DBlog.Data.ReferrerHost o)
     : base(o.Id)
 {
     LastUrl = o.LastUrl;
     LastSource = o.LastSource;
     Name = o.Name;
     RequestCount = o.RequestCount;
 }
Beispiel #6
0
 public TransitPermalink(DBlog.Data.Permalink o)
     : base(o.Id)
 {
     TargetType = o.TargetType;
     SourceType = o.SourceType;
     SourceId = o.SourceId;
     TargetId = o.TargetId;
 }
Beispiel #7
0
 public TransitHighlight(DBlog.Data.Highlight o)
     : base(o.Id)
 {
     Url = o.Url;
     Title = o.Title;
     Description = o.Description;
     ImageId = o.Image.Id;
     Position = o.Position;
 }
Beispiel #8
0
 public TransitLogin(DBlog.Data.Login o)
     : base(o.Id)
 {
     Email = o.Email;
     Name = o.Name;
     Password = o.Password;
     Username = o.Username;
     Website = o.Website;
     Role = (TransitLoginRole) Enum.Parse(typeof(TransitLoginRole), o.Role);
 }
Beispiel #9
0
        public TransitPost(ISession session, DBlog.Data.Post o, bool hasaccess)
            : base(o.Id)
        {
            Title = o.Title;
            Slug = o.Slug;
            HasAccess = hasaccess;

            if (hasaccess)
            {
                mRawBody = o.Body;
                Body = Render(session, o.Body);
                BodyXHTML = RenderXHTML(session, o);
            }

            LoginId = o.Login.Id;

            if (o.PostImages != null && o.PostImages.Count > 0)
            {
                ImagesCount = o.PostImages.Count;

                if (hasaccess)
                {
                    ImageId = ((PostImage)TransitObject.GetRandomElement(o.PostImages)).Image.Id;
                }
            }

            // topics
            List<TransitTopic> topics = new List<TransitTopic>();
            if (o.PostTopics != null)
            {
                foreach (PostTopic postTopic in o.PostTopics)
                {
                    topics.Add(new TransitTopic(postTopic.Topic));
                }
            }
            mTopics = topics.ToArray();

            Created = o.Created;
            Modified = o.Modified;

            CommentsCount = new CountQuery(session, typeof(PostComment), "PostComment")
                .Add(Expression.Eq("Post.Id", o.Id))
                .Execute<int>();

            Counter = TransitCounter.GetAssociatedCounter<Post, PostCounter>(
                session, o.Id);

            Publish = o.Publish;
            Display = o.Display;
            Sticky = o.Sticky;
            Export = o.Export;
        }
Beispiel #10
0
 public TransitFeed(DBlog.Data.Feed o)
     : base(o.Id)
 {
     Url = o.Url;
     Name = o.Name;
     Description = o.Description;
     Interval = o.Interval;
     Updated = o.Updated;
     Exception = o.Exception;
     Xsl = o.Xsl;
     Username = o.Username;
     Password = o.Password;
     Type = (TransitFeedType) Enum.Parse(typeof(TransitFeedType), o.Type);
     Saved = o.Saved;
 }
        public TransitAssociatedComment(ISession session, DBlog.Data.Hibernate.AssociatedComment o, bool hasaccess)
        {
            CommentId = o.Id;
            AssociatedId = o.AssociatedId;
            AssociatedType = o.Type;

            if (hasaccess)
            {
                CommentIpAddress = o.IpAddress;
                CommentText = o.Text;
                CommentCreated = o.Created;
                CommentModified = o.Modified;
                CommentLevel = 0;
            }
        }
Beispiel #12
0
        public TransitComment(ISession session, DBlog.Data.Comment o, bool hasaccess)
            : base(o.Id)
        {
            if (hasaccess)
            {
                Text = o.Text;
                IpAddress = o.IpAddress;
                LoginName = o.OwnerLogin.Name;
                LoginWebsite = o.OwnerLogin.Website;
            }

            LoginId = o.OwnerLogin.Id;

            ParentCommentId = (o.Threads != null && o.Threads.Count > 0) ?
                ((Thread) o.Threads[0]).ParentComment.Id : 0;

            Created = o.Created;
            Modified = o.Modified;
        }
        public TransitAssociatedComment(ISession session, int id, DBlog.Data.Comment o, bool hasaccess)
            : base(id)
        {
            AssociatedId = id;
            CommentId = o.Id;

            if (hasaccess)
            {
                CommentIpAddress = o.IpAddress;
                CommentText = o.Text;
                if (o.OwnerLogin != null)
                {
                    CommentLoginName = o.OwnerLogin.Name;
                    CommentLoginWebsite = o.OwnerLogin.Website;
                }
                CommentCreated = o.Created;
                CommentModified = o.Modified;
                CommentLevel = GetLevel(o);
            }
        }
Beispiel #14
0
 public TransitPostLogin(ISession session, DBlog.Data.PostLogin o)
     : base(o.Id)
 {
     Post = new TransitPost(session, o.Post, false);
     Login = new TransitLogin(o.Login);
 }
 public TransitAssociatedComment(ISession session, DBlog.Data.Hibernate.AssociatedComment o, string ticket)
     : this(session, o, ManagedLogin.IsAdministrator(session, ticket))
 {
 }
 public TransitAssociatedComment(ISession session, DBlog.Data.Hibernate.AssociatedComment o)
     : this(session, o, true)
 {
 }
 public TransitAssociatedComment(ISession session, int id, DBlog.Data.Comment o)
     : this(session, id, o, true)
 {
 }
Beispiel #18
0
 public TransitPost(ISession session, DBlog.Data.Post o, string ticket)
     : this(session, o, GetAccess(session, o, ticket))
 {
 }
Beispiel #19
0
 public TransitImage(ISession session, DBlog.Data.Image o, bool withthumbnail, bool withdata, string ticket)
     : this(session, o, withthumbnail, withdata, HasAccess(session, o, ticket))
 {
 }
Beispiel #20
0
        public static bool HasAccess(ISession session, DBlog.Data.Comment comment, string ticket)
        {
            if (comment.PostComments == null || comment.PostComments.Count == 0)
                return true;

            foreach (PostComment pi in comment.PostComments)
            {
                if (TransitPost.GetAccess(session, pi.Post, ticket))
                    return true;
            }

            return false;
        }
Beispiel #21
0
 public TransitPostImage(ISession session, DBlog.Data.PostImage o, string ticket)
     : base(o.Id)
 {
     Post = new TransitPost(session, o.Post, ticket);
     Image = new TransitImage(session, o.Image, ticket);
 }
Beispiel #22
0
 public TransitPostComment(ISession session, DBlog.Data.PostComment o, string ticket)
     : base(session, o.Post.Id, o.Comment, TransitPost.GetAccess(session, o.Post, ticket))
 {
     AssociatedType = "Post";
 }
Beispiel #23
0
 public TransitImageComment(ISession session, DBlog.Data.ImageComment o, bool hasaccess)
     : base(session, o.Image.Id, o.Comment, hasaccess)
 {
     AssociatedType = "Image";
 }
Beispiel #24
0
 public TransitImageComment(ISession session, DBlog.Data.ImageComment o, string ticket)
     : this(session, o, TransitImage.HasAccess(session, o.Image, ticket))
 {
     AssociatedType = "Image";
 }
 public TransitReferrerHostRollup(DBlog.Data.ReferrerHostRollup o)
     : base(o.Id)
 {
     Rollup = o.Rollup;
     Name = o.Name;
 }
Beispiel #26
0
 public TransitImage(ISession session, DBlog.Data.Image o, string ticket)
     : this(session, o, false, false, HasAccess(session, o, ticket))
 {
 }
Beispiel #27
0
    public void inputImages_FilesPosted(object sender, DBlog.Tools.WebControls.FilesPostedEventArgs e)
    {
        if (PostId > 0)
        {
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                TransitImage image = new TransitImage();
                image.Data = new BinaryReader(file.InputStream).ReadBytes(file.ContentLength);
                image.Name = Path.GetFileName(file.FileName);
                SessionManager.BlogService.CreateOrUpdatePostImage(SessionManager.Ticket, PostId, image);
            }

            if (e.PostedFiles.Count > 0)
            {
                SessionManager.Invalidate<TransitPostImage>();
                SessionManager.Invalidate<TransitPost>();
                images.Visible = true;
                GetDataImages(sender, e);
            }
        }
    }
Beispiel #28
0
 public TransitComment(ISession session, DBlog.Data.Comment o, string ticket)
     : this(session, o, HasAccess(session, o, ticket))
 {
 }
Beispiel #29
0
 public TransitPostComment(ISession session, DBlog.Data.PostComment o)
     : base(session, o.Post.Id, o.Comment)
 {
     AssociatedType = "Post";
 }
Beispiel #30
0
 public TransitPostTopic(ISession session, DBlog.Data.PostTopic o)
     : base(o.Id)
 {
     Post = new TransitPost(session, o.Post, false);
     Topic = new TransitTopic(o.Topic);
 }