예제 #1
0
    def post(self):
        name, href = self._argument()
        current_user_id = self.current_user_id
        txt = self.get_argument('word', None)
        if href:
            if name:
                name = ''.join([name, '[[', href, ']]'])
                if txt:
                    txt = name + txt
                else:
                    txt = name
            else:
                txt = '[[' + href + ']]' + txt
        elif name:
            txt = name + ' ' + txt

        if txt:
            host = self.request.host
            zsite = zsite_by_domain(host)
            if zsite and zsite.cid == CID_SITE:
                zsite_id = zsite.id
            else:
                zsite_id = 0

            m = po_word_new(current_user_id, txt, zsite_id=zsite_id)

        self.render(success=True)
예제 #2
0
    def post(self):
        result = None
        current_user_id = self.current_user_id
        txt = self.get_argument('txt', None)
        if txt:
            host = self.request.host
            zsite = zsite_by_domain(host)
            if zsite and zsite.cid == CID_SITE:
                zsite_id = zsite.id
            else:
                zsite_id = 0

            m = po_word_new(current_user_id, txt, zsite_id=zsite_id)
            if not zsite_id and m:
                c_dict = career_dict(set([current_user_id]))
                unit, title = c_dict[current_user_id]
                result = [
                    [
                        1, zsite.name, zsite.link, unit,
                        title, pic_url_with_default(current_user_id, '219'),
                        [[m.id, [], 0, 61, 0, 0, 0, time.time(), None, txt_withlink(txt), False]]
                    ],
                    []
                ]
        self.finish(dumps(result))
