Exemplo n.º 1
0
def handle(request):
    user = codejar.auth.getLoggedInUser(request)
    if not user:    return codejar.ajaxian.getFailureResp('not_logged_in')

    section = dataplus.dictGetSafeVal(request.REQUEST, 'section', '')

    if section == 'jobInterest':
        user.is_job_hunting  = dataplus.dictGetSafeVal(request.REQUEST, 'is_job_hunting', '')

    elif section == 'personalPref':
        user.curr_designation = dataplus.dictGetSafeVal(request.REQUEST, 'curr_designation', '')
        user.curr_employer = dataplus.dictGetSafeVal(request.REQUEST, 'curr_employer', '')
        user.experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi)
        user.tags = dataplus.dictGetSafeVal(request.REQUEST, 'tags', '')

    elif section == 'jobPref':
        user.min_salary = dataplus.dictGetVal(request.REQUEST, 'min_salary', 0, string.atoi)
        user.pref_designation = dataplus.dictGetSafeVal(request.REQUEST, 'pref_designation', '')
        user.pref_employment = dataplus.dictGetSafeVal(request.REQUEST, 'pref_employment', '')
        user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'pref_location', '')

    elif section == 'summary':
        user.summary = dataplus.dictGetSafeVal(request.REQUEST, 'summary', '')
        user.settings_edited = True

    if user.name and user.email and user.tags and user.pref_location:    user.tagged = True

    user.save()

    return codejar.ajaxian.getSuccessResp(getUpdateHtml(user))
Exemplo n.º 2
0
def handle(request):
    user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
    from_email = dataplus.dictGetVal(request.REQUEST, 'source', False,
                                     lambda x: x == 'email')
    user = dataplus.returnIfExists(models.User.objects.filter(key=user_key))
    if not user:
        return codejar.actions.render(
            request, 'info.htm', {
                'info_header':
                'Resume not found',
                'info_text':
                'This resume does not exist,<br /> or may have been deleted.'
            })

    if request.method == 'GET':
        return codejar.actions.render(request, 'resumeactive.htm', {
            'user_key': user_key,
            'from_email': from_email
        })
    elif request.method == 'POST':
        user.min_salary = dataplus.dictGetVal(request.REQUEST, 'minSalary', 0,
                                              string.atoi)
        user.pref_employer = dataplus.dictGetSafeVal(request.REQUEST,
                                                     'preferredEmployer', '')
        user.pref_location = dataplus.dictGetSafeVal(request.REQUEST,
                                                     'preferredLocations', '')
        user.save()
        return HttpResponseRedirect('done.html')
Exemplo n.º 3
0
 def fillFormData(subs):
     subs.recruiter = rec
     subs.keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords')
     subs.experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi)
     subs.location = dataplus.dictGetSafeVal(request.REQUEST, 'location')
     subs.max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi)
     subs.job_title = dataplus.dictGetSafeVal(request.REQUEST, 'job_title')
     subs.job_company = dataplus.dictGetSafeVal(request.REQUEST, 'job_company')
     subs.job_description = dataplus.dictGetSafeVal(request.REQUEST, 'job_desc')
Exemplo n.º 4
0
def handle(request):
    if request.method == 'GET':
        rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
        if not rec: return redirect

        #Propaganda special
        is_prop_login = dataplus.dictGetVal(request.session, 'prop_login',
                                            False)
        if is_prop_login:
            account_state = dataplus.dictGetVal(request.session,
                                                'account_state', 'I')
            if account_state == 'I':
                if rec.account.account_state == 'I':
                    rec.account.account_state = 'A'
                    rec.account.save()
                    eventnotifier.sendEventNotification(
                        'Recruiter PropActivated: ' + rec.email)

            elif account_state == 'A':
                return HttpResponseRedirect('propactivation.htm')

        recent_searches = models.RecruiterData.getRecentSearches(rec)
        recent_searches_formatted = []
        for dict in recent_searches:
            dict['keywords'] = dict['keywords'].replace(', ', ',').replace(
                ',', ', ')
            json_dict = u"{'keywords':'%s', 'experience':'%d', 'location':'%s', 'max_salary':'%d'}" % (
                dict['keywords'], dict['experience'], dict['location'],
                dict['max_salary'])
            display_str = dict['keywords']
            if dict['experience'] > 0:
                display_str += u" with %d years" % (dict['experience'])
            if not dict['location'].lower() == 'any':
                display_str += u" in " + dict['location']
            recent_searches_formatted.append((display_str, json_dict))

        return codejar.actions.render(
            request, 'recruiters/dashboard.htm', {
                'experience_html':
                experienceHTML(),
                'salary_html':
                salaryHTML(),
                'location_html':
                locationHTML(),
                'recent_searches':
                recent_searches_formatted,
                'recent_subscriptions': [
                    str(subscr)
                    for subscr in rec.subscriptions.order_by('-added_on')[:2]
                ],
                'email_verified':
                rec.account.email_verified
            })

    elif request.method == 'POST':
        ##      shouldn't be happening :)
        pass
