Ejemplo n.º 1
0
def handle(request):
    filter_id = dataplus.dictGetSafeVal(request.REQUEST, 'filterId', '')
    if filter_id:
        resume_filter = get_object_or_404(models.RecruiterSubscription,
                                          id=filter_id)
        results = search_helper.matchResumes(resume_filter.keywords,
                                             resume_filter.experience,
                                             resume_filter.location,
                                             resume_filter.max_salary,
                                             resume_filter.added_on,
                                             datetime.datetime.utcnow())
        return HttpResponse(
            str(resume_filter) + ': Results(' + str(results) + ')')

    else:
        html = ''
        filters = models.RecruiterSubscription.objects.all()
        for resume_filter in filters:
            response = search_helper.matchResumes(
                resume_filter.keywords, resume_filter.experience,
                resume_filter.location, resume_filter.max_salary,
                resume_filter.added_on, datetime.datetime(1980, 10, 3))
            html += 'Results(' + str(
                [result[id] for result in response.results]) + ')<br />'
        return HttpResponse(html)
Ejemplo n.º 2
0
def handle(request):
    filter_id = dataplus.dictGetSafeVal(request.REQUEST, 'filterId', '')
    if filter_id:
        resume_filter = get_object_or_404(models.RecruiterSubscription, id=filter_id)
        results = search_helper.matchResumes(resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime.utcnow())
        return HttpResponse(str(resume_filter) + ': Results(' + str(results) + ')')

    else:
        html = ''
        filters = models.RecruiterSubscription.objects.all()
        for resume_filter in filters:
            response = search_helper.matchResumes(resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime(1980,10,3))
            html += 'Results(' + str([result[id] for result in response.results]) + ')<br />'
        return HttpResponse(html)
Ejemplo n.º 3
0
def handle(request):
    if not request.user.is_authenticated(): return HttpResponseRedirect('/admin/')
    
    if request.method == 'GET':
        return codejar.actions.render(request, 'sys/recinvite.htm')
    
    elif request.method == 'POST':
        rec_emails = dataplus.dictGetSafeVal(request.REQUEST, 'emails', '')
        keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '')
        experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi)
        location = dataplus.dictGetSafeVal(request.REQUEST, 'location', '')
        key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
        if rec_emails:
            min_datetime = datetime.datetime(1980, 10, 3)   #min_date
            response = search_helper.matchResumes(keywords, experience, location, 99999999, min_datetime)
            usr_list = response.results
            usr_list.sort(lambda x,y: x['rating']-y['rating'])
            usr_list = addFormatting(usr_list[:50])
            
            for email in rec_emails.split(','):
                token_value = models.Token.getNew('system', email, 'Invites')
                sel_users = getRandomUsers(usr_list)
                for usr in sel_users:
                    notifications.addNotification(usr['id'], 'ProfEmailed', data={'recruiter_email':email})
                mailer.sendAdminRecruiterInvites(email, {'token':token_value, 'key':key, 'matching_users':sel_users})
        
        return HttpResponseRedirect('/sys/recinvite.htm?flashId=recruiters_invited')
Ejemplo n.º 4
0
def handle(request):
    rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
    if not rec: return redirect
    
    email_list = dataplus.dictGetSafeVal(request.REQUEST, 'email_list', '')
    email_query = dataplus.dictGetSafeVal(request.REQUEST, 'email_query', '')
    if email_query:
        search_keywords, experience, location, max_salary = cPickle.loads(base64.b64decode(email_query))
        response = search_helper.matchResumes(search_keywords, experience, location, max_salary, datetime.datetime(1981, 1, 9))
        email_list = dataplus.decode(string.join([usr['email'] for usr in response.results], '; '))
    
    action = dataplus.dictGetSafeVal(request.REQUEST, 'action', '')
    if action == 'show_form':
        return codejar.actions.render(request, 'recruiters/emailusers.htm',
                               {'to_list':email_list,
                                'recruiter': rec})
    
    elif action == 'email_users':
        subject = dataplus.dictGetSafeVal(request.REQUEST, 'subject', '')
        message = dataplus.dictGetSafeVal(request.REQUEST, 'message', '')
        
        message += '<p>&nbsp;</p><div style="border-bottom: 1px solid rgb(153, 153, 153);"></div><p>This email has been sent by %s(%s) of %s using <a href="http://www.jobhunt.in">www.jobhunt.in</a> services.</p>' % (rec.name, rec.email, rec.organization)
        mailman.sendMail(rec.name + '<*****@*****.**>', email_list.split(';'), subject, message, reply_to=rec.email)
        
        eventnotifier.sendEventNotification("New Recruiter Mass Mail: " + subject + " - " + rec.name + "(" + rec.email + ")" + " message:\n" + message)
        
        return HttpResponseRedirect('dashboard.htm?flashId=email_sent')
Ejemplo n.º 5
0
def sendSubscriptionResults(subscription, rec_id, rec_key, rec_email, from_job=False):
    #try:
        print rec_email

        response = search_helper.matchResumes(subscription.keywords, subscription.experience, subscription.location, subscription.max_salary, subscription.results_last_sent_on)
        if string.atoi(response.numFound) >= subscription.min_count:
            sendMailToRecruiter(response.results, subscription, rec_email, rec_key)
            logSentUsers(response.results, rec_email, subscription.id)
        if not from_job:    connection.commit()
