Exemplo n.º 1
0
    def update(self):
        super(UserTags, self).update()

        prefs = IPersonalFriendConnect(self.request.principal)
        self.oid = getUtility(IIntIds).queryId(removeAllProxies(self.context))
        if self.oid:
            self.tags = prefs.getTags(self.oid)
Exemplo n.º 2
0
    def handleSave(self, action):
        data, errors = self.extractData()

        tags = [t.strip() for t in data['tags'].split(',')]

        prefs = IPersonalFriendConnect(self.request.principal)
        prefs.setTags(
            getUtility(IIntIds).queryId(removeAllProxies(self.context)), tags)

        IStatusMessage(self.request).add(_(u'Tags have been changed.'))
        self.redirect('./')
    def update(self):
        super(PersonalFriendConnect, self).update()

        ids = getUtility(IIntIds)
        engine = IPersonalFriendConnect(self.getPrincipal()).engine

        tags = []
        for weight, tag in engine.getTagCloud():
            tags.append({'tag': tag, 'weight': weight+100})

        self.tags = tags

        request = self.request
        if 'tag' in request:
            tag = request.get('tag', '').strip()

            if tag:
                ctool = getUtility(ICatalog)

                self.showContent = True
                self.contents = ctool.searchResults(
                    personalTags={'any_of': (tag,)},
                    sort_on='modified', sort_order='reverse',
                    indexes={'personalTags':TagIndex(engine)})
Exemplo n.º 4
0
 def getContent(self):
     prefs = IPersonalFriendConnect(self.request.principal)
     tags = prefs.getTags(
         getUtility(IIntIds).queryId(removeAllProxies(self.context)))
     return {'tags': ', '.join(tags)}