Exemplo n.º 5
0
def handle(request):
    rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
    if not rec:     return redirect

    subscription_id = dataplus.dictGetSafeVal(request.REQUEST, 'subscriptionId')

    if request.method == 'GET':
        subscription = dataplus.returnIfExists(rec.subscriptions.filter(id=subscription_id))
        if (subscription):
            return codejar.actions.render(request, 'recruiters/subscribe.htm',
                {'subscription': subscription,
                 'experience_html':experienceHTML(subscription.experience),
                 'salary_html': salaryHTML(subscription.max_salary),
                 'location_html': locationHTML(subscription.location),
                 'subscriptionId': subscription_id})
        else:
            keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '')
            experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi)
            location = dataplus.dictGetSafeVal(request.REQUEST, 'location', '')
            max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi)
            return codejar.actions.render(request, 'recruiters/subscribe.htm',
                {'keywords':keywords,
                 'experience_html':experienceHTML(experience),
                 'salary_html': salaryHTML(max_salary),
                 'location_html': locationHTML(location)})

    elif request.method == 'POST':
        #Save the filter.
        def fillFormData(subs):
            subs.recruiter = rec
            subs.keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords')
            subs.experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi)
            subs.location = dataplus.dictGetSafeVal(request.REQUEST, 'location')
            subs.max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi)
            subs.job_title = dataplus.dictGetSafeVal(request.REQUEST, 'job_title')
            subs.job_company = dataplus.dictGetSafeVal(request.REQUEST, 'job_company')
            subs.job_description = dataplus.dictGetSafeVal(request.REQUEST, 'job_desc')

        if subscription_id:
            subscription = models.RecruiterSubscription.objects.get(id=subscription_id)
        else: #means new subscription
            subscription = models.RecruiterSubscription()
            subscription.min_count = 5
            subscription.industry = ''
            subscription.results_last_sent_on = datetime.datetime(1981, 1, 9) #Jes' bday - default min datetime

        fillFormData(subscription)
        subscription.save()

        return HttpResponseRedirect('/recruiters/dashboard.htm')
Exemplo n.º 6
0
def handle(request):
    user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
    from_email = dataplus.dictGetVal(request.REQUEST, 'source', False, lambda x: x == 'email')
    user = dataplus.returnIfExists(models.User.objects.filter(key=user_key))
    if not user:
        return codejar.actions.render(request, 'info.htm', {'info_header':'Resume not found',
                                                            'info_text':'This resume does not exist,<br /> or may have been deleted.'})
    
    if request.method == 'GET':
        return codejar.actions.render(request, 'resumeactive.htm', {'user_key':user_key,'from_email':from_email})
    elif request.method == 'POST':
        user.min_salary = dataplus.dictGetVal(request.REQUEST, 'minSalary', 0, string.atoi)
        user.pref_employer = dataplus.dictGetSafeVal(request.REQUEST, 'preferredEmployer', '')
        user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'preferredLocations', '')
        user.save()
        return HttpResponseRedirect('done.html')
Exemplo n.º 7
0
def logout(request):
    account_type = dataplus.dictGetVal(request.session, 'account_type', '')
    if account_type:
        request.session['username'] = None
        request.session['account_type'] = None
        
    return HttpResponseRedirect('/?flashId=logged_out')
