Exemplo n.º 1
0
def project_search_page_config(submit_type):
    store_person = person_operations()
    currentUser = store_person.GetPerson(current_user.email)
    store = project_operations()
    projects = store.get_projects()
    store_followed = followed_project_operations()
    count = len(projects)
    for i in range(0, count):
        temp = list(projects[i])
        if not store_followed.GetFollowedProjectByPersonIdAndProjectId(
                currentUser[0], projects[i][0]):
            temp.append(False)
        else:
            temp.append(True)
        projects[i] = tuple(temp)
    if submit_type == 'GET':
        return render_template('projects/search_project.html',
                               projects=projects)
    else:
        if 'details' in request.form:
            key = request.form['details']
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'follow' in request.form:
            project_id = request.form['follow']
            followProject = FollowedProject(
                None, currentUser[0], project_id,
                '"+str(datetime.datetime.now())+"', False)
            store_followed.AddFollowedProject(followProject)
            return redirect(url_for('site.projects_search_page'))
        elif 'unfollow' in request.form:
            project_id = request.form['unfollow']
            delete_project = store_followed.GetFollowedProjectByPersonIdAndProjectId(
                currentUser[0], project_id)
            store_followed.DeleteFollowedProject(delete_project[0])
            return redirect(url_for('site.projects_search_page'))
Exemplo n.º 2
0
def personal_cv_page_config(submit_type):
    t = experience_operations()
    now = datetime.datetime.now()
    store_CV = cv_operations()
    experiences = t.get_experience_s()
    PersonProvider = person_operations()
    Current_Person = PersonProvider.GetPerson(current_user.email)
    cvs = store_CV.get_cvs(Current_Person[0])
    if submit_type == 'GET':
        return render_template('personal/cv.html',
                               experiences=experiences,
                               cvs=cvs,
                               CurrentCV=0,
                               current_time=now.ctime())
    else:
        if request and 'Add_CV' in request.form:
            cvname = request.form['CvName']
            store_CV.add_cv(cvname, Current_Person[0])
        elif request and 'newCvName' in request.form and request.method == 'POST':
            cvName = request.form['newCvName']
            store_CV.add_cv(cvName, Current_Person[0])
            cvs = store_CV.get_cvs(Current_Person[0])
        return render_template(
            'personal/cv.html',
            experiences=experiences,
            cvs=cvs,
            CurrentCV=0,
            current_time=now.ctime(),
        )
Exemplo n.º 3
0
def home_page_config(request):
    PersonProvider = person_operations()
    Current_Person = PersonProvider.GetPerson(current_user.email)
    store_worklogs = work_log_operations()
    store_projects = project_operations()
    TeamProvider = team_operations()
    FollowedProjectProvider = followed_project_operations()
    active_projects = store_projects.get_the_projects_of_a_person(
        person_operations.GetPerson(current_user, current_user.email)[0])
    count = 0
    while (count < len(active_projects)):
        temp = list(active_projects[count])
        temp.append(
            list(
                TeamProvider.GetAllMembersByProjectId(
                    active_projects[count][3])))
        temp.append(
            len(
                FollowedProjectProvider.
                GetFollowerPersonListByFollowedProjectId(
                    active_projects[count][3])))
        active_projects[count] = tuple(temp)
        count = count + 1
    worklogs = store_worklogs.GetFollowedProjectsWorkLogs(Current_Person[0])
    return render_template('dashboard.html',
                           worklogs=worklogs,
                           active_projects=active_projects)
Exemplo n.º 4
0
def people_search_person_page_config(request):
    PersonProvider = person_operations()
    FollowedPersonProvider = followed_person_operations()
    Current_Person = PersonProvider.GetPerson(current_user.email)
    listPerson = PersonProvider.GetPersonListExcludePersonId(Current_Person[0])
    if request and 'follow' in request.form and request.method == 'POST':
        toAdd = FollowedPerson(None, Current_Person[0], request.form['follow'],
                               None, None)
        FollowedPersonProvider.AddFollowedPerson(toAdd)
    elif request and 'unfollow' in request.form and request.method == 'POST':
        toDeletedFollowedPerson = FollowedPersonProvider.GetFollowedPersonByPersonIdAndFollowedPersonId(
            Current_Person[0], request.form['unfollow'])
        FollowedPersonProvider.DeletePerson(toDeletedFollowedPerson[0])
    count = 0
    while (count < len(listPerson)):
        temp = list(listPerson[count])
        temp.append(
            len(
                FollowedPersonProvider.GetFollowedPersonListByFollowedPersonId(
                    listPerson[count][0])))  # Followers
        temp.append(
            len(
                FollowedPersonProvider.GetFollowedPersonListByPersonId(
                    listPerson[count][0])))  # Following
        if not FollowedPersonProvider.GetFollowedPersonByPersonIdAndFollowedPersonId(
                Current_Person[0], listPerson[count][0]):
            temp.append(
                False
            )  # Emtpy #O kisiyi takip etmiyor yani buton follow olacak
        else:
            temp.append(
                True)  # Full #O kisiyi takip ediyor yani buton unfollow olacak
        listPerson[count] = tuple(temp)
        count = count + 1
    return render_template('people/search_person.html', listPerson=listPerson)
