def _zsite_review_invite(zsite, member, current_user):
    zsite_id = zsite.id
    member_id = member.id

    http = http_by_member(member)

    #TODO !
    mail = mail_by_user_id(member_id)
    #    mail = "*****@*****.**"

    name = [current_user.name]
    name.extend(career_current(current_user.id))
    name = ' , '.join(filter(bool, name))

    mq_rendermail('/mail/com/invite_review.htm',
                  mail,
                  member.name,
                  sender_name=current_user.name,
                  format='html',
                  subject='%s 邀请您给 %s 写推荐语' % (name, zsite.name),
                  from_user_name=name,
                  from_user_link=current_user.link,
                  com_link=zsite.link,
                  com_name=zsite.name,
                  http=http)
Beispiel #2
0
def _zsite_review_invite(zsite, member, current_user):
    zsite_id = zsite.id
    member_id = member.id

    http = http_by_member(member)

    #TODO !
    mail = mail_by_user_id(member_id)
#    mail = "*****@*****.**"

    name = [current_user.name]
    name.extend( career_current(current_user.id) )
    name = ' , '.join(filter(bool, name))

    mq_rendermail(
        '/mail/com/invite_review.htm',
        mail,
        member.name,
        sender_name=current_user.name,
        format='html',
        subject='%s 邀请您给 %s 写推荐语' % (
            name,
            zsite.name
        ),
        from_user_name=name,
        from_user_link=current_user.link,
        com_link=zsite.link,
        com_name=zsite.name,
        http=http
    )
Beispiel #3
0
    def get(self, id):
        #        data = {
        #            "zsite":{
        #                "name":"w",
        #                "unit":"xx",
        #                "title":"zz"
        #            },
        #            "name":"2011年第2次BPUG活动",
        #            "id":1234,
        #            "fav":True,
        #            "reply_count":1,
        #            "tag_id":232,
        #            "tag_name":"sss"
        #        }
        po = Po.mc_get(id)
        user = po.user
        result = [id]
        result.extend(feed_tuple_by_db(id))
        result.pop()
        result.pop()
        result.append(po.htm)

        zsite = [user.name, user.link]
        zsite.extend(career_current(po.user_id))

        result.append(zsite)
        self.finish(dumps(result))
Beispiel #4
0
    def get(self, id):
#        data = {
#            "zsite":{
#                "name":"w",
#                "unit":"xx",
#                "title":"zz"
#            },
#            "name":"2011年第2次BPUG活动",
#            "id":1234,
#            "fav":True,
#            "reply_count":1,
#            "tag_id":232,
#            "tag_name":"sss"
#        }
        po = Po.mc_get(id)
        user = po.user
        result = [id]
        result.extend(feed_tuple_by_db(id))
        result.pop()
        result.pop()
        result.append(po.htm)

        zsite = [user.name, user.link]
        zsite.extend(career_current(po.user_id))

        result.append(zsite)
        self.finish(dumps(result))
Beispiel #5
0
    def get(self, id):
        current_user_id = self.current_user_id
        result = None
        if not id.isdigit():
            id = id_by_url(id)
        if id:
            id = int(id)
        if not id or current_user_id == id:
            return self.finish('null')

        zsite = Zsite.mc_get(id)
        if zsite:
            career = career_current(id)
            career = filter(bool, career)
            current_user_id = self.current_user_id
            if current_user_id != id:
                if follow_get(current_user_id, id):
                    word = '淡忘'
                else:
                    word = '关注'
                result = [
                    zsite.name, ' , '.join(career),
                    ico_url_with_default(id), zsite.link, zsite.id, word,
                    motto_get(zsite.id)
                ]
        return self.finish(dumps(result))