Exemplo n.º 8
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')
Exemplo n.º 9
0
def handle(request):
    user, redirect = codejar.actions.handleSecurity(request, 'user')
    if not user: return redirect

    src = dataplus.dictGetVal(request.REQUEST, 'src', '')
    if request.method == 'GET':
        return codejar.actions.render(request, 'uploadresume.htm',
                                      {'src': src})

    elif request.method == 'POST':
        if not (request.FILES):
            return HttpResponseRedirect(
                'uploadresume.htm?flashId=upload_file_not_found&src=' + src)

        filename, doc_filepath, error_id = codejar.user.saveUploadedResume(
            request, 'resume_doc')
        if not error_id:
            user.doc_filename = filename
            user.doc_filepath = doc_filepath
            user.resume_updated_on = datetime.datetime.utcnow()
            user.save()
            redirect_url = ('/dashboard.htm',
                            '/editprofile.htm')[src == 'editprofile']
            return HttpResponseRedirect(redirect_url +
                                        '?flashId=resume_uploaded')
        else:
            return HttpResponseRedirect('uploadresume.htm?flashId=' +
                                        error_id + '&src=' + src)
Exemplo n.º 10
0
def logout(request):
    account_type = dataplus.dictGetVal(request.session, 'account_type', '')
    if account_type:
        request.session['username'] = None
        request.session['account_type'] = None

    return HttpResponseRedirect('/?flashId=logged_out')
Exemplo n.º 11
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')
                              })
Exemplo n.º 12
0
def handle(request, account_type='user'):
    account, redirect = codejar.actions.handleSecurity(request, 'account')
    token_value = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')

    url_prefix = ''
    if account_type == 'recruiters':
        url_prefix = 'recruiters/'

    if request.method == 'GET':
        return codejar.actions.render(
            request, url_prefix + 'changepassword.htm', {
                'key': token_value,
                'is_loggedin': ('true', '')[account is None]
            })

    elif request.method == 'POST':
        password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '')
        password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '')
        errors = []
        if len(password) < 6:
            errors.append('Passwords should have minimum 6 characters.')
        elif not password == password2:
            errors.append('Passwords do not match.')

        if errors:
            flash_alerts = errors
            return codejar.actions.render(request,
                                          url_prefix + 'changepassword.htm',
                                          {'flash_alerts': flash_alerts})

        if not account:
            acct_id = string.atoi(models.Token.getOwner(token_value))
            account = dataplus.returnIfExists(
                models.Account.objects.filter(id=acct_id))

            if not account:
                return HttpResponseRedirect('/?flashId=malformed_url')

        account.setPassword(password)

        #Propaganda special
        if dataplus.dictGetVal(request.session, 'prop_login', False):
            request.session['prop_login'] = None
            prop_token = dataplus.returnIfExists(
                models.Token.objects.filter(owner=account.username,
                                            type='RecPropaganda'))
            if prop_token: prop_token.delete()

        if token_value:
            models.Token.remove(token_value)
            response = codejar.auth.login(
                request, account.username, password,
                'dashboard.htm?flashId=password_changed')
            return codejar.actions.addCookieToResponse(response, 'last_login',
                                                       account.username)
        else:
            return HttpResponseRedirect(
                'dashboard.htm?flashId=password_changed')
Exemplo n.º 13
0
def handle(request):
    try:
        rec = codejar.auth.getLoggedInRecruiter(request)
        if rec:
            id = dataplus.dictGetVal(request.REQUEST, 'filterId', 0, string.atoi)
            filter = models.RecruiterSubscription.objects.filter(recruiter=rec, id=id)
            if filter:  filter.delete()
            return codejar.ajaxian.getSuccessResp('')
        else:
            return codejar.ajaxian.getFailureResp('not_logged_in')
    except:
        return codejar.ajaxian.getFailureResp()
Exemplo n.º 14
0
def handle(request):
    if request.method == 'GET':
        rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
        if not rec:    return redirect
        
        #Propaganda special
        is_prop_login = dataplus.dictGetVal(request.session, 'prop_login', False)
        if is_prop_login:
            account_state = dataplus.dictGetVal(request.session, 'account_state', 'I')
            if account_state == 'I':
                if rec.account.account_state == 'I':
                    rec.account.account_state = 'A'
                    rec.account.save()
                    eventnotifier.sendEventNotification('Recruiter PropActivated: ' + rec.email)

            elif account_state == 'A':
                return HttpResponseRedirect('propactivation.htm')
        

        recent_searches = models.RecruiterData.getRecentSearches(rec)
        recent_searches_formatted = []
        for dict in recent_searches:
            dict['keywords'] = dict['keywords'].replace(', ', ',').replace(',', ', ')
            json_dict = u"{'keywords':'%s', 'experience':'%d', 'location':'%s', 'max_salary':'%d'}" % (dict['keywords'], dict['experience'], dict['location'], dict['max_salary'])
            display_str = dict['keywords']
            if dict['experience'] > 0:  display_str += u" with %d years" % (dict['experience'])
            if not dict['location'].lower() == 'any':   display_str += u" in " + dict['location']
            recent_searches_formatted.append((display_str, json_dict))

        return codejar.actions.render(request, 'recruiters/dashboard.htm',
                {'experience_html':experienceHTML(),
                 'salary_html': salaryHTML(),
                 'location_html': locationHTML(),
                 'recent_searches': recent_searches_formatted,
                 'recent_subscriptions': [str(subscr) for subscr in rec.subscriptions.order_by('-added_on')[:2]],
                 'email_verified': rec.account.email_verified })

    elif request.method == 'POST':