Exemplo n.º 5
0
def mailbox_page_config(request):
    sender = person_operations.GetPerson(current_user, current_user.email)[0]
    key = sender
    messageStore = message_operations()
    Messages = messageStore.get_messages_by_id(key)
    peopleStore = person_operations()
    people = peopleStore.GetPersonList()
    person_with_history = messageStore.get_person_with_messaging_background(
        sender)
    unread = messageStore.get_total_no_of_unread_messages(sender)

    if request == "GET":
        return render_template('mailbox/mailbox.html',
                               current_user=current_user,
                               sender=sender,
                               messaged=messaged,
                               person_with_history=person_with_history,
                               key=key,
                               Messages=Messages,
                               people=people)
    else:
        if "sendMessage" in request.form:
            receiver = request.form['Receiver']
            sender = person_operations.GetPerson(current_user,
                                                 current_user.email)[0]
            message = request.form['Message']
            messageStore.send_message(sender, 5, message)
        return render_template('mailbox/mailbox.html',
                               key=key,
                               person_with_history=person_with_history,
                               unread=unread,
                               sender=sender,
                               current_user=current_user,
                               Messages=Messages,
                               people=people)
Exemplo n.º 6
0
def CurrentUserInfo():
    if hasattr(current_user, 'email'):
        person = person_operations().GetPerson(current_user.email)

        return dict(full_name=person[1], title=person[6], photopath=person[7])
    else:
        return dict(full_name='')
Exemplo n.º 7
0
def messages_page_with_key_config(request, key):
    messageStore = message_operations()
    Messages = messageStore.get_messages()
    peopleStore = person_operations()
    people = peopleStore.GetPersonList()
    receiverPerson = peopleStore.GetPersonByObjectId(key)

    sender = person_operations.GetPerson(current_user, current_user.email)[0]
    senderPerson = peopleStore.GetPersonByObjectId(sender)
    receiver_messages = messageStore.get_messages_by_receiver_id(key)
    sent_messages = messageStore.get_messages_by_sender_id(sender)
    received_messages = messageStore.get_received_messages(sender, key)
    messageStore.set_unread_messages_read(key, sender)
    person_with_history = messageStore.get_person_with_messaging_background(
        sender)

    if request == "GET":
        Messages = messageStore.get_messages()
        return render_template('mailbox/mailbox.html',
                               sent_messages=sent_messages,
                               receiver_messages=receiver_messages,
                               senderPerson=senderPerson,
                               receiverPerson=receiverPerson,
                               person_with_history=person_with_history,
                               sender=sender,
                               key=key,
                               Messages=Messages,
                               people=people)
    else:
        if "sendMessage" in request.form:
            receiver = request.form['sendMessage']
            sender = person_operations.GetPerson(current_user,
                                                 current_user.email)[0]
            message = request.form['Message']
            messageStore.send_message(sender, receiver, message)
            Messages = messageStore.get_messages()
        elif request and "deleteMessage" in request.form:
            deleteId = request.form['deleteMessage']
            deleterId = request.form['deleter']

            if request.form['messageType'] == "sent":
                messageStore.delete_messages_sent(deleteId, deleterId)

            elif request.form['messageType'] == "received":
                messageStore.delete_messages_received(deleteId, deleterId)

            Messages = messageStore.get_messages()

        return render_template('mailbox/mailbox.html',
                               sent_messages=sent_messages,
                               receiver_messages=receiver_messages,
                               person_with_history=person_with_history,
                               senderPerson=senderPerson,
                               receiverPerson=receiverPerson,
                               sender=sender,
                               key=key,
                               Messages=Messages,
                               people=people)