예제 #3
0
    def get(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            zsite_id = zsite.id
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_new(zsite, current_user_id)
            elif cid == CID_USER:
                follow_new(current_user_id, zsite_id)
                mq_buzz_follow_new(current_user_id, zsite_id)

            txt = self.get_argument('txt', None)
            if txt:
                if cid == CID_SITE:
                    from model.reply import STATE_ACTIVE
                    zsite.reply_new(current_user, txt, STATE_ACTIVE)
                elif cid == CID_COM:
                    from model.po_review import po_review_new
                    po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')
예제 #4
0
    def post(self):
        name, href = self._argument()
        current_user_id = self.current_user_id
        txt = self.get_argument('word', None)
        if href:
            if name:
                name = ''.join([name, '[[', href, ']]'])
                if txt:
                    txt = name+txt
                else:
                    txt = name
            else:
                txt = '[['+href+']]'+txt
        elif name:
            txt = name+' '+txt

        if txt:
            host = self.request.host
            zsite = zsite_by_domain(host)
            if zsite and zsite.cid == CID_SITE:
                zsite_id = zsite.id
            else:
                zsite_id = 0

            m = po_word_new(current_user_id, txt, zsite_id=zsite_id)

        self.render(success=True)
예제 #5
0
    def post(self):
        result = None
        current_user_id = self.current_user_id
        txt = self.get_argument('txt', None)
        if txt:
            host = self.request.host
            zsite = zsite_by_domain(host)
            if zsite and zsite.cid == CID_SITE:
                zsite_id = zsite.id
            else:
                zsite_id = 0

            m = po_word_new(current_user_id, txt, zsite_id=zsite_id)
            if not zsite_id and m:
                c_dict = career_dict(set([current_user_id]))
                unit, title = c_dict[current_user_id]
                result = [[
                    1, zsite.name, zsite.link, unit, title,
                    pic_url_with_default(current_user_id, '219'),
                    [[
                        m.id, [], 0, 61, 0, 0, 0,
                        time.time(), None,
                        txt_withlink(txt), False
                    ]]
                ], []]
        self.finish(dumps(result))
예제 #6
0
    def get(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            zsite_id = zsite.id
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_new(zsite, current_user_id)
            elif cid == CID_USER:
                follow_new(current_user_id, zsite_id)
                mq_buzz_follow_new(current_user_id, zsite_id)

            txt = self.get_argument("txt", None)
            if txt:
                if cid == CID_SITE:
                    from model.reply import STATE_ACTIVE

                    zsite.reply_new(current_user, txt, STATE_ACTIVE)
                elif cid == CID_COM:
                    from model.po_review import po_review_new

                    po_review_new(zsite_id, current_user_id, name)

        self.finish("{}")
예제 #7
0
    def post(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)

        if zsite and zsite.cid in (CID_SITE, CID_COM):
            zsite_fav_rm(zsite, current_user_id)

        self.finish('{}')
예제 #8
0
    def post(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)

        if zsite and zsite.cid in (CID_SITE, CID_COM):
            zsite_fav_rm(zsite, current_user_id)

        self.finish('{}')
예제 #9
0
    def prepare(self):
        super(JLoginBase, self).prepare()

        request = self.request
        host = request.host
        zsite = zsite_by_domain(host)
        if zsite is None:
            self.zsite_id = 0
        else:
            self.zsite_id = zsite.id
        self.zsite = zsite

        zsite = self.zsite
예제 #10
0
    def prepare(self):
        super(AdminBase, self).prepare()

        request = self.request
        host = request.host
        zsite = zsite_by_domain(host)
        if zsite is None:
            self.zsite_id = 0
        else:
            self.zsite_id = zsite.id
        self.zsite = zsite

        zsite = self.zsite
        if not zsite.cid == CID_COM or not zsite_member_can_admin(self.zsite_id, self.current_user_id):
            self.finish("{}")
예제 #11
0
    def prepare(self):
        super(AdminBase, self).prepare()

        request = self.request
        host = request.host
        zsite = zsite_by_domain(host)
        if zsite is None:
            self.zsite_id = 0
        else:
            self.zsite_id = zsite.id
        self.zsite = zsite

        zsite = self.zsite
        if not zsite.cid == CID_COM or not zsite_member_can_admin(
                self.zsite_id, self.current_user_id):
            self.finish('{}')
예제 #12
0
    def post(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_rm(zsite, current_user_id)
            elif cid == CID_USER:
                follow_rm(current_user_id, zsite.id)
        self.finish("{}")
예제 #13
0
    def post(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_rm(zsite, current_user_id)
            elif cid == CID_USER:
                follow_rm(current_user_id, zsite.id)
        self.finish('{}')
예제 #14
0
    def prepare(self):
        request = self.request
        host = request.host

        _host = url_by_digit_domain(host)
        if _host:
            path = '//%s%s'%(_host, request.path)
            if request.query:
                path = '%s?%s'%(path, request.query)
            return self.redirect(path, True)

        zsite = zsite_by_domain(host)
        if zsite is None:
            self.zsite_id = 0
        else:
            self.zsite_id = zsite.id
        self.zsite = zsite
        super(Base, self).prepare()
예제 #15
0
    def prepare(self):
        request = self.request
        host = request.host

        _host = url_by_digit_domain(host)
        if _host:
            path = '//%s%s' % (_host, request.path)
            if request.query:
                path = '%s?%s' % (path, request.query)
            return self.redirect(path, True)

        zsite = zsite_by_domain(host)
        if zsite is None:
            self.zsite_id = 0
        else:
            self.zsite_id = zsite.id
        self.zsite = zsite
        super(Base, self).prepare()
예제 #16
0
    def get(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)
        zsite_id = zsite.id
        cid = zsite.cid

        if zsite and cid in (CID_SITE, CID_COM):
            zsite_fav_new(zsite, current_user_id)

        txt = self.get_argument('txt', None)
        if txt:
            if cid == CID_SITE:
                from model.reply import STATE_ACTIVE
                zsite.reply_new(current_user, txt, STATE_ACTIVE)
            elif cid == CID_COM:
                from model.po_review import po_review_new
                po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')
예제 #17
0
    def get(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)
        zsite_id = zsite.id
        cid = zsite.cid

        if zsite and cid in (CID_SITE, CID_COM):
            zsite_fav_new(zsite, current_user_id)


        txt = self.get_argument('txt', None)
        if txt:
            if cid == CID_SITE:
                from model.reply import STATE_ACTIVE
                zsite.reply_new(current_user, txt, STATE_ACTIVE)
            elif cid == CID_COM:
                from model.po_review import po_review_new
                po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')