Ejemplo n.º 6
0
def handle(request):
    rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
    if not rec:	return redirect

    page = dataplus.dictGetVal(request.REQUEST, 'page', 0, string.atoi)
    subscr_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0, string.atoi)
    keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '')
    search_tuple = dataplus.dictGetSafeVal(request.REQUEST, 'searchTuple', '')
    search_dict = {}
    min_datetime = datetime.datetime(1981, 1, 9)    #Jes B'day
    response = None
    search_desc = ''
    if subscr_id:    
        subscr = dataplus.returnIfExists(models.RecruiterSubscription.objects.filter( id=subscr_id))
        if not (subscr and subscr.recruiter == rec):	raise Http404
        search_dict = {'keywords':subscr.keywords, 'experience':subscr.experience, 'location':subscr.location,
                       'max_salary':subscr.max_salary, 'limit_time':subscr.results_last_sent_on}
    elif keywords:
        experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi)
        location = dataplus.dictGetSafeVal(request.REQUEST, 'location', 'Any')
        max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', 0, string.atoi)
        search_tuple = base64.b64encode(cPickle.dumps((keywords, experience, location, max_salary)))
        search_dict = {'keywords':keywords.strip('\r'), 'experience':experience, 'location':location.strip('\r'),
                       'max_salary':max_salary, 'limit_time':min_datetime}
        models.RecruiterData.addToRecentSearches(rec, search_dict)
    elif search_tuple:
        search_keywords, experience, location, max_salary = cPickle.loads(base64.b64decode(search_tuple))
        search_dict = {'keywords':search_keywords, 'experience':experience, 'location':location,
                       'max_salary':max_salary, 'limit_time':min_datetime}
    else:
        raise Http404
    
    response = search_helper.matchResumes(search_dict['keywords'], search_dict['experience'], search_dict['location'], search_dict['max_salary'], search_dict['limit_time'], start=page * page_size, rows=page_size)
    user_list = response.results
    num_pages = 0
    if (len(user_list) > 0):
    	num_pages = ((string.atoi(response.numFound )-1) / page_size) + 1
    
    return codejar.actions.render(request, 'recruiters/searchresults.htm', {'subscription_id':subscr_id,
                              'search_tuple': search_tuple,
                              'search_url': urllib.urlencode(search_dict),
                              'users': addFormatting(user_list, page),
                              'search_desc': getSearchDisplay(search_dict),
                              'links_html': getLinksHtml(num_pages, page, user_list),
                              'num_results':response.numFound,
                              'date':datetime.datetime.utcnow().strftime('%B %e, %Y')
                              })
Ejemplo n.º 7
0
def sendSubscriptionResults(subscription,
                            rec_id,
                            rec_key,
                            rec_email,
                            from_job=False):
    #try:
    print rec_email

    response = search_helper.matchResumes(subscription.keywords,
                                          subscription.experience,
                                          subscription.location,
                                          subscription.max_salary,
                                          subscription.results_last_sent_on)
    if string.atoi(response.numFound) >= subscription.min_count:
        sendMailToRecruiter(response.results, subscription, rec_email, rec_key)
        logSentUsers(response.results, rec_email, subscription.id)
    if not from_job: connection.commit()
Ejemplo n.º 8
0
def handle(request):
    rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
    if not rec: return redirect

    email_list = dataplus.dictGetSafeVal(request.REQUEST, 'email_list', '')
    email_query = dataplus.dictGetSafeVal(request.REQUEST, 'email_query', '')
    if email_query:
        search_keywords, experience, location, max_salary = cPickle.loads(
            base64.b64decode(email_query))
        response = search_helper.matchResumes(search_keywords, experience,
                                              location, max_salary,
                                              datetime.datetime(1981, 1, 9))
        email_list = dataplus.decode(
            string.join([usr['email'] for usr in response.results], '; '))

    action = dataplus.dictGetSafeVal(request.REQUEST, 'action', '')
    if action == 'show_form':
        return codejar.actions.render(request, 'recruiters/emailusers.htm', {
            'to_list': email_list,
            'recruiter': rec
        })

    elif action == 'email_users':
        subject = dataplus.dictGetSafeVal(request.REQUEST, 'subject', '')
        message = dataplus.dictGetSafeVal(request.REQUEST, 'message', '')

        message += '<p>&nbsp;</p><div style="border-bottom: 1px solid rgb(153, 153, 153);"></div><p>This email has been sent by %s(%s) of %s using <a href="http://www.jobhunt.in">www.jobhunt.in</a> services.</p>' % (
            rec.name, rec.email, rec.organization)
        mailman.sendMail(rec.name + '<*****@*****.**>',
                         email_list.split(';'),
                         subject,
                         message,
                         reply_to=rec.email)

        eventnotifier.sendEventNotification("New Recruiter Mass Mail: " +
                                            subject + " - " + rec.name + "(" +
                                            rec.email + ")" + " message:\n" +
                                            message)

        return HttpResponseRedirect('dashboard.htm?flashId=email_sent')