Exemplo n.º 1
0
        public string addSubForum(string subForumName)
        {
            SubForum subForum = getSubForum(subForumName);

            if (subForum != null)
            {
                return("Sub forum " + subForumName + " already exist.");
            }
            subForum = SubForum.create(_name, subForumName);
            if (subForum == null)
            {
                return("Invalid sub forum name.");
            }
            if (!ForumSystem._testFlag)
            {
                if (!ForumSystem._db.addSubForum(_name, subForumName))
                {
                    return(Constants.DB_ERROR);
                }
            }
            _subForums.Add(subForum);
            if (!_subForums.Contains(subForum))
            {
                return(Constants.FUNCTION_ERRROR); // cannot cover this case
            }
            ForumSystem.notify("A new sub forum has been added to the forum you are currently in.", _interactiveNotifications, _name);
            return(Constants.SUCCESS);
        }
Exemplo n.º 2
0
        public void addPostsToList(List <Tuple <string, string, DateTime, int, int, string, DateTime> > list, string subForumName, int openPostNo)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf != null)
            {
                sf.addPostsToList(list, openPostNo);
            }
        }
Exemplo n.º 3
0
        public void addThreadsToList(List <Tuple <string, DateTime, int> > list, string subForumName)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf != null)
            {
                sf.addThreadsToList(list);
            }
        }
Exemplo n.º 4
0
        public int getNumOfPostsInSubForum(string subForumName)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf == null)
            {
                return(-1);
            }
            return(sf.getNumOfPOsts());
        }
Exemplo n.º 5
0
        public string editPost(string subForumName, int postNo, string requestingUser, permission p, string content)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf == null)
            {
                return(subForumDoesntExist(subForumName));
            }
            return(sf.editPost(postNo, requestingUser, p, content));
        }
Exemplo n.º 6
0
        public string deletePost(string subForumName, int postNo, postDeletionPermission pdp, permission p, string requestingUser)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf == null)
            {
                return(subForumDoesntExist(subForumName));
            }
            return(sf.deletePost(postNo, pdp, p, requestingUser));
        }
Exemplo n.º 7
0
        public string writePost(string subForumName, int parentPostNo, User user, string title, string content)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf == null)
            {
                return(subForumDoesntExist(subForumName));
            }
            return(sf.writePost(parentPostNo, user, title, content));
        }
Exemplo n.º 8
0
        public void addThreadsToList(List <Tuple <string, DateTime, int> > list, string subForumName, string requestingUser)
        {
            SubForum sf = getSubForum(subForumName);

            if (sf != null)
            {
                sf.addThreadsToList(list);
                sf.observe(requestingUser);
            }
        }
Exemplo n.º 9
0
        public string addSubForum(string subForumName)
        {
            SubForum subForum = getSubForum(subForumName);

            if (subForum != null)
            {
                return("Sub forum " + subForumName + " already exist.");
            }
            subForum = SubForum.create(_name, subForumName);
            if (subForum == null)
            {
                return("Invalid sub forum name.");
            }
            _subForums.Add(subForum);
            if (!_subForums.Contains(subForum))
            {
                return(FUNCTION_ERRROR);
            }
            return(SUCCESS);
        }