##      shouldn't be happening :)
        pass
Exemplo n.º 15
0
def handle(request, account_type="user"):
    account, redirect = codejar.actions.handleSecurity(request, "account")
    token_value = dataplus.dictGetSafeVal(request.REQUEST, "key", "")

    url_prefix = ""
    if account_type == "recruiters":
        url_prefix = "recruiters/"

    if request.method == "GET":
        return codejar.actions.render(
            request,
            url_prefix + "changepassword.htm",
            {"key": token_value, "is_loggedin": ("true", "")[account is None]},
        )

    elif request.method == "POST":
        password = dataplus.dictGetSafeVal(request.REQUEST, "password", "")
        password2 = dataplus.dictGetSafeVal(request.REQUEST, "password2", "")
        errors = []
        if len(password) < 6:
            errors.append("Passwords should have minimum 6 characters.")
        elif not password == password2:
            errors.append("Passwords do not match.")

        if errors:
            flash_alerts = errors
            return codejar.actions.render(request, url_prefix + "changepassword.htm", {"flash_alerts": flash_alerts})

        if not account:
            acct_id = string.atoi(models.Token.getOwner(token_value))
            account = dataplus.returnIfExists(models.Account.objects.filter(id=acct_id))

            if not account:
                return HttpResponseRedirect("/?flashId=malformed_url")

        account.setPassword(password)

        # Propaganda special
        if dataplus.dictGetVal(request.session, "prop_login", False):
            request.session["prop_login"] = None
            prop_token = dataplus.returnIfExists(
                models.Token.objects.filter(owner=account.username, type="RecPropaganda")
            )
            if prop_token:
                prop_token.delete()

        if token_value:
            models.Token.remove(token_value)
            response = codejar.auth.login(request, account.username, password, "dashboard.htm?flashId=password_changed")
            return codejar.actions.addCookieToResponse(response, "last_login", account.username)
        else:
            return HttpResponseRedirect("dashboard.htm?flashId=password_changed")
Exemplo n.º 16
0
def handle(request):
    user = codejar.auth.getLoggedInUser(request)
    if not user: return codejar.ajaxian.getFailureResp('not_logged_in')

    section = dataplus.dictGetSafeVal(request.REQUEST, 'section', '')

    if section == 'jobInterest':
        user.is_job_hunting = dataplus.dictGetSafeVal(request.REQUEST,
                                                      'is_job_hunting', '')

    elif section == 'personalPref':
        user.curr_designation = dataplus.dictGetSafeVal(
            request.REQUEST, 'curr_designation', '')
        user.curr_employer = dataplus.dictGetSafeVal(request.REQUEST,
                                                     'curr_employer', '')
        user.experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0,
                                              string.atoi)
        user.tags = dataplus.dictGetSafeVal(request.REQUEST, 'tags', '')

    elif section == 'jobPref':
        user.min_salary = dataplus.dictGetVal(request.REQUEST, 'min_salary', 0,
                                              string.atoi)
        user.pref_designation = dataplus.dictGetSafeVal(
            request.REQUEST, 'pref_designation', '')
        user.pref_employment = dataplus.dictGetSafeVal(request.REQUEST,
                                                       'pref_employment', '')
        user.pref_location = dataplus.dictGetSafeVal(request.REQUEST,
                                                     'pref_location', '')

    elif section == 'summary':
        user.summary = dataplus.dictGetSafeVal(request.REQUEST, 'summary', '')
        user.settings_edited = True

    if user.name and user.email and user.tags and user.pref_location:
        user.tagged = True

    user.save()

    return codejar.ajaxian.getSuccessResp(getUpdateHtml(user))