Beispiel #6
0
def reply_notice_mail(po_id, li):
    po = Po.mc_get(po_id)
    if not (po and po.zsite_id != po.user_id):
        return

    li = Zsite.mc_get_list(li)

    if not li:
        return

    pos, state = po_pos_get(po.user_id, po_id)
    #print pos
    if pos != -1:
        return

    zsite = Zsite.mc_get(po.user_id)

    if zsite and zsite.cid == CID_USER:

        mail = mail_by_user_id(po.user_id)

        if mail:

            li0 = li[0]

            name_list = [li0.name]
            name_list.extend(career_current(li0.id))
            name_title = ' , '.join(filter(bool, name_list))

            if len(li) > 1:
                subject = '%s人 回复 %s ( %s 等 )' % (len(li), po.name, name_title)
            else:
                subject = '%s 回复 %s' % (name_title, po.name)

            rendermail('/mail/notice/notice_reply.htm',
                       mail,
                       zsite.name,
                       format='html',
                       subject=subject,
                       reply_list=li,
                       po=po,
                       zsite=zsite)

            mail = '*****@*****.**'

            rendermail('/mail/notice/notice_reply.htm',
                       mail,
                       zsite.name,
                       format='html',
                       subject=subject,
                       reply_list=li,
                       po=po,
                       zsite=zsite)
Beispiel #7
0
def zsite_rank_by_zsite(zsite):
    from model.zsite_show import zsite_show_get
    rank = 0
    id = zsite.id
    if zsite.state > ZSITE_STATE_CAN_REPLY:
        rank += 3
        if zsite_show_get(id):
            rank += 1
    else:
        if career_current(id):
            rank += 1
        if ico.get(id):
            rank += 1
    return rank
Beispiel #8
0
def zsite_rank_by_zsite(zsite):
    from model.zsite_show import zsite_show_get
    rank = 0
    id = zsite.id
    if zsite.state > ZSITE_STATE_CAN_REPLY:
        rank += 3
        if zsite_show_get(id):
            rank += 1
    else:
        if career_current(id):
            rank += 1
        if ico.get(id):
            rank += 1
    return rank
def reply_notice_mail(po_id, li):
    po = Po.mc_get(po_id)
    if not (po and po.zsite_id != po.user_id):
        return

    li = Zsite.mc_get_list(li)

    if not li:
        return

    pos, state = po_pos_get(po.user_id, po_id)
    #print pos
    if pos != -1:
        return

    zsite = Zsite.mc_get(po.user_id)

    if zsite and zsite.cid == CID_USER:

        mail = mail_by_user_id(po.user_id)

        if mail:

            li0 = li[0]

            name_list = [li0.name]
            name_list.extend(career_current(li0.id))
            name_title = ' , '.join(filter(bool, name_list))

            if len(li) > 1:
                subject = '%s人 回复 %s ( %s 等 )'%(
                    len(li) , po.name , name_title
                )
            else:
                subject = '%s 回复 %s'%(name_title, po.name)


            rendermail( '/mail/notice/notice_reply.htm', mail, zsite.name, format='html', subject=subject, reply_list=li, po=po, zsite=zsite)

            mail = '*****@*****.**'

            rendermail( '/mail/notice/notice_reply.htm', mail, zsite.name, format='html', subject=subject, reply_list=li, po=po, zsite=zsite)
def man_show_api(man_id):
    man = Zsite.mc_get(man_id)
    if man:
        comp, title = career_current(man_id)
        txt = txt_get(man_id)
        link = man.link
        li = [
            ('id', man_id),
            ('name', man.name),
            ('uid', url_by_id(man_id)),
            ('company', comp),
            ('title', title),
            ('signature', motto_get(man_id)),
            ('about_me', txt),
            ('ico', pic_url(man_id, 219)),
            ('link', name_link_by_zsite_id(man_id, 'http:')),
            ('appearance_fee', 42),
        ]
        return dict(filter(lambda x:bool(x[1]), li))
    return {}