Exemplo n.º 8
0
 def add_cv(self, cvName, personId):
     cvStore = cv_operations()
     personStore = person_operations()
     UserList = personStore.GetPersonList()
     with dbapi2.connect(dsn) as connection:
         cursor = connection.cursor()
         query = "INSERT INTO CV ( PersonId, CreatedDate, UpdatedDate, CvName, Deleted) VALUES (%s, NOW(), NOW(), %s, 'FALSE')"
         cursor.execute(query, (personId, cvName))
         connection.commit()
         self.last_key = cursor.lastrowid
Exemplo n.º 9
0
def register_page_config(request):
    if request.method == 'GET':
        listTitle = GetTitleList()
        listAccount = GetAccountTypeList()
        return render_template('register.html', listTitle=listTitle, listAccount=listAccount, info=' ')
    else:
        if 'register' in request.form:
            PersonProvider = person_operations()
            first_name = request.form['firstName']
            last_name = request.form['lastName']
            eMail = request.form['eMail']
            p = PersonProvider.GetPerson(eMail)
            error = "'"+eMail+"'" + ' is already in use. Do you forget your password?'
            if p is not None:
                listTitle = GetTitleList()
                listAccount = GetAccountTypeList()
                return render_template('register.html', listTitle=listTitle, listAccount=listAccount, info=error)
            pswd = pwd_context.encrypt(request.form['pswd'])
            accountType = request.form['account']
            title = request.form['title']
            file = request.files['file']
            gender = request.form['r1']
            if gender == 'male':
                gender = False
            elif gender == 'female':
                gender = True
            if file and allowed_file(file.filename):
                filename = secure_filename(file.filename)
                file.save(os.path.join('static/user_images', filename))
            else:
                if gender == 'male':
                    filename = 'noimage_male.jpg'
                else:
                    filename = 'noimage_female.jpg'
            p = Person(None, first_name, last_name, accountType, eMail, pswd, gender, title, filename, False)
            u = User(eMail, pswd)
            PersonProvider.AddPerson(p)
            AddUser(u)
            return redirect(url_for('site.login_page', info=' '))