Exemplo n.º 17
0
def handle(request, account_type='user'):
    rec = None
    if account_type == 'user':
        user, redirect = codejar.actions.handleSecurity(request, 'user')
        if not user: return redirect
    elif account_type == 'recruiter':
        rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
        if not rec: return redirect
        user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
        user = dataplus.returnIfExists(
            models.User.objects.filter(key=user_key))
        if not user:
            return codejar.actions.render(
                request, 'error.htm', {
                    'error_message':
                    'You have entered an invalid Url. Please check and try again.'
                })

    if request.method == 'GET':
        pref_summary = ''
        #12 Lakhs, Large Companies only, in Bangalore.
        if user.pref_designation and user.min_salary and user.pref_location and user.pref_employment:
            pref_summary = '%s in %s' % (user.pref_designation,
                                         html_options.getVerboseEmploymentType(
                                             user.pref_employment))
            if not user.pref_location == 'Anywhere':
                pref_summary += ', in ' + user.pref_location

        user.job_preferences = pref_summary
        if user.summary:
            user.summary_display = '<ul>\n' + reduce(
                lambda x, y: x + '<li>' + y + '</li>\n',
                user.summary.split('\n'), '') + '</ul>\n'

        user.min_salary_in_lakhs = user.min_salary / 100000

        if rec:
            sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0,
                                         string.atoi)
            notifications.addNotification(str(user.id),
                                          'ProfViewed',
                                          data={
                                              'recruiter_id': rec.id,
                                              'subscription_id': sub_id
                                          })
        return codejar.actions.render(request, 'viewsummary.htm', {
            'user': user,
            'rec': rec
        })
    elif request.method == 'POST':
        pass
Exemplo n.º 18
0
def handle(request):
    try:
        rec = codejar.auth.getLoggedInRecruiter(request)
        if rec:
            id = dataplus.dictGetVal(request.REQUEST, 'filterId', 0,
                                     string.atoi)
            filter = models.RecruiterSubscription.objects.filter(recruiter=rec,
                                                                 id=id)
            if filter: filter.delete()
            return codejar.ajaxian.getSuccessResp('')
        else:
            return codejar.ajaxian.getFailureResp('not_logged_in')
    except:
        return codejar.ajaxian.getFailureResp()
Exemplo n.º 19
0
def handle(request, format, user_key):
    rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
    if not rec:
        rec_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
        if rec_key: rec = dataplus.returnIfExists(models.Recruiter.object.filter(key=rec_key))        
    if not rec: return redirect
    
    user = get_object_or_404(models.User, key=user_key)    
    if not format in ('doc', 'html'): 
		format = 'doc'
    
    sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0)
    notifications.addNotification(str(user.id), 'ProfViewed', data={'recruiter_id': rec.id, 'subscription_id':sub_id})
    
    return codejar.user.downloadResume(user, format)
Exemplo n.º 20
0
def getLoggedInAccount(request):
    username = dataplus.dictGetVal(request.session, 'username', '')
    if username:
        return dataplus.returnIfExists(models.Account.objects.filter(username=username))
        
    ##Propaganda Special - if request has a valid 'rec_token' in querysting, we can login them.
    token_str = dataplus.dictGetSafeVal(request.REQUEST, 'rec_token', '')
    if token_str:
        rec_username = models.Token.getOwner(token_str)
        if rec_username:
            account = dataplus.returnIfExists(models.Account.objects.filter(username=rec_username, account_type='FR'))
            if account:
                request.session['username'] = account.username
                request.session['account_type'] = account.account_type
                request.session['account_state'] = account.account_state
                request.session['prop_login'] = True
                return account
Exemplo n.º 21
0
def handle(request, account_type="user"):
    rec = None
    if account_type == "user":
        user, redirect = codejar.actions.handleSecurity(request, "user")
        if not user:
            return redirect
    elif account_type == "recruiter":
        rec, redirect = codejar.actions.handleSecurity(request, "recruiter")
        if not rec:
            return redirect
        user_key = dataplus.dictGetSafeVal(request.REQUEST, "key", "")
        user = dataplus.returnIfExists(models.User.objects.filter(key=user_key))
        if not user:
            return codejar.actions.render(
                request, "error.htm", {"error_message": "You have entered an invalid Url. Please check and try again."}
            )

    if request.method == "GET":
        pref_summary = ""
        # 12 Lakhs, Large Companies only, in Bangalore.
        if user.pref_designation and user.min_salary and user.pref_location and user.pref_employment:
            pref_summary = "%s in %s" % (
                user.pref_designation,
                html_options.getVerboseEmploymentType(user.pref_employment),
            )
            if not user.pref_location == "Anywhere":
                pref_summary += ", in " + user.pref_location

        user.job_preferences = pref_summary
        if user.summary:
            user.summary_display = (
                "<ul>\n" + reduce(lambda x, y: x + "<li>" + y + "</li>\n", user.summary.split("\n"), "") + "</ul>\n"
            )

        user.min_salary_in_lakhs = user.min_salary / 100000

        if rec:
            sub_id = dataplus.dictGetVal(request.REQUEST, "sub_id", 0, string.atoi)
            notifications.addNotification(
                str(user.id), "ProfViewed", data={"recruiter_id": rec.id, "subscription_id": sub_id}
            )
        return codejar.actions.render(request, "viewsummary.htm", {"user": user, "rec": rec})
    elif request.method == "POST":
        pass