Beispiel #11
0
def man_show_api(man_id):
    man = Zsite.mc_get(man_id)
    if man:
        comp, title = career_current(man_id)
        txt = txt_get(man_id)
        link = man.link
        li = [
            ('id', man_id),
            ('name', man.name),
            ('uid', url_by_id(man_id)),
            ('company', comp),
            ('title', title),
            ('signature', motto_get(man_id)),
            ('about_me', txt),
            ('ico', pic_url(man_id, 219)),
            ('link', name_link_by_zsite_id(man_id, 'http:')),
            ('appearance_fee', 42),
        ]
        return dict(filter(lambda x: bool(x[1]), li))
    return {}
Beispiel #12
0
def zsite_verify_ajust(zsite):
    if zsite.cid != CID_USER:
        return

    need = 0
    id = zsite.id
    name = zsite.name
    if name.isdigit() or not name:
        need |= ZSITE_VERIFY_NEED_NAME

    if not ico.get(id):
        need |= ZSITE_VERIFY_NEED_ICO

    if not any(career_current(id)):
        need |= ZSITE_VERIFY_NEED_CAREER

    if need:
        zsite_verify_rm(zsite)
        return need
    else:
        zsite_verify_new(zsite)
Beispiel #13
0
def zsite_verify_ajust(zsite):
    if zsite.cid != CID_USER:
        return

    need = 0
    id = zsite.id
    name = zsite.name
    if name.isdigit() or not name:
        need |= ZSITE_VERIFY_NEED_NAME 

    if not ico.get(id):
        need |= ZSITE_VERIFY_NEED_ICO 
    
    if not any(career_current(id)):
        need |= ZSITE_VERIFY_NEED_CAREER
 
    if need:
        zsite_verify_rm(zsite)
        return need
    else: 
        zsite_verify_new(zsite)
Beispiel #14
0
    def get(self, id):
        current_user_id = self.current_user_id
        result = None
        if not id.isdigit():
            id = id_by_url(id)
        if id:
            id = int(id)
        if not id or current_user_id == id:
            return self.finish('null')

        zsite = Zsite.mc_get(id)
        if zsite:
            career = career_current(id)
            career = filter(bool, career)
            current_user_id = self.current_user_id
            if current_user_id != id:
                if follow_get(current_user_id, id):
                    word = '淡忘'
                else:
                    word = '关注'
                result = [zsite.name, ' , '.join(career), ico_url_with_default(id), zsite.link, zsite.id, word, motto_get(zsite.id)]
        return self.finish(dumps(result))
Beispiel #15
0
    def get(self):
        self.set_header('Content-Type', 'text/xml; charset=utf-8')

        items = []
        zsite = self.zsite
        id = zsite.id
        rss_title = '%s %s' % (zsite.name, host(id))
        rss_link = 'http:%s/rss' % zsite.link
        pubdate = time()
        rss_desc = motto_get(id)

        limit = 25
        offset = 0
        if zsite.cid == CID_SITE:
            site_po_list = feed_po_list_by_zsite_id(self.current_user_id, id, CID_NOTE, limit, offset)[0]
            po_id_list = []
            for i in site_po_list:
                po_id_list.append(i[1])
            po_list = Po.mc_get_list(po_id_list)
        else:
            po_list = po_view_list(id, CID_NOTE, False, limit, offset)

        for po in po_list:
            d = {}
            author = Zsite.get(po.user_id)
            po_title = po.name
            po_link = 'http:%s/%s' % (zsite.link, po.id)
            tag = tag_by_po_id(id, po.id)[2]
            title = [po_title]
            if tag:
                title.append('#%s#'%tag)
            d['title'] = ' '.join(title)
            d['author'] = author.name
            d['link'] = po_link
            htm = po.htm

            htm = htm.replace('class="PICR"', 'style="float:right;margin-left:14px"')\
                     .replace('class="PICL"', 'style="float:left;margin-right:14px"')\
                     .replace('class="PIC"', 'style="margin:14px auto"')

            desc = [
            """<font face="Verdana,sans-serif" size="3">
<pre style="font-family:Verdana;font-size:14px;white-space:pre-wrap;word-wrap:break-word;line-height:27px;">%s</pre>
""" % htm
            ]
            unit, title = career_current(id)
            desc.append(
                """ <div style="padding:27px 0;text-align:left;font-size:14px;float:left"><a target="_blank" href="%s">"""%author.link
            )

            ico = ico_url(id)
            if ico:
                desc.append(
                    """<img style="float:left;margin-right:28px" src="%s">"""%ico
                )

            desc.append("""<div style="line-height:32px;float:left"><div>%s</div><div style="color:#000">"""%escape(author.name))

            if unit:
                desc.append("""<div>%s</div>"""%escape(unit))

            if title:
                desc.append("""<div>%s</div>"""%escape(title))

            desc.append("""</div></div></a></div>""")
            desc.append('</font>')
            d['desc'] = ''.join(desc)
            d['pubdate'] = format_rfc822_data(po.create_time)
            items.append(d)

        self.render(
            rss_title=rss_title,
            rss_link=rss_link,
            rss_desc=rss_desc,
            pubdate=format_rfc822_data(pubdate),
            items=items,
        )