Exemplo n.º 10
0
def personal_default_page_config(request):
    PersonProvider = person_operations()
    Current_Person = PersonProvider.GetPerson(current_user.email)
    comments = personComment_operations()
    store_followed_projects = followed_project_operations()
    EducationProvider = education_operations()
    SkillProvider = skill_operations()
    InformationProvider = information_operations()
    LanguageProvider = language_operations()
    TeamProvider = team_operations()
    if request and 'delete' in request.form and request.method == 'POST':
        p = PersonProvider.GetPersonByObjectId(request.form['delete'])
        PersonProvider.DeletePerson(request.form['delete'])
    if request and 'deleteComment' in request.form and request.method == 'POST':
        comments.DeleteTeam(request.form['deleteComment'])
    elif request and 'updateComment' in request.form and request.method == 'POST':
        selectedComment = request.form['updateId']
        updatedComment = request.form['updateComment']
        comments.UpdatePersonComment(selectedComment, updatedComment)
    elif request and 'addComment' in request.form and request.method == 'POST':
        personId = Current_Person[0]
        commentedPersonId = Current_Person[0]
        newComment = request.form['addComment']
        comments.AddPersonComment(personId, commentedPersonId, newComment)
    elif 'unfollowProject' in request.form:
        project_id = request.form['unfollowProject']
        store_followed_projects.DeleteFollowedProject(project_id)
    elif request and 'searchPeoplePage' in request.form and request.method == 'POST':
        return redirect(url_for('site.people_search_person_page'))
    elif request and 'searchProjectPage' in request.form and request.method == 'POST':
        return redirect(url_for('site.projects_search_page'))
    elif request and 'saveProfileSettings' in request.form and request.method == 'POST':
        FollowedPersonProvider = followed_person_operations()
        listFollowing = FollowedPersonProvider.GetFollowedPersonListByPersonId(
            Current_Person[0])
        listFollowers = FollowedPersonProvider.GetFollowedPersonListByFollowedPersonId(
            Current_Person[0])
        personComments = comments.GetPersonCommentsByCommentedPersonId(
            Current_Person[0])
        listTitle = GetTitleList()
        listAccount = GetAccountTypeList()
        first_name = request.form['firstName']
        last_name = request.form['lastName']
        pswd = request.form['pswd']
        accountType = request.form['account']
        title = request.form['title']
        file = request.files['file']
        gender = request.form['r1']
        if gender == 'male':
            gender = False
        elif gender == 'female':
            gender = True
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            if filename != Current_Person[7]:
                file.save(os.path.join('static/user_images', filename))
            else:
                filename = Current_Person[7]
        elif Current_Person[7] is None:
            if gender:
                filename = 'noimage_female.jpg'
            else:
                filename = 'noimage_male.jpg'
        else:
            filename = Current_Person[7]
        if pswd != "":
            pswd = pwd_context.encrypt(request.form['pswd'])
            UpdateUser(pswd, current_user.email)
        PersonProvider.UpdatePerson(Current_Person[0], first_name, last_name,
                                    accountType, ' ', gender, title, filename,
                                    False)
        return redirect(
            url_for('site.personal_default_page',
                    Current_Person=Current_Person,
                    listFollowing=listFollowing,
                    listFollowers=listFollowers,
                    personComments=personComments,
                    listAccount=listAccount,
                    listTitle=listTitle))
    FollowedPersonProvider = followed_person_operations()
    listFollowing = FollowedPersonProvider.GetFollowedPersonListByPersonId(
        Current_Person[0])
    listFollowers = FollowedPersonProvider.GetFollowedPersonListByFollowedPersonId(
        Current_Person[0])
    personComments = comments.GetPersonCommentsByCommentedPersonId(
        Current_Person[0])
    followed_projects = store_followed_projects.GetFollowedProjectListByPersonId(
        Current_Person[0])
    count = 0
    while (count < len(followed_projects)):
        temp = list(followed_projects[count])
        temp.append(
            list(
                TeamProvider.GetAllMembersByProjectId(
                    followed_projects[count][8])))
        temp.append(
            len(
                store_followed_projects.
                GetFollowerPersonListByFollowedProjectId(
                    followed_projects[count][8])))
        followed_projects[count] = tuple(temp)
        count = count + 1
    now = datetime.datetime.now()
    listTitle = GetTitleList()
    listAccount = GetAccountTypeList()
    store_projects = project_operations()
    active_projects = store_projects.get_the_projects_of_a_person(
        Current_Person[0])
    count = 0
    while (count < len(active_projects)):
        temp = list(active_projects[count])
        temp.append(
            list(
                TeamProvider.GetAllMembersByProjectId(
                    active_projects[count][3])))
        temp.append(
            len(
                store_followed_projects.
                GetFollowerPersonListByFollowedProjectId(
                    active_projects[count][3])))
        active_projects[count] = tuple(temp)
        count = count + 1
    active_project_number = len(active_projects)
    listEducation = EducationProvider.GetEducationListByActiveCVAndByPersonId(
        Current_Person[0])
    listSkill = SkillProvider.GetSkillByActiveCVAndByPersonId(
        Current_Person[0])
    listLanguage = LanguageProvider.GetAllLanguagesByActiveCVAndByPersonId(
        Current_Person[0])
    listInformation = InformationProvider.get_all_information_by_ActiveCV_And_PersonId(
        Current_Person[0])
    CvProvider = cv_operations()
    activeCv = CvProvider.get_active_cv(Current_Person[0])
    ExperienceProvider = experience_operations()
    if activeCv:
        listExperience = ExperienceProvider.get_experiences_with_key(
            activeCv[0])
    else:
        listExperience = 'none'
    return render_template('personal/default.html',
                           current_time=now.ctime(),
                           Current_Person=Current_Person,
                           listFollowing=listFollowing,
                           listFollowers=listFollowers,
                           followed_projects=followed_projects,
                           personComments=personComments,
                           listAccount=listAccount,
                           listTitle=listTitle,
                           active_projects=active_projects,
                           active_project_number=active_project_number,
                           listEducation=listEducation,
                           listSkill=listSkill,
                           listExperience=listExperience,
                           listLanguage=listLanguage,
                           listInformation=listInformation)