Exemplo n.º 22
0
def handle(request, user_key):

	if request.method == 'GET':
		rec, redirect = codejar.actions.handleSecurity(request, 'recruiter')
		if not rec:
			rec_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '')
			if rec_key: rec = dataplus.returnIfExists(models.Recruiter.object.filter(key=rec_key))
			if not rec: return redirect

		user = get_object_or_404(models.User, key=user_key)

		sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0)
		notifications.addNotification(str(user.id), 'ProfViewed', data={'recruiter_id': rec.id, 'subscription_id':sub_id})

		return codejar.user.downloadResume(user, 'doc')

	else:
		#this shouldnt be happening
		return HttpResponseRedirect('/')
Exemplo n.º 23
0
def getLoggedInAccount(request):
    username = dataplus.dictGetVal(request.session, 'username', '')
    if username:
        return dataplus.returnIfExists(
            models.Account.objects.filter(username=username))

    ##Propaganda Special - if request has a valid 'rec_token' in querysting, we can login them.
    token_str = dataplus.dictGetSafeVal(request.REQUEST, 'rec_token', '')
    if token_str:
        rec_username = models.Token.getOwner(token_str)
        if rec_username:
            account = dataplus.returnIfExists(
                models.Account.objects.filter(username=rec_username,
                                              account_type='FR'))
            if account:
                request.session['username'] = account.username
                request.session['account_type'] = account.account_type
                request.session['account_state'] = account.account_state
                request.session['prop_login'] = True
                return account
Exemplo n.º 24
0
def handle(request):    
    user, redirect = codejar.actions.handleSecurity(request, 'user')
    if not user:    return redirect
    
    src = dataplus.dictGetVal(request.REQUEST, 'src', '')
    if request.method == 'GET':
        return codejar.actions.render(request, 'uploadresume.htm', {'src':src})
    
    elif request.method == 'POST':
        if not (request.FILES):
            return HttpResponseRedirect('uploadresume.htm?flashId=upload_file_not_found&src=' + src)
         
        filename, doc_filepath, error_id = codejar.user.saveUploadedResume(request, 'resume_doc')
        if not error_id:
            user.doc_filename = filename
            user.doc_filepath = doc_filepath
            user.resume_updated_on = datetime.datetime.utcnow()
            user.save()
            redirect_url = ('/dashboard.htm','/editprofile.htm')[src == 'editprofile']
            return HttpResponseRedirect(redirect_url + '?flashId=resume_uploaded')
        else:
            return HttpResponseRedirect('uploadresume.htm?flashId=' + error_id + '&src=' + src)
Exemplo n.º 25
0
def handle(request):
    user, redirect = codejar.actions.handleSecurity(request, 'user')
    if not user:	return redirect
    
    if request.method == 'GET':
        #YYYYMMDD
        report_date = dataplus.dictGetVal(request.REQUEST, 'date', None, lambda x: datetime.datetime.strptime(x, '%Y%m%d'))
        if not report_date:
            return HttpResponseRedirect('/?flashId=malformed_url')
        
        notification = dataplus.returnIfExists(models.Notification.objects.filter(key=str(user.id), type='UserReport', activity_time__year=report_date.year,
                                                                             activity_time__month = report_date.month,
                                                                             activity_time__day = report_date.day))
        if not notification:
            return HttpResponseRedirect('/?flashId=malformed_url')
        
        context = cPickle.loads(str(notification.text))
        return codejar.actions.render(request, 'resumesentreport.htm',
                                      {'recruiter_infos':context['recruiter_infos'],
                                       'num_of_sends': context['num_of_sends'],
                                       'date': report_date})
    elif request.method == 'POST':
        pass