def getResumeQuestions(user): resume_questions = user.received_resume_questions.filter(is_public=True) for res_ques in resume_questions: res_ques.sender.url = siteaction.getDetailsUrl(res_ques.sender) res_ques.answer = dataplus.replaceHtmlLineBreaks(res_ques.answer) res_ques.sent_at_verbose = dataplus.getVerboseDate(res_ques.sent_at) return resume_questions
def handle(request): try: logged_in_type = siteaction.getLoggedInAccountType(request) rcvr_usrname = dataplus.dictGetVal(request.REQUEST,'sendTo') if logged_in_type == 'U': myself = siteaction.getLoggedInUser(request) elif logged_in_type == 'R': myself = siteaction.getLoggedInRecruiter(request) else: return ajaxian.getFailureResp('not_logged_in') rcvr_account = models.Account.objects.get(username=dataplus.dictGetVal(request.REQUEST,'sendTo')) text_message = dataplus.dictGetSafeVal(request.REQUEST,'text') html_message = dataplus.replaceHtmlLineBreaks(text_message) subject = dataplus.dictGetSafeVal(request.REQUEST,'subject') def internalSender(rcvr_accounts): mailman.sendMessage(myself.username, [rcvr.username for rcvr in rcvr_accounts], subject, html_message) def externalSender(rcvr_accounts): sender = '"' + myself.name + '" <' + myself.username + '*****@*****.**>' receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>' for rcvr in rcvr_accounts] mailman.sendMail(sender, receivers, subject, html_message, None, None, text_message, reply_to=myself.email) mailman.sendBySettings([rcvr_account], internalSender, externalSender, 'TextMessage') return ajaxian.getSuccessResp('') except: return ajaxian.getFailureResp('unknown')
def sendCommunityInvitationToUser(community, user, sender, message, add_as_friend=False): comm_invite = models.CommunityInvitation(sent_by=sender, community=community) comm_invite.invite_random_key = dataplus.getUniqueId() comm_invite.save() sender_email = '"' + sender.name + '" <' + sender.username + "*****@*****.**>" subject = sender.name + " has invited you to join " + community.name accept_url = ( config.server_base_url + "/me/acceptinvite.htm?commInviteId=" + str(comm_invite.invite_random_key) + "&user="******"' + config.server_base_url + "/profiles/" + sender.username + '">' + sender.name + "</a>" + " feels that you will be interested in joining the " + community.name + " Community and has sent you the following message:</p>" + "<p>" + dataplus.replaceHtmlLineBreaks(message) + "</p>" + '<p>To accept this invitation, visit <a href="' + accept_url + '">' + accept_url + "</a> " + "<p>Regards,<br />from Socialray</p>" ) text_message = ( sender.name + " feels that you will be interested in joining the " + community.name + " Community and has sent you the following message:\r\n" + message + "\r\n\r\n" + "To accept this invitation, visit - " + accept_url + " \r\n" + "Regards,\r\n" + "from Socialray\r\n\r\n" ) def internalSender(rcvr_accounts): mailman.sendToInbox(sender.username, user.username, subject, html_message) def externalSender(rcvr_accounts): mailman.sendMail( sender_email, [user.email], subject, html_message, None, None, text_message, reply_to=user.email ) mailman.sendBySettings([user.account], internalSender, externalSender, "CommunityInvitation")
def getTestimonials(user): testimonials = user.testimonials_for_me.all() for testimonial in testimonials: email = testimonial.writer_email testimonial.writer_email_hidden = email[0] + '...' + email[email.index('@'):] testimonial.text = dataplus.replaceHtmlLineBreaks(testimonial.text) testimonial.written_on_verbose = dataplus.getVerboseDate(testimonial.written_on) return testimonials
def handle(request, username): username = username.lower() #if there is no logged in user, handle the request here. #otherwise, just pass it on to the handler in 'users' or 'recruiters' user_type = siteaction.getLoggedInAccountType(request) if user_type == 'U': return me_viewprofile.handle(request, username) ## if user_type == 'R': ## return recruiters_viewprofile.handle(request, username) else: #this is an anoynymous request, we have to handle user = get_object_or_404(models.User, username=username) settings = models.UserSettings.objects.get(user=user) if settings.resume_visibility != 'everyone': return siteaction.render_to_response('showmessage.htm', {'msg_heading':'Private Profile', 'msg_html':'The user\'s privacy settings do not allow you to view this page. Please <a href="/login.htm">login</a>.'}) online_status = chat.getOnlineStatus(request, [user.username]) online_status_html = '<img class="img_online_status" ' if online_status[user.username] == 'online': online_status_html += 'alt="online" title="Online Now" src="' + config.static_server_base_url + '/site/images/common/livestatus-online-white-bg.gif" /> Online Now' elif online_status[user.username] == 'away': online_status_html += 'alt="away" title="Away" src="' + config.static_server_base_url + '/site/images/common/livestatus-away-white-bg.gif" /> Away' else: online_status_html += 'alt="offline" title="Offline" src="' + config.static_server_base_url + '/site/images/common/livestatus-offline-white-bg.gif" /> Offline' dial_now_number = '' skype_username = '' yahoo_username = '' if settings.enable_voip_dial: dial_now_number = user.phone for msnger in models.WebMessenger.objects.filter(account=user.account): if msnger.provider == 'skype': skype_username = msnger.username elif msnger.provider == 'yahoo': yahoo_username = msnger.username masked = False if settings.phone_num_visibility != 'everyone': masked = True return siteaction.render_to_response('profiles/show.htm', { 'user': user, 'online_status_html':online_status_html, 'dial_now_number':dial_now_number, 'skype_username':skype_username, 'yahoo_username':yahoo_username, 'personal_desc' : dataplus.replaceHtmlLineBreaks(user.personal_desc), 'resume_contents' : codejar_resume.getResumeText(user, masked), 'resume_style_sheet' : codejar_resume.getResumeStyleSheet(user), 'user_image': dataplus.getStaticUrl(user.image_size3_file_path), 'user_original_image': dataplus.getStaticUrl(user.image_file_path), 'testimonials': me_viewprofile.getTestimonials(user), 'resume_questions': me_viewprofile.getResumeQuestions(user), 'interest_in_new_job':settings.interest_in_new_job, })
def handle(request, comm_id, topic_id): myself = siteaction.getLoggedInUser(request) if not myself: return HttpResponseRedirect('/login.htm') community = models.Community.objects.select_related().get(id=comm_id) if community.is_moderated: if (community.members.filter(id=myself.id).count() == 0): return siteaction.render_to_response('showmessage.htm', { 'msg_heading':'Error', 'msg_html':'Access denied.'}) page_num = dataplus.dictGetVal(request.REQUEST, 'page', 1, string.atoi) topic = models.CommunityTopic.objects.select_related().get(id=topic_id) paginator = Paginator(topic.posts.all().order_by('-posted_on'), config.posts_per_page) page = paginator.page(page_num) if paginator.count == 0: showing_howmany = '0 of 0 posts' else: showing_howmany = str(page.start_index()) + '-' + str(page.end_index()) + ' of ' + str(paginator.count) for post in page.object_list: post.text = dataplus.replaceHtmlLineBreaks(post.text) post.posted_by.image_url = dataplus.getStaticUrl(post.posted_by.image_size1_file_path) post.posted_by.profile_url = config.profiles_url + '/' + post.posted_by.username post.posted_on_relative = dataplus.getRelativeDateTime(post.posted_on) prev_btn = '' next_btn = '' if page_num != 1: prev_btn = '<td><input class="medium-btn" type="button" name="prev-btn" value="Prev" onclick="javascript:window.location.href=\'?page=' + str(page_num-1) + '\';" /></td>' if page.has_next(): next_btn = '<td><input class="medium-btn" type="button" name="next-btn" value="Next" onclick="javascript:window.location.href=\'?page=' + str(page_num+1) + '\';" /></td>' buttons = prev_btn + next_btn community.image_url = dataplus.getStaticUrl(community.image_size2_file_path) return siteaction.render_to_response('communities/posts.htm', { 'myself': myself, 'community': community, 'topic': topic, 'posts': page.object_list, 'community_snapshot': getCommunitySnapshotHtml(community), 'showing_howmany': showing_howmany, 'buttons': buttons, })
def handle(request, comm_id): community = models.Community.objects.get(id=comm_id) community.image_url = dataplus.getStaticUrl(community.image_size3_file_path) myself = siteaction.getLoggedInUser(request) if not myself: return HttpResponseRedirect("/login.htm") if community.members.filter(id=myself.id).count() == 0: return siteaction.render_to_response( "me/showmessage.htm", {"myself": myself, "msg_heading": "Error", "msg_html": "Access denied"} ) action = dataplus.dictGetVal(request.REQUEST, "action") if request.method == "GET": action_result = "" if dataplus.dictGetVal(request.REQUEST, "flashId"): action_result = dataplus.dictGetVal( statix.action_messages, dataplus.dictGetVal(request.REQUEST, "flashId"), "" ) return siteaction.render_to_response( "communities/invite.htm", { "community": community, "friend_count": myself.friends.count(), "friends_html": getFriendsTable(myself, community), "invite_more": (action == "invite_more"), "action_result": action_result, "myself": myself, }, ) elif request.method == "POST": if action == "external_invite": message = dataplus.dictGetSafeVal(request.REQUEST, "msgToMembers", "") add_to_friend_list = dataplus.dictGetVal(request.REQUEST, "add_to_friend_list", False, lambda x: True) has_valid_emails = False for i in range(1, 6): email = dataplus.dictGetVal(request.REQUEST, "email" + str(i), "").strip() success, error = codejar_validation.validateEmail(email) if success: has_valid_emails = True invitation = models.FriendInvitation(sent_by=myself, sent_to_email=email) invitation.invite_random_key = dataplus.getUniqueId() invitation.save() comm_invite = models.CommunityInvitation(sent_by=myself, community=community) comm_invite.invite_random_key = invitation.invite_random_key comm_invite.save() sender = '"' + myself.name + '" <' + myself.username + "*****@*****.**>" subject = myself.name + " has invited you to join " + community.name + " - Socialray" if add_to_friend_list: accept_url = ( config.server_base_url + "/me/acceptinvite.htm?commFriendInviteId=" + str(invitation.invite_random_key) ) else: accept_url = ( config.server_base_url + "/me/acceptinvite.htm?commInviteId=" + str(invitation.invite_random_key) ) html_message = ( '<p><a href="' + config.server_base_url + "/profiles/" + myself.username + '">' + myself.name + "</a>" + " feels that you will be interested in joining the " + community.name + " Community in Socialray and has sent you the following message:</p>" + "<p>" + dataplus.replaceHtmlLineBreaks(message) + "</p>" + '<p>To accept this invitation and create an account, visit <a href="' + accept_url + '">' + accept_url + "</a> " + "<br />Once you create your account, " + myself.name + " will be connected to you as a friend.</p>" + "<p>Regards,<br />from Socialray</p>" ) text_message = ( myself.name + " feels that you will be interested in joining the " + community.name + " Community in Socialray and has sent you the following message:\r\n" + message + "\r\n\r\n" + "To accept this invitation and create an account, visit - " + accept_url + " \r\n" + "Once you create your account, " + myself.name + " will be connected to you as a friend.\r\n" + "You can check " + myself.name + "'s profile at " + config.server_base_url + "/profiles/" + myself.username + "\r\n\r\n" + "Regards,\r\n" + "from Socialray\r\n\r\n" ) mailman.sendMail( sender, [email], subject, html_message, None, None, text_message, reply_to=myself.email ) if not has_valid_emails: return siteaction.render_to_response( "communities/invite.htm", { "community": community, "friend_count": myself.friends.count(), "friends_html": getFriendsTable(myself, community), "myself": myself, }, ) elif action == "internal_invite": message = dataplus.dictGetSafeVal(request.REQUEST, "msgToFriends", "") friend_count = dataplus.dictGetVal(request.REQUEST, "friendCount", 0, string.atoi) has_selected_users = False for i in range(1, friend_count + 1): chk_id = dataplus.dictGetVal(request.REQUEST, "checkbox" + str(i)) if chk_id: user = models.User.objects.get(id=chk_id) has_selected_users = True sendCommunityInvitationToUser(community, user, myself, message) if not has_selected_users: return siteaction.render_to_response( "communities/invite.htm", { "community": community, "friend_count": myself.friends.count(), "friends_html": getFriendsTable(myself, community), "myself": myself, }, ) if community.is_moderated: flash_id = "mod_comm_invites_sent" else: flash_id = "comm_invites_sent" return HttpResponseRedirect( "/communities/" + str(community.id) + "/invite.htm?flashId=" + flash_id + "&action=invite_more" )
def handle(request, username): action_result = '' if dataplus.dictGetVal(request.REQUEST, 'flashId'): action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '') myself = siteaction.getLoggedInUser(request) if not myself: return HttpResponseRedirect('/login.htm') user = get_object_or_404(models.User, username=username) settings = models.UserSettings.objects.get(user=user) online_status_html = '' if (user.username == myself.username): is_myself = True else: is_myself = False visible = True add_btn_visible = False if settings.resume_visibility == 'friends' and (user.friends.filter(id=myself.id).count() == 0): visible = False err_msg = 'This user only allows friends to view the complete profile.' add_btn_visible = True elif settings.resume_visibility == 'nobody': visible = False err_msg = 'The privacy settings of this user does not allow you to see the complete profile.' if not is_myself: if user.visits.filter(visitor_username=myself.username, visited_on__gte=(datetime.datetime.utcnow() - datetime.timedelta(days=1))).count() == 0: user.visits.add(models.ProfileVisit(visitor_username=myself.username, visitor_name=myself.name, visitor_type=myself.account.account_type)) online_status = chat.getOnlineStatus(request, [user.username]) online_status_html = '' #disable chat. #online_status_html = '<a href="javascript:openChatWindow(\'' + user.username + '\');" ><img class="img_online_status" id="online_status_' + user.username + '" ' #if online_status[user.username] == 'online': # online_status_html += 'alt="online" title="Click to chat now" src="' + config.static_server_base_url + '/site/images/common/livestatus-online-white-bg.gif" /> Chat Now</a>' #elif online_status[user.username] == 'away': # online_status_html += 'alt="away" title="Away" src="' + config.static_server_base_url + '/site/images/common/livestatus-away-white-bg.gif" /> Away</a>' #else: # online_status_html += 'alt="offline" title="Offline" src="' + config.static_server_base_url + '/site/images/common/livestatus-offline-white-bg.gif" /> Offline</a>' if not visible: return siteaction.render_to_response('me/privateprofile.htm', {'user': user, 'user_image': dataplus.getStaticUrl(user.image_size3_file_path), 'user_original_image': dataplus.getStaticUrl(user.image_file_path), 'small_desc': user.small_desc, 'bread_crumb_html': getBreadCrumb(user, myself), 'err_msg': err_msg, 'add_btn_visible': add_btn_visible, 'online_status_html':online_status_html, 'interest_in_new_job':settings.interest_in_new_job, 'myself': myself}) formatting_issue_resolving_url = getFormatResolvingUrl(myself, settings) dial_now_number = '' skype_username = '' yahoo_username = '' if settings.enable_voip_dial: dial_now_number = user.phone for msnger in models.WebMessenger.objects.filter(account=user.account): if msnger.provider == 'skype': skype_username = msnger.username elif msnger.provider == 'yahoo': yahoo_username = msnger.username mask_required = False if not is_myself: if settings.phone_num_visibility == 'nobody': mask_required = True if settings.phone_num_visibility == 'friends': if user.friends.filter(id=myself.id).count() == 0: mask_required = True return siteaction.render_to_response('me/viewprofile.htm', { 'user': user, 'personal_desc' : dataplus.replaceHtmlLineBreaks(user.personal_desc), 'dial_now_number':dial_now_number, 'skype_username':skype_username, 'yahoo_username':yahoo_username, 'resume_contents' : codejar_resume.getResumeText(user, mask_required), 'resume_style_sheet' : codejar_resume.getResumeStyleSheet(user), 'user_image': dataplus.getStaticUrl(user.image_size3_file_path), 'user_original_image': dataplus.getStaticUrl(user.image_file_path), 'testimonials': getTestimonials(user), 'resume_questions': getResumeQuestions(user), 'users_friends': getFriends(user), 'users_communities': getCommunities(user), 'videos_html':getVideosHtml(user), 'bread_crumb_html': getBreadCrumb(user, myself), 'formatting_issue_resolving_url':formatting_issue_resolving_url, 'myself': myself, 'is_friend': (myself.friends.filter(id=user.id).count() > 0), 'online_status_html':online_status_html, 'action_result':action_result, 'interest_in_new_job':settings.interest_in_new_job, 'is_myself': is_myself })
def handle(request): try: myself = siteaction.getLoggedInUser(request) if not myself: return ajaxian.getFailureResp('not_logged_in') comm_id = dataplus.dictGetVal(request.REQUEST, 'communityId') community = models.Community.objects.get(id=comm_id) if community.members.filter(id=myself.id): return ajaxian.getFailureResp('already_member') elif not community.is_moderated: myself.communities.add(community) myself.save() return ajaxian.getSuccessResp('joined_community') else: join_reqs = community.join_requests.filter(sent_by__id=myself.id) if join_reqs.count() > 0: return ajaxian.getFailureResp('request_pending') if dataplus.dictGetVal(request.REQUEST, 'message', '') == '': return ajaxian.getFailureResp('community_moderated') message_to_admin = dataplus.dictGetSafeVal(request.REQUEST, 'message','') join_req = models.CommunityJoinRequest() join_req.sent_by = myself join_req.community = community join_req.sent_on = datetime.datetime.utcnow() join_req.msg_to_admin = message_to_admin join_req.save() msg_to_admin_html = '<p><a href="' + config.server_base_url + '/profiles/' + myself.username + '">' + myself.name + '</a>' + \ ' wants to join ' + community.name + ' and has sent you a message:<br />' + \ dataplus.replaceHtmlLineBreaks(message_to_admin) + '</p>' + \ '<p>To allow/deny membership to this user , <a href="/me/approvecommjoinreq.htm?reqId=' + \ str(join_req.id) + '">Click Here</a></p>' msg_to_admin_text = myself.name + ' wants to join ' + community.name + ' and has sent you a message:\r\n' + \ message_to_admin + '\r\n\r\nVisit ' + config.server_base_url + '/me/approvecommjoinreq.htm?reqId=' + str(join_req.id) + \ ' to allow/deny membership to this user.\r\n\r\n' def internalSender(rcvr_accounts): mailman.sendToInbox(myself.username, rcvr_accounts[0].username, 'Request to join ' + community.name, msg_to_admin_html, 'TM', 'H') def externalSender(rcvr_accounts): sender = '"' + myself.name + '" <' + myself.username + '*****@*****.**>' receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>' for rcvr in rcvr_accounts] ext_msg_to_admin_html = msg_to_admin_html + \ '<br /><br /><br /><br /><br />' + \ 'If you don\'t want to receive notification emails, change your Account Settings ' + \ '<a href="' + config.server_base_url + '/me/editsettings.htm">here</a>' ext_msg_to_admin_text = msg_to_admin_text + \ '\r\n\r\n\r\n\r\n\r\n' + \ 'If you don\'t want to receive notification emails, change your Account Settings here\r\n' + \ config.server_base_url + '/me/editsettings.htm' mailman.sendMail(sender, receivers, 'Request to join ' + community.name, ext_msg_to_admin_html, None, None, ext_msg_to_admin_text, reply_to=myself.email) admin_account = models.Account.objects.get(username=community.owner_username) mailman.sendBySettings([admin_account], internalSender, externalSender, 'SocialrayAlert') return ajaxian.getSuccessResp('request_sent') except: return ajaxian.getFailureResp('unknown')
def handle(request): myself = siteaction.getLoggedInUser(request) if not myself: return HttpResponseRedirect('/login.htm') rcvr = rcvr_comm = None rcvr_id = dataplus.dictGetVal(request.REQUEST, 'rcvrId', 0, string.atoi) rcvr_type = dataplus.dictGetVal(request.REQUEST,'rcvrType') if rcvr_type == 'u': rcvr = dataplus.returnIfExists(models.User.objects.filter(id=rcvr_id)) if not rcvr: return siteaction.render_to_response('me/showmessage.htm', {'myself':myself, 'msg_heading':'Error', 'msg_html':'Invalid Request'}) receivers = [rcvr] elif rcvr_type == 'c': rcvr_comm = dataplus.returnIfExists(models.Community.objects.filter(id=rcvr_id)) if not rcvr_comm: return siteaction.render_to_response('me/showmessage.htm', {'myself':myself, 'msg_heading':'Error', 'msg_html':'Invalid Request'}) if request.method == 'GET': if rcvr: receiver_html = '<a href="' + config.profiles_url + '/' + rcvr.username + '" >' + rcvr.name + '</a>' elif rcvr_comm: receiver_html = 'Members of <a href="' + config.communities_url + '/' + str(rcvr_comm.id) + '" >' + rcvr_comm.name + '</a>' experience_select_html = hotmetal.elemSelect([('Select', '-1')], range(0,30), lambda x:x, lambda x:x, '', 'name="experience" id="experience" style="width:80px"') industry_categories_select_html = hotmetal.elemSelect([('Select', '-1')], models.IndustryCategory.objects.all().order_by('name'), lambda x:x.name, lambda x:x.name, '', 'name="industry_category" id="industry_category" style="width:180px"') old_referrals = myself.posted_referrals.order_by('-created_at')[:20] old_referrals_select_html = hotmetal.elemSelect([('Select', '0')], old_referrals, lambda x:x.subject + ' (' + dataplus.getStrDate(x.created_at) + ')', lambda x:x.id, '', 'name="old_referral" id="old_referral" style="width:280px;" onchange="resetReferral();"') return siteaction.render_to_response('me/sendjobreferral.htm', {'myself': myself, 'rcvrId':rcvr_id, 'rcvrType':rcvr_type, 'receiver_html':receiver_html, 'has_old_referrals': (old_referrals.count() > 0), 'old_referrals_select_html':old_referrals_select_html, 'experience_select_html':experience_select_html, 'sending_to_user': (rcvr_type == 'u'), 'industry_categories_select_html':industry_categories_select_html,}) elif request.method == 'POST': job_ref_id = dataplus.dictGetVal(request.REQUEST, 'referral_id', 0, string.atoi) if job_ref_id > 0: job_ref = models.JobReferral.objects.get(id=job_ref_id) else: job_ref = models.JobReferral() job_ref.sender = myself if rcvr: receivers = [rcvr] job_ref.industry_category = rcvr.industry_category if rcvr.working_since: job_ref.min_experience_years = (datetime.datetime.utcnow() - rcvr.working_since).days/365 else: receivers = [x for x in rcvr_comm.members.all() if x.username != myself.username] job_ref.industry_category = models.IndustryCategory.objects.get(name=dataplus.dictGetVal(request.REQUEST, 'industry_category')) job_ref.min_experience_years = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi) job_ref.subject = dataplus.dictGetSafeVal(request.REQUEST, 'subject') job_ref.reply_to_email = dataplus.dictGetSafeVal(request.REQUEST, 'reply_to') job_ref.text = dataplus.dictGetSafeVal(request.REQUEST, 'text') job_ref.save() for receiver in receivers: job_ref.receivers.add(receiver) html_message = dataplus.replaceHtmlLineBreaks(job_ref.text) + '<p><a href="' + config.server_base_url + '/me/viewreferral.htm?id=' + str(job_ref.id) + '">Forward your resume</a></p>' text_message = job_ref.text + '\r\n Visit ' + config.server_base_url + '/me/viewreferral.htm?id=' + str(job_ref.id) + ' to forward your resume.\r\n\r\n' subject = 'Job Referral: ' + job_ref.subject def internalSender(rcvr_accounts): mailman.sendMessage(myself.username, [rcvr.username for rcvr in rcvr_accounts], subject, html_message) def externalSender(rcvr_accounts): sender = '"' + myself.name + '" <' + myself.username + '*****@*****.**>' receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>' for rcvr in rcvr_accounts] ext_html_message = html_message + \ '<br /><br /><br /><br /><br />' + \ 'If you don\'t want to receive notification emails, change your Account Settings ' + \ '<a href="' + config.server_base_url + '/me/editsettings.htm">here</a>' ext_text_message = text_message + \ '\r\n\r\n\r\n\r\n\r\n' + \ 'If you don\'t want to receive notification emails, change your Account Settings here\r\n' + \ config.server_base_url + '/me/editsettings.htm' mailman.sendMail(sender, receivers, subject, ext_html_message, None, None, ext_text_message, reply_to=myself.email) mailman.sendBySettings([rcvr.account for rcvr in receivers], internalSender, externalSender, 'JobReferral') return HttpResponseRedirect('/me/?flashId=jobref_sent')
def getTopicBoxHtml(topic, can_post): topic_div_id = "topic_" + str(topic.id) # full enclosure lastpost_div_id = "lastpost_" + str(topic.id) # this shows the last post; ON by default xp_div_id = "xp_posts_" + str(topic.id) # flips last post with last 5, OFF by default post_box_id = "post_box_" + str(topic.id) # reply to the post right there last_posts = topic.posts.order_by("-posted_on")[:5] html = "" # topic box starts hear hear! html += '<div id="' + topic_div_id + '" class="community-topic-item">\r\n' # header.... html += ( '<div><span><strong><a href="/communities/' + str(topic.community.id) + "/topics/" + str(topic.id) + '">' + topic.title + "</a></strong> (" + str(topic.posts.count()) + " posts)</span>\r\n" ) html += ( ' <span class="dimmed-text">started by <a href="' + config.profiles_url + "/" + topic.started_by.username + '">' + topic.started_by.name + "</a></span></div>\r\n" ) if topic.posts.count() > 0: last_post = last_posts[0] # last post div - can be empty html += '<div id="' + lastpost_div_id + '">' html += ( '<span class="small-text">Last Post ' + dataplus.getRelativeDateTime(last_post.posted_on) + "</span><br />" ) html += dataplus.getPreviewText(last_post.text) html += ( '<div class="small-text"><span class="linkless" onclick="fx_flipElem(\'' + lastpost_div_id + "', '" + xp_div_id + "');\">Expand</span></div>\r\n" ) html += "</div>" html += '<div id="' + xp_div_id + '" style="display:none;">\r\n' for post in last_posts: posted_by_url = config.profiles_url + "/" + post.posted_by.account.username html += ( '<div class="community-post" style="padding:5px;border:solid;border-width: 1px;border-color:#dddddd;">\r\n' + '<table style="width:100%">\r\n' + "<tr>\r\n" + '<td style="width:60px;text-align:center;vertical-align:top;">\r\n' + '<a href="' + posted_by_url + '"><img src="' + dataplus.getStaticUrl(post.posted_by.image_size1_file_path) + '" alt="' + post.posted_by.name + '" /></a>\r\n' + "</td>\r\n" + '<td style="vertical-align:top;">\r\n' + '<div><a href="' + config.profiles_url + "/" + post.posted_by.username + '">\r\n' + post.posted_by.name + "</a> " + dataplus.getRelativeDateTime(post.posted_on) + "\r\n" + "</div>\r\n" + '<div class="community-post-text">' + dataplus.replaceHtmlLineBreaks(post.text) + "</div>\r\n" + "</td>\r\n" + "</tr>\r\n" + "</table>\r\n" + "</div>\r\n" ) html += "<table><tr>\r\n" if can_post: html += ( '<td><input class="small-btn" type="button" name="reply-btn" value="Reply" onclick="showTopicReplyBox(\'' + post_box_id + "', '" + str(topic.id) + "', true, function(topicId, html){ reloadTopic(topicId, html); });\" /></td>" ) html += ( '<td><input class="small-btn" type="button" name="hide-btn" value="Hide" onclick="fx_flipElem(\'' + xp_div_id + "', '" + lastpost_div_id + "');\" /></td>" ) html += "</tr></table>\r\n" html += '<div id="' + post_box_id + '"></div>\r\n' html += "</div></div>" else: if can_post: html += ( '<div><span class="linkless" onclick="showTopicReplyBox(\'' + post_box_id + "', '" + str(topic.id) + "', true, function(topicId, html){ reloadTopic(topicId, html); });\" />Reply</span></div>\r\n" ) html += '<div id="' + post_box_id + '"></div></div>\r\n' return html