Exemplo n.º 11
0
def project_details_page_config(submit_type, key):
    store = project_operations()
    store_comments = project_comment_operations()
    store_worklogs = work_log_operations()
    PersonProvider = person_operations()
    teamList = team_operations()
    necessaryProject = store.get_project_member_limit(key)
    memberLimit = necessaryProject[0][0]
    followed_projects = followed_project_operations()
    current_person = PersonProvider.GetPerson(current_user.email)
    isFollow = followed_projects.GetFollowedProjectByPersonIdAndProjectId(
        current_person[0], key)
    if submit_type == 'GET':
        project = store.get_project(key)
        listManager = GetManagerList()
        project_comments = store_comments.get_project_comments(key)
        listPerson = PersonProvider.GetPersonList()
        members = teamList.GetAllMembersByProjectId(key)
        worklogs = store_worklogs.GetWorkLogByProjectId(key)
        current_user_objectid = person_operations.GetPerson(
            current_user, current_user.email)[
                0]  #current_userın person tablosundaki halinin objectidsi
        project_creator = project[8]  #projeyi oluşturan kişi
        return render_template('projects/project_details.html',
                               project=project,
                               project_comments=project_comments,
                               members=members,
                               worklogs=worklogs,
                               listManager=listManager,
                               isFollow=isFollow,
                               current_user_objectid=current_user_objectid,
                               project_creator=project_creator,
                               listPerson=listPerson)
    else:
        if 'addComment' in request.form:
            person_id = person_operations.GetPerson(current_user,
                                                    current_user.email)[0]
            commented_project_id = int(key)
            comment = request.form['project_comment']
            create_date = datetime.datetime.now()
            update_date = datetime.datetime.now()
            project_comment = ProjectComment(None, person_id,
                                             commented_project_id, comment,
                                             create_date, update_date)
            store_comments.add_project_comment(project_comment)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'update' in request.form:
            title = request.form['project_name']
            project_description = request.form['project_description']
            end_date = request.form['updated_date']
            member_limit = request.form['limit']
            manager = request.form['project_manager']
            deleted = '0'
            store.update_project(int(key), title, project_description,
                                 end_date, member_limit, manager, deleted)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'delete_project' in request.form:
            store.delete_project(int(key))
            return redirect(url_for('site.home_page'))
        elif 'delete' in request.form:
            comment_key = request.form['delete']
            store_comments.delete_project_comment(int(comment_key))
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'edit' in request.form:
            comment_key = request.form['edit']
            new_comment = request.form['newComment']
            store_comments.update_project_comment(comment_key, new_comment,
                                                  False)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'addMember' in request.form:
            teamMembers = request.form.getlist('teamMember')
            lengthOfLoop = len(teamMembers)
            howManyMembers = teamList.CountOfTeamsInProject(key)
            projectTeamMembers = howManyMembers[0]
            for x in range(0, lengthOfLoop):
                if projectTeamMembers >= memberLimit:
                    break
                newMemberDuty = request.form['addDuty']
                newMemberMemberId = teamMembers[x]
                newMemberProjectId = key
                triedMember = teamList.GetDutyByMemberId(
                    newMemberMemberId, key)
                lengthOfTried = len(triedMember)
                if lengthOfTried == 0:
                    projectTeamMembers += 1
                    teamList.AddTeam(newMemberProjectId, newMemberMemberId,
                                     newMemberDuty)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'updateMember' in request.form:
            newDuty = request.form['updatedMemberDuty']
            objectId = request.form['updatedMemberId']
            teamList.UpdateMemberDuty(objectId, newDuty)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'deleteMember' in request.form:
            deleteMemberId = request.form['deleteMember']
            teamList.DeleteTeam(deleteMemberId)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'addWorklog' in request.form:
            cretaorPersonId = person_operations.GetPerson(
                current_user, current_user.email)[0]
            projectId = key
            commitMessage = request.form['commitMessage']
            worklog = WorkLog(None, projectId, commitMessage,
                              ' "+str(datetime.datetime.now())+" ',
                              cretaorPersonId, False)
            store_worklogs.AddWorkLog(worklog)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'editWorklog' in request.form:
            worklog_id = request.form['editWorklog']
            new_log = request.form['new_log']
            store_worklogs.UpdateWorkLog(worklog_id, new_log)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'deleteWorklog' in request.form:
            worklog_id = request.form['deleteWorklog']
            store_worklogs.DeleteWorkLog(worklog_id)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'follow' in request.form:
            follow_project = FollowedProject(
                None, current_person[0], key,
                ' "+str(datetime.datetime.now())+" ', False)
            followed_projects.AddFollowedProject(follow_project)
            return redirect(url_for('site.projects_details_page', key=key))
        elif 'unfollow' in request.form:
            unfollow_project_id = followed_projects.GetFollowedProjectByPersonIdAndProjectId(
                current_person[0], key)[0]
            followed_projects.DeleteFollowedProject(unfollow_project_id)
            return redirect(url_for('site.projects_details_page', key=key))