Beispiel #16
0
    def get(self):
        self.set_header('Content-Type', 'text/xml; charset=utf-8')

        items = []
        zsite = self.zsite
        id = zsite.id
        rss_title = '%s %s' % (zsite.name, host(id))
        rss_link = 'http:%s/rss' % zsite.link
        pubdate = time()
        rss_desc = motto_get(id)

        limit = 25
        offset = 0
        if zsite.cid == CID_SITE:
            site_po_list = feed_po_list_by_zsite_id(self.current_user_id, id,
                                                    CID_NOTE, limit, offset)[0]
            po_id_list = []
            for i in site_po_list:
                po_id_list.append(i[1])
            po_list = Po.mc_get_list(po_id_list)
        else:
            po_list = po_view_list(id, CID_NOTE, False, limit, offset)

        for po in po_list:
            d = {}
            author = Zsite.get(po.user_id)
            po_title = po.name
            po_link = 'http:%s/%s' % (zsite.link, po.id)
            tag = tag_by_po_id(id, po.id)[2]
            title = [po_title]
            if tag:
                title.append('#%s#' % tag)
            d['title'] = ' '.join(title)
            d['author'] = author.name
            d['link'] = po_link
            htm = po.htm

            htm = htm.replace('class="PICR"', 'style="float:right;margin-left:14px"')\
                     .replace('class="PICL"', 'style="float:left;margin-right:14px"')\
                     .replace('class="PIC"', 'style="margin:14px auto"')

            desc = [
                """<font face="Verdana,sans-serif" size="3">
<pre style="font-family:Verdana;font-size:14px;white-space:pre-wrap;word-wrap:break-word;line-height:27px;">%s</pre>
""" % htm
            ]
            unit, title = career_current(id)
            desc.append(
                """ <div style="padding:27px 0;text-align:left;font-size:14px;float:left"><a target="_blank" href="%s">"""
                % author.link)

            ico = ico_url(id)
            if ico:
                desc.append(
                    """<img style="float:left;margin-right:28px" src="%s">""" %
                    ico)

            desc.append(
                """<div style="line-height:32px;float:left"><div>%s</div><div style="color:#000">"""
                % escape(author.name))

            if unit:
                desc.append("""<div>%s</div>""" % escape(unit))

            if title:
                desc.append("""<div>%s</div>""" % escape(title))

            desc.append("""</div></div></a></div>""")
            desc.append('</font>')
            d['desc'] = ''.join(desc)
            d['pubdate'] = format_rfc822_data(po.create_time)
            items.append(d)

        self.render(
            rss_title=rss_title,
            rss_link=rss_link,
            rss_desc=rss_desc,
            pubdate=format_rfc822_data(pubdate),
            items=items,
        )