Ejemplo n.º 1
0
    def join(self):
        projectId = self.request('project_id')
        description = self.request('message')

        if (not self.user):
            log.error("*** join submitted w/o logged in user")
            return False
        elif (not projectId):
            log.error("*** join submitted w/o logged project id")
            return False
        elif (util.strNullOrEmpty(description)):
            log.error("*** join submitted w/o idea")
            return False
        else:
            isJoined = mProject.join(self.db, projectId, self.user.id)

            if (isJoined):
                project = mProject.Project(self.db, projectId)

                # create the user's "hello there" idea and add to project
                newIdeaId = mIdea.createIdea(self.db,
                                            description,
                                            project.data.location_id,
                                            'web',
                                            self.user.id,
                                            self.user.email)

                if (newIdeaId):
                    if (not mIdea.addIdeaToProject(self.db, newIdeaId, projectId)):
                        log.error("*** new idea not created for user %s on joining project %s" % (self.user.id, projectId))
                else:
                    log.error("*** new idea not created for user %s on joining project %s" % (self.user.id, projectId))

                # automatically insert any ideas attached to invites for this user and this project
                if (not mIdea.addInvitedIdeaToProject(self.db, projectId, self.user.id)):
                    log.error("*** couldn't add invited idea to project for user %s on joining project %s" % (self.user.id, projectId))

                # add a message to the queue about the join
                message = 'New Member! Your project now has %s total!' % project.data.num_members

                # email admin
                if (not mMessaging.emailProjectJoin(project.data.owner_email,
                                                    projectId,
                                                    project.data.title,
                                                    self.user.id,
                                                    mProject.userNameDisplay(self.user.firstName,
                                                                             self.user.lastName,
                                                                             self.user.affiliation,
                                                                             mProject.isFullLastName(self.user.groupMembershipBitmask)))):
                    log.error("*** couldn't email admin on user_id = %s joining project %s" % (self.user.id, projectId))

                if (not mProject.addMessage(self.db,
                                            projectId,
                                            message,
                                            'join',
                                            self.user.id,
                                            newIdeaId)):
                    log.error("*** new message not created for user %s on joining project %s" % (self.user.id, projectId))

        return isJoined
Ejemplo n.º 2
0
    def join(self):
        projectId = self.request('project_id')

        if (not self.user):
            log.error("*** join submitted w/o logged in user")
            return False
        elif (not projectId):
            log.error("*** join submitted w/o logged project id")
            return False

        else:
            isJoined = mProject.join(self.db, projectId, self.user.id)

            if (isJoined):
                project = mProject.Project(self.db, projectId)

                # add a message to the queue about the join
                message = 'New Member! Your project now has %s total!' % project.data.num_members

                # email admin
                if (not mMessaging.emailProjectJoin(
                        project.data.owner_email, projectId,
                        project.data.title, self.user.id,
                        mProject.userNameDisplay(
                            self.user.firstName, self.user.lastName,
                            self.user.affiliation,
                            mProject.isFullLastName(
                                self.user.groupMembershipBitmask)))):
                    log.error(
                        "*** couldn't email admin on user_id = %s joining project %s"
                        % (self.user.id, projectId))

                if (not mProject.addMessage(self.db, projectId, message,
                                            'join', self.user.id)):
                    log.error(
                        "*** new message not created for user %s on joining project %s"
                        % (self.user.id, projectId))

        return isJoined
Ejemplo n.º 3
0
    def join(self):
        projectId = self.request('project_id')

        if (not self.user):
            log.error("*** join submitted w/o logged in user")
            return False
        elif (not projectId):
            log.error("*** join submitted w/o logged project id")
            return False
        
        else:
            isJoined = mProject.join(self.db, projectId, self.user.id)

            if (isJoined):
                project = mProject.Project(self.db, projectId)
                
                # add a message to the queue about the join
                message = 'New Member! Your project now has %s total!' % project.data.num_members

                # email admin
                if (not mMessaging.emailProjectJoin(project.data.owner_email,
                                                    projectId,
                                                    project.data.title,
                                                    self.user.id,
                                                    mProject.userNameDisplay(self.user.firstName,
                                                                             self.user.lastName,
                                                                             self.user.affiliation,
                                                                             mProject.isFullLastName(self.user.groupMembershipBitmask)))):
                    log.error("*** couldn't email admin on user_id = %s joining project %s" % (self.user.id, projectId))

                if (not mProject.addMessage(self.db,
                                            projectId,
                                            message,
                                            'join',
                                            self.user.id)):
                    log.error("*** new message not created for user %s on joining project %s" % (self.user.id, projectId))

        return isJoined
Ejemplo n.º 4
0
    def join(self):
        projectId = self.request('project_id')
        description = self.request('message')

        if (not self.user):
            log.error("*** join submitted w/o logged in user")
            return False
        elif (not projectId):
            log.error("*** join submitted w/o logged project id")
            return False
        elif (util.strNullOrEmpty(description)):
            log.error("*** join submitted w/o idea")
            return False
        else:
            isJoined = mProject.join(self.db, projectId, self.user.id)

            if (isJoined):
                project = mProject.Project(self.db, projectId)

                # create the user's "hello there" idea and add to project
                newIdeaId = mIdea.createIdea(self.db, description,
                                             project.data.location_id, 'web',
                                             self.user.id, self.user.email)

                if (newIdeaId):
                    if (not mIdea.addIdeaToProject(self.db, newIdeaId,
                                                   projectId)):
                        log.error(
                            "*** new idea not created for user %s on joining project %s"
                            % (self.user.id, projectId))
                else:
                    log.error(
                        "*** new idea not created for user %s on joining project %s"
                        % (self.user.id, projectId))

                # automatically insert any ideas attached to invites for this user and this project
                if (not mIdea.addInvitedIdeaToProject(self.db, projectId,
                                                      self.user.id)):
                    log.error(
                        "*** couldn't add invited idea to project for user %s on joining project %s"
                        % (self.user.id, projectId))

                # add a message to the queue about the join
                message = 'New Member! Your project now has %s total!' % project.data.num_members

                # email admin
                if (not mMessaging.emailProjectJoin(
                        project.data.owner_email, projectId,
                        project.data.title, self.user.id,
                        mProject.userNameDisplay(
                            self.user.firstName, self.user.lastName,
                            self.user.affiliation,
                            mProject.isFullLastName(
                                self.user.groupMembershipBitmask)))):
                    log.error(
                        "*** couldn't email admin on user_id = %s joining project %s"
                        % (self.user.id, projectId))

                if (not mProject.addMessage(self.db, projectId, message,
                                            'join', self.user.id, newIdeaId)):
                    log.error(
                        "*** new message not created for user %s on joining project %s"
                        % (self.user.id, projectId))

        return isJoined