Exemplo n.º 12
0
def people_person_detail_page_config(request, key):
    PersonProvider = person_operations()
    CommentProvider = personComment_operations()
    Current_Person = PersonProvider.GetPerson(current_user.email)
    FollowedPersonProvider = followed_person_operations()
    CvProvider = cv_operations()
    ExperienceProvider = experience_operations()
    FollowedProjectProvider = followed_project_operations()
    EducationProvider = education_operations()
    SkillProvider = skill_operations()
    InformationProvider = information_operations()
    LanguageProvider = language_operations()
    TeamProvider = team_operations()
    if request and 'deleteComment' in request.form and request.method == 'POST':
        CommentProvider.DeleteTeam(request.form['deleteComment'])
    elif request and 'updateComment' in request.form and request.method == 'POST':
        selectedComment = request.form['updateId']
        updatedComment = request.form['updateComment']
        CommentProvider.UpdatePersonComment(selectedComment, updatedComment)
    elif request and 'addComment' in request.form and request.method == 'POST':
        newComment = request.form['addComment']
        CommentProvider.AddPersonComment(Current_Person[0], key, newComment)
    elif request and 'follow' in request.form and request.method == 'POST':
        toAdd = FollowedPerson(None, Current_Person[0], key, None, None)
        FollowedPersonProvider.AddFollowedPerson(toAdd)
    elif request and 'unfollow' in request.form and request.method == 'POST':
        toDeletedFollowedPerson = FollowedPersonProvider.GetFollowedPersonByPersonIdAndFollowedPersonId(
            Current_Person[0], key)
        FollowedPersonProvider.DeletePerson(toDeletedFollowedPerson[0])
    FollowedPersonProvider = followed_person_operations()
    Active_Person = PersonProvider.GetPersonByObjectId(key)
    listFollowing = FollowedPersonProvider.GetFollowedPersonListByPersonId(key)
    listFollowers = FollowedPersonProvider.GetFollowedPersonListByFollowedPersonId(
        key)
    personComments = CommentProvider.GetPersonCommentsByCommentedPersonId(key)
    IsFollow = FollowedPersonProvider.GetFollowedPersonByPersonIdAndFollowedPersonId(
        Current_Person[0], Active_Person[0])
    activeCv = CvProvider.get_active_cv(key)
    followed_projects = FollowedProjectProvider.GetFollowedProjectListByPersonId(
        key)
    count = 0
    while (count < len(followed_projects)):
        temp = list(followed_projects[count])
        temp.append(
            list(
                TeamProvider.GetAllMembersByProjectId(
                    followed_projects[count][8])))
        temp.append(
            len(
                FollowedProjectProvider.
                GetFollowerPersonListByFollowedProjectId(
                    followed_projects[count][8])))
        followed_projects[count] = tuple(temp)
        count = count + 1
    store_projects = project_operations()
    active_projects = store_projects.get_the_projects_of_a_person(key)
    count = 0
    while (count < len(active_projects)):
        temp = list(active_projects[count])
        temp.append(
            list(
                TeamProvider.GetAllMembersByProjectId(
                    active_projects[count][3])))
        temp.append(
            len(
                FollowedProjectProvider.
                GetFollowerPersonListByFollowedProjectId(
                    active_projects[count][3])))
        active_projects[count] = tuple(temp)
        count = count + 1
    active_project_number = len(active_projects)
    listEducation = EducationProvider.GetEducationListByActiveCVAndByPersonId(
        Active_Person[0])
    listSkill = SkillProvider.GetSkillByActiveCVAndByPersonId(Active_Person[0])
    listLanguage = LanguageProvider.GetAllLanguagesByActiveCVAndByPersonId(
        Active_Person[0])
    listInformation = InformationProvider.get_all_information_by_ActiveCV_And_PersonId(
        Active_Person[0])
    if activeCv:
        listExperience = ExperienceProvider.get_experiences_with_key(
            activeCv[0])
    else:
        listExperience = 'none'
    now = datetime.now()
    return render_template('people/person_detail.html',
                           current_time=now.ctime(),
                           Current_Person=Current_Person,
                           Active_Person=Active_Person,
                           listFollowing=listFollowing,
                           listFollowers=listFollowers,
                           personComments=personComments,
                           IsFollow=IsFollow,
                           followed_projects=followed_projects,
                           listExperience=listExperience,
                           active_projects=active_projects,
                           active_project_number=active_project_number,
                           listEducation=listEducation,
                           listSkill=listSkill,
                           listLanguage=listLanguage,
                           listInformation=listInformation)
Exemplo n.º 13
0
def personal_cv_pagewithkey_config(submit_type, key):
    PersonProvider = person_operations()
    CurrentPerson = PersonProvider.GetPerson(current_user.email)
    languages = language_operations()
    store_CV = cv_operations()
    t = experience_operations()
    store_experience = experience_operations()
    store_education = education_operations()
    now = datetime.datetime.now()
    CurrentCV = store_CV.get_cv(int(key))
    listEducation = store_education.GetEducationListByCVId(key)
    experiences = t.get_experience_s_with_key(key)
    allLanguages = languages.GetAllLanguagesByCVId(key)
    cvs = store_CV.get_cvs(CurrentPerson[0])
    listInformation = GetInformationTypeList()
    information_store = information_operations()
    allInformation = information_store.get_all_information_by_CVId(key)
    store_skill = skill_operations()
    skills = store_skill.GetSkillByCVId(key)
    updateCV = "False"
    if submit_type == 'POST':
        if request and 'deleteLanguage' in request.form and request.method == 'POST':
            deleteIndex = request.form['deleteLanguage']
            languages.DeleteLanguage(deleteIndex)
            allLanguages = languages.GetAllLanguagesByCVId(key)
            updateCV = "TRUE"
        elif request and 'newLanguageName' in request.form and request.method == 'POST':
            newLanguageName = request.form['newLanguageName']
            newLevel = request.form['newLanguageLevel']
            languages.AddLanguage(key, newLanguageName, newLevel)
            allLanguages = languages.GetAllLanguagesByCVId(key)
            updateCV = "TRUE"
        elif request and 'updateLanguageName' in request.form and request.method == 'POST':
            updateName = request.form['updateLanguageName']
            updateLevel = request.form['updateLanguageLevel']
            ID = request.form['updateLanguageId']
            languages.UpdateLanguage(ID, updateName, updateLevel)
            allLanguages = languages.GetAllLanguagesByCVId(key)
            updateCV = "TRUE"
        elif request and 'deleteInformation' in request.form and request.method == 'POST':
            deletionIndex = request.form['deleteInformation']
            information_store.delete_information(deletionIndex)
            allInformation = information_store.get_all_information_by_CVId(key)
            updateCV = "TRUE"
        elif request and 'updateInformationDesc' in request.form and request.method == 'POST':
            updatedInformationDescription = request.form[
                'updateInformationDesc']
            InformationId = request.form['updateInformationId']
            information_store.update_information(
                InformationId, updatedInformationDescription)
            allInformation = information_store.get_all_information_by_CVId(key)
            updateCV = "TRUE"
        elif request and 'information_desc' in request.form and request.method == 'POST':
            information_type_id = request.form['information_type']
            information_desc = request.form['information_desc']
            information_store.add_information(key, information_type_id,
                                              information_desc)
            allInformation = information_store.get_all_information_by_CVId(key)
            updateCV = "TRUE"
        elif request and 'txtSchoolName' in request.form and request.method == 'POST':
            txtSchoolName = request.form['txtSchoolName']
            txtSchoolDesc = request.form['txtSchoolDesc']
            dpSchoolStart = request.form['dpSchoolStart']
            dpSchoolEnd = request.form['dpSchoolEnd']
            txtGrade = request.form['txtGrade']
            e = Education(None, key, txtSchoolName, txtSchoolDesc, txtGrade,
                          dpSchoolStart, dpSchoolEnd, False)
            store_education.AddEducation(e)
            listEducation = store_education.GetEducationListByCVId(key)
            updateCV = "TRUE"
        elif request and 'deleteEducation' in request.form and request.method == 'POST':
            deleteIndex = request.form['deleteEducation']
            store_education.DeleteEducationWithoutStore(deleteIndex)
            listEducation = store_education.GetEducationListByCVId(key)
            updateCV = "TRUE"
        elif request and 'txtUpdateSchoolName' in request.form and request.method == 'POST':
            txtUpdateSchoolName = request.form['txtUpdateSchoolName']
            txtUpdateSchoolDesc = request.form['txtUpdateSchoolDesc']
            dpUpdateSchoolStart = request.form['dpUpdateSchoolStart']
            dpUpdateSchoolEnd = request.form['dpUpdateSchoolEnd']
            txtUpdateGrade = request.form['txtUpdateGrade']
            id = request.form['hfUpdateEducationId']
            store_education.UpdateEducation(id, txtUpdateSchoolName,
                                            txtUpdateSchoolDesc,
                                            txtUpdateGrade,
                                            dpUpdateSchoolStart,
                                            dpUpdateSchoolEnd)
            listEducation = store_education.GetEducationListByCVId(key)
            updateCV = "TRUE"
        elif request and 'newCvName' in request.form and request.method == 'POST':
            cvName = request.form['newCvName']
            store_CV.add_cv_with_key(cvName, key)
            cvs = store_CV.get_cvs(CurrentPerson[0])
        elif request and 'setCVActive' in request.form and request.method == 'POST':
            store_CV.set_cv_active(key, CurrentPerson[0])
            updateCV = 'TRUE'
        elif request and 'DeleteCv' in request.form and request.method == 'POST':
            store_CV.delete_cv(key)
            return redirect(url_for('site.personal_cv_page'))
        elif request and 'NewCompanyName' in request.form and request.method == 'POST':
            newCompanyName = request.form['NewCompanyName']
            newDescription = request.form['NewDescription']
            newPosition = request.form['NewPosition']
            startDate = request.form['NewStartDate']
            endDate = request.form['NewEndDate']
            store_experience.add_experience(key, newDescription,
                                            newCompanyName, newPosition,
                                            startDate, endDate)
            experiences = store_experience.get_experience_s_with_key(key)
            updateCV = "TRUE"
        elif request and 'DeleteExperience' in request.form and request.method == 'POST':
            deleteId = request.form['HiddenId']
            store_experience.delete_experience(deleteId)
            experiences = store_experience.get_experience_s_with_key(key)
            updateCV = "TRUE"
        elif request and 'UpdateExperience' in request.form and request.method == 'POST':
            updateId = request.form['HiddenId']
            updatedCompanyName = request.form['UpdatedCompanyName']
            updatedDescription = request.form['UpdatedDescription']
            updatedPosition = request.form['UpdatedPosition']
            updatedStartDate = request.form['UpdatedStartDate']
            updatedEndDate = request.form['UpdatedEndDate']
            store_experience.update_experience(updateId, updatedDescription,
                                               updatedStartDate,
                                               updatedEndDate,
                                               updatedCompanyName,
                                               updatedPosition)
            experiences = store_experience.get_experience_s_with_key(key)
            updateCV = "TRUE"
        elif request and 'newSkill' in request.form and request.method == 'POST':
            newSkillName = request.form['newSkill']
            skillLevel = request.form['skillLevel']
            store_skill.AddSkill(key, newSkillName, skillLevel)
            skills = store_skill.GetSkillByCVId(key)
            updateCV = "TRUE"
        elif request and 'deleteSkill' in request.form and request.method == 'POST':
            delete_id = request.form['deleteSkill']
            store_skill.DeleteSkill(delete_id)
            skills = store_skill.GetSkillByCVId(key)
            updateCV = "TRUE"
        elif request and 'updateSkillName' in request.form and request.method == 'POST':
            updateSkillName = request.form['updateSkillName']
            updateSkillLevel = request.form['updateSkillLevel']
            update_id = request.form['updateSkillId']
            store_skill.UpdateSkill(update_id, updateSkillName,
                                    updateSkillLevel)
            skills = store_skill.GetSkillByCVId(key)
            updateCV = "TRUE"
    if updateCV == "TRUE":
        store_CV.update_cv(key)

    return render_template('personal/cv.html',
                           cvs=cvs,
                           CurrentCV=CurrentCV,
                           languages=allLanguages,
                           experiences=experiences,
                           listEducation=listEducation,
                           current_time=now.ctime(),
                           informationn=allInformation,
                           listInformation=listInformation,
                           skills=skills)
Exemplo n.º 14
0
def getMembers():
    listLastMember = person_operations().GetLastThreePeople()
    return jsonify(listLastMember)