• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python policy._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ubify.policy._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: getContentItemsCount

def getContentItemsCount(context,path=None):
    lstinfo = []

    totalwikipages = getTotalCountForQuery(context,path,{'portal_type':'Document'})
    lstinfo.append({'id':'Wiki Pages','dispid':context.translate(_(u'lbl_stats_wiki_pages',u'Wiki Pages')),'count':totalwikipages})

    totalblogentries = getTotalCountForQuery(context,path,{'portal_type':'Blog Entry'})
    lstinfo.append({'id':'Blog Entries','dispid':context.translate(_(u'lbl_stats_blog_entries',u'Blog Entries')),'count':totalblogentries})

    totalfiles = getTotalCountForQuery(context,path,{'portal_type':'File'})
    lstinfo.append({'id':'Files','dispid':context.translate(_(u'lbl_stats_files',u'Files')),'count':totalfiles})

    totalimages = getTotalCountForQuery(context,path,{'portal_type':'Image'})
    lstinfo.append({'id':'Images','dispid':context.translate(_(u'lbl_stats_status_images',u'Images')),'count':totalimages})

    totallinks = getTotalCountForQuery(context,path,{'portal_type':'Link'})
    lstinfo.append({'id':'WebLinks','dispid':context.translate(_(u'lbl_stats_status_weblinks',u'WebLinks')),'count':totallinks})

    totalstatusmessages = getTotalCountForQuery(context,path,{'portal_type':'StatuslogItem'})
    lstinfo.append({'id':'Status Messages','dispid':context.translate(_(u'lbl_stats_status_msgs',u'Status Messages')),'count':totalstatusmessages})

    totalvideos = getTotalCountForQuery(context,path,{'portal_type':'Video'})
    lstinfo.append({'id':'Videos','dispid':context.translate(_(u'lbl_stats_videos',u'Videos')),'count':totalvideos})

    totalevents = getTotalCountForQuery(context,path,{'portal_type':'Event'})
    lstinfo.append({'id':'Events','dispid':context.translate(_(u'lbl_stats_events',u'Events')),'count':totalevents})
    
    totaldiscussions = getTotalCountForQuery(context,path,{'portal_type':'Discussion'})
    lstinfo.append({'id':'Discussions','dispid':context.translate(_(u'lbl_stats_discussions',u'Discussions')),'count':totaldiscussions})
    
    totalaudios = getTotalCountForQuery(context,path,{'portal_type':'Audio'})
    lstinfo.append({'id':'Audios','dispid':context.translate(_(u'lbl_stats_audios',u'Audios')),'count':totalaudios}) 

    return lstinfo
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:34,代码来源:statistics.py


示例2: ratecontent

 def ratecontent(self):        
     ratevalue = None
     uid = None
     if self.request.form.has_key('ratevalue'):
         ratevalue = self.request.form['ratevalue']
     if self.request.form.has_key('itemUID'):
         uid = self.request.form['itemUID']
         
     if ratevalue is None:
         raise RatingError,'No rating value.'
     elif uid is None:
         raise RatingError,'No rating item.'
     else:
         pr = getToolByName(self.context, 'portal_ratings', None)
         cat = getToolByName(self.context, 'uid_catalog')
         pr.addRating(int(ratevalue), uid)
         
         query = {'UID':uid}
         resbrains = cat.searchResults(query)
         if len(resbrains) == 1:
             obj = resbrains[0].getObject()
             obj.reindexObject()
         
         myval = int(pr.getUserRating(uid))
         newval = int(pr.getRatingMean(uid))
         ratecount = pr.getRatingCount(uid)
         value_totalscore = pr.getCyninRating(uid)
         value_scorecountlist = pr.getCyninRatingCount(uid)
         value_pscore = value_scorecountlist['positivescore']
         value_pcount = value_scorecountlist['positive']
         value_nscore = value_scorecountlist['negativescore']
         value_ncount = value_scorecountlist['negative']
         
         if myval == 1:
             newtitle=_(u'hated_it',u"Hate it (-2)")
         elif myval == 2:
             newtitle=_(u'didnt_like_it',u"Dislike it (-1)")
         elif myval == 3:
             newtitle=''
         elif myval == 4:
             newtitle=_(u'liked_it',u"Like it (+1)")
         elif myval == 5:
             newtitle=_(u'loved_it',u"Love it (+2)")
         
         trans_title = self.context.translate(newtitle)
         
         if value_totalscore > 0:
             plus_sign = "+"
         else:
             plus_sign = ""
         totalscore = plus_sign + str(value_totalscore)
         
         output = trans_title + ',' + totalscore + ',' + str(value_pcount) + ',' + str(value_ncount)
         return output
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:54,代码来源:custommethods.py


示例3: CyninEdition

def CyninEdition(context):
    portal_quickinstaller = getToolByName(context, 'portal_quickinstaller')
    ubifyEdition = ""
    objProduct = portal_quickinstaller._getOb('ubify.enterprise',None)
    objondemandproduct = portal_quickinstaller._getOb('ubify.ondemand',None)
    if objProduct <> None:
        return _('cynin_enterprise_edition','enterprise edition'),'ee'
    elif objondemandproduct <> None:
        return _('cynin_ondemand_edition','on demand edition'),'od'
    else:
        return _('cynin_community_edition','free open source edition'),'ce'
开发者ID:eaudeweb,项目名称:ubify.cyninv2theme,代码行数:11,代码来源:__init__.py


示例4: getTitleForRating

def getTitleForRating(num):
    if num == 1:
        newtitle=_(u"hated_it",u'Hated it')
    elif num == 2:
        newtitle=_(u"didnt_like_it",u"Didn't like it")
    elif num == 3:
        newtitle=_(u"average",u"Average")
    elif num == 4:
        newtitle=_(u"liked_it",u'Liked it')
    elif num == 5:
        newtitle=_(u"loved_it",u'Loved it')
    return newtitle
开发者ID:eaudeweb,项目名称:ubify.cyninv2theme,代码行数:12,代码来源:__init__.py


示例5: getSchemaSectionName

def getSchemaSectionName(schema):
    returnvalue = 'default'
    if schema.lower() == "categorization":
        returnvalue = _(u"categorization",u"Categorization")
    elif schema.lower() == "dates":
        returnvalue = _(u"schedule",u"Schedule")
    elif schema.lower() == "ownership":
        returnvalue = _(u"ownership",u"Ownership")
    elif schema.lower() == "settings":
        returnvalue = _(u"additional_settings",u"Additional Settings")
    elif schema.lower() == "default":
        returnvalue = _(u"content",u"Content")
    return returnvalue
开发者ID:eaudeweb,项目名称:ubify.cyninv2theme,代码行数:13,代码来源:__init__.py


示例6: getUsersCountForSpace

def getUsersCountForSpace(context,roles_to_search):
    results = []
    
    listReaders = context.users_with_local_role('Reader')
    listReaders = checkIfGroupGetUsers(listReaders,context)
    
    listContributors = context.users_with_local_role('Contributor')
    listContributors = checkIfGroupGetUsers(listContributors,context)
    
    listReviewers = context.users_with_local_role('Reviewer')
    listReviewers = checkIfGroupGetUsers(listReviewers,context)

    listEditors = context.users_with_local_role('Editor')
    listEditors = checkIfGroupGetUsers(listEditors,context)

    
    for role_to_search in roles_to_search:
        objresults = []
        if role_to_search == 'Readers':
            for user in listReaders:
                if user not in listContributors and user not in listReviewers and user not in listEditors:
                    objresults.append(user)
        elif role_to_search == 'Contributors':
            for user in listContributors:
                if user not in listReviewers and user not in listEditors:
                    objresults.append(user)
        elif role_to_search == 'Reviewers':
            for user in listReviewers:
                if user not in listEditors:
                    objresults.append(user)
        elif role_to_search == 'Editors':
            objresults = listEditors
        else:   #Special case when all members will be listed priority given to managers
            listmembers = []
            listtemp = []
            
            for userEditor in listEditors:
                listtemp.append(userEditor)
                listtemp.sort()
            for userReviewer in listReviewers:
                if userReviewer not in listmembers and userReviewer not in listtemp:
                    listmembers.append(userReviewer)
            for userContributor in listContributors:
                if userContributor not in listmembers and userContributor not in listtemp:
                    listmembers.append(userContributor)
            for userReader in listReaders:
                if userReader not in listmembers and userReader not in listtemp:
                    listmembers.append(userReader)
                    
            listmembers.sort()
            listtemp.extend(listmembers)
            objresults.extend(listtemp)
    
        results.append({'id':role_to_search,'dispid':context.translate(_(role_to_search,role_to_search)),'count':len(objresults)})
    
    return results
    
    
    
开发者ID:cynapse,项目名称:cynin,代码行数:56,代码来源:statistics.py


示例7: refreshMyAreaBlock

 def refreshMyAreaBlock(self,messageuid,count):
     portal_state = getMultiAdapter((self.context, self.request), name=u"plone_portal_state")
     
     if portal_state.anonymous():
         return
     user_token = portal_state.member().getId()
     if user_token is None:
         return
     
     status_messages = self.context.portal_catalog.searchResults(Creator = user_token,portal_type=('StatuslogItem',),sort_on = 'created',sort_order='reverse',sort_limit=1);
     
     if len(status_messages) > 0:
         pdt = getToolByName(self.context, 'portal_discussion', None)
         newuid = status_messages[0].UID
         full_message = status_messages[0].getObject()
         newcount = 0
         message = status_messages[0].Title
         
         if full_message.isDiscussable():
             newcount = pdt.getDiscussionFor(full_message).replyCount(full_message)
         
         if newuid != messageuid or int(count) != newcount:                
             zopecommands = self.getCommandSet('zope')
             ksscore = self.getCommandSet('core')
             
             message = force_unicode(message,'utf')
             commenttext = ''
             
             if newcount < 1 or newcount > 1:
                 commenttext = _(u'text_comments',u"comments")
             elif newcount == 1:
                 commenttext = _(u'text_1_comment',u"comment")
             
             commenttext = self.context.translate(commenttext)
             commenttext = force_unicode(commenttext,'utf')
             
             selector = ksscore.getHtmlIdSelector('currentmessagediv')
             ksscore.replaceInnerHTML(selector,message)
             
             countselector = ksscore.getHtmlIdSelector('comcynapsecyninstatuscomments')
             ksscore.replaceInnerHTML(countselector,'<a href="%s">%s %s</a>' % (full_message.absolute_url(),newcount,commenttext,))
             
             kssattrselector = ksscore.getHtmlIdSelector('comcynapsecyninmyareablock')
             ksscore.setKssAttribute(kssattrselector,'messageid',str(newuid))
             ksscore.setKssAttribute(kssattrselector,'count',str(newcount))
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:45,代码来源:kssmethods.py


示例8: getTotalUsersCount

def getTotalUsersCount(context):
    userscount = 0
    usersdata = []    
    if context.portal_type in ('ContentSpace'):
        usersdata = getUsersCountForSpace(context,('Users','Editors','Contributors','Readers',))        
    else:
        search_view = context.restrictedTraverse('@@pas_search')
        userscount = len(search_view.searchUsersByRequest(context.REQUEST, sort_by='fullname'))
        usersdata.append({'id':'Users','dispid':context.translate(_(u'lbl_stats_users',u'Users')),'count':userscount})
    return usersdata
开发者ID:cynapse,项目名称:cynin,代码行数:10,代码来源:statistics.py


示例9: getSiteStatistics

def getSiteStatistics(context,path=None,ignoreviews=True,ignoretags=True):
    lstinfo = []
    
    lstinfo.extend(getTotalUsersCount(context))
    
    totalspaces = getTotalCountForQuery(context,path,{'portal_type':'ContentSpace'})
    lstinfo.append({'id':'Spaces','dispid':context.translate(_(u'lbl_stats_spaces',u'Spaces')),'count':totalspaces})

    if not ignoreviews:
        totalviews = getTotalCountForQuery(context,path,{'portal_type':'Topic'}) + getTotalCountForQuery(context,path,{'portal_type':'SmartView'})
        lstinfo.append({'id':'Collections','dispid':context.translate(_(u'lbl_stats_collections',u'Collections')),'count':totalviews})

    if not ignoretags:
        totaltags = getTotalCountForIndexType(context,path,'Subject')
        lstinfo.append({'id':'Tags','dispid':context.translate(_(u'lbl_stats_tags',u'Tags')),'count':totaltags})

    totalitems = getTotalCountForQuery(context,path,{'portal_type':spacesdefaultaddablenonfolderishtypes + ('StatuslogItem',)})
    lstinfo.append({'id':'Items','dispid':context.translate(_(u'lbl_stats_items',u'Items')),'count':totalitems})

    totalcomments = getTotalCountForQuery(context,path,{'portal_type':'Discussion Item'})
    lstinfo.append({'id':'Comments','dispid':context.translate(_(u'lbl_stats_comments',u'Comments')),'count':totalcomments})

    return lstinfo
开发者ID:cynapse,项目名称:cynin,代码行数:23,代码来源:statistics.py


示例10: creatediscussion

 def creatediscussion(self):
     strDiscussion = ''
     strTags = ''
     discussiontitle = ''
     tagstitle = ''
     obj = None
     location = self.context
     is_discussiontitle_reqd = False
     strDiscussionTitle = ''
     
     portal_state = getMultiAdapter((self.context, self.request), name=u"plone_portal_state")
     cat = getToolByName(self.context, 'uid_catalog')
     portal = portal_state.portal()
     if self.request.has_key('com.cynapse.cynin.discussionmessageinput'):
         strDiscussion = self.request['com.cynapse.cynin.discussionmessageinput']
     if self.request.has_key('comcynapsediscussiontag'):
         strTags = self.request['comcynapsediscussiontag']
     if self.request.has_key('comcynapsediscussiontitle'):
         discussiontitle = self.request['comcynapsediscussiontitle']
     if self.request.has_key('comcynapsetagstitle'):
         tagstitle = self.request['comcynapsetagstitle']
     if self.request.has_key('comcynapseadddiscussioncontextuid'):
         locationuid = self.request['comcynapseadddiscussioncontextuid']
     else:
         locationuid = ''
         
     if self.request.has_key('com.cynapse.cynin.discussiontitle'):
         is_discussiontitle_reqd = True
         strDiscussionTitle = self.request['com.cynapse.cynin.discussiontitle']        
     
     query = {'UID':locationuid}
     resbrains = cat.searchResults(query)
     if len(resbrains) == 1:
         location = resbrains[0].getObject()
     
     if strDiscussion == '' or strDiscussion.lower() == discussiontitle.lower():            
         raise EmptydiscussionError, 'Unable to add discussion with blank text.'
     elif is_discussiontitle_reqd and (strDiscussionTitle == ''):
         raise EmptydiscussionError, 'Unable to add discussion with blank title.'
     else:
         from ubify.cyninv2theme import addDiscussion
         strActualTags = ''
         if strTags.lower() != tagstitle.lower():
             strActualTags = strTags
         obj = addDiscussion(portal,strDiscussion,strActualTags,location,strDiscussionTitle)
         if obj <> None:
             here_text = _(u'lbl_here',u'here')
             strlink = "<a href='%s'>%s</a>" % (obj.absolute_url(),self.context.translate(here_text),)
             return strlink
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:49,代码来源:custommethods.py


示例11: update

 def update(self):
     portal_state = getMultiAdapter((self.context, self.request),name=u'plone_portal_state')
     context_state = getMultiAdapter((self.context, self.request),name=u'plone_context_state')
     tools = getMultiAdapter((self.context, self.request), name=u'plone_tools')
     typetool= getToolByName(self.context, 'portal_types')
     portal_title = portal_state.portal_title()
     object_title = context_state.object_title()
     object_typename = self.context.portal_type
     object_typeobj = typetool[object_typename]
     self.typeiconname = object_typeobj.content_icon
     if object_typeobj.title == '' and self.context.portal_type.lower() == 'plone site':
         self.typetitle = plone_site_type_title
     else:
         self.typetitle = _(object_typeobj.title,object_typeobj.title)
     self.app_name = object_title
     if self.context.portal_type.lower() == 'plone site':
         self.tdescription = 'cyn.in site|A cyn.in site allows instant collaboration among peers and provides a central social computer and network.'
     else:
         self.tdescription = self.typetitle + '|' + object_typeobj.description
     self.isaddscreen = False
     if hasattr(context_state.parent(),'portal_type') and context_state.parent().portal_type == 'TempFolder':
         self.isaddscreen = True
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:22,代码来源:typetitle.py


示例12: renameScrawl

def renameScrawl(portal_types):
    blog_fti = getattr(portal_types, 'Blog Entry')
    blog_fti.title = 'Blog Post'
    blog_fti.description = _(u"Formatted temporal content",u"Formatted temporal content")
    blog_fti.icon_expr = 'string:$portal_url/blog.png'
    blog_fti.global_allow = True
开发者ID:liberiun,项目名称:cynin-intranet,代码行数:6,代码来源:setuphandlers.py


示例13: _

import BTrees
import datetime
import calendar
from zope.component import queryMultiAdapter
from zope.contentprovider.interfaces import IContentProvider
from p4a.calendar import interfaces

from zope.i18n.locales import locales
from zope.i18n.interfaces import  IUserPreferredLanguages

from ubify.policy import CyninMessageFactory as _


DAYS = [
        _(u'Monday'),
        _(u'Tuesday'),
        _(u'Wednesday'),
        _(u'Thursday'),
        _(u'Friday'),
        _(u'Saturday'),
        _(u'Sunday'),
        ]

MONTHS = [
          _(u'N/A'),
          _(u'January'),
          _(u'February'),
          _(u'March'),
          _(u'April'),
          _(u'May'),
          _(u'June'),
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:31,代码来源:month.py


示例14: getAppTitleForContext

def getAppTitleForContext(context):
    tempid = _(u"activity_stream",u"Activity Stream")
    ptype = context.portal_type
    if ptype == 'Document':
        tempid = _(u"wiki",u"Wiki")
    elif ptype == 'File':
        tempid = _(u"files",u"Files")
    elif ptype == 'Image':
        tempid = _(u"images",u"Images")
    elif ptype == 'Link':
        tempid = _(u"links",u"Links")
    elif ptype == 'Blog Entry':
        tempid = _(u"blogs",u"Blogs")
    elif ptype == 'Event':
        tempid = _(u"calendar",u"Calendar")
    elif ptype == 'StatuslogItem':
        tempid = _(u"statuslog",u"Status Log")
    elif ptype == 'Video':
        tempid = _(u"videos",u"Videos")
    elif ptype == 'Discussion':
        tempid = _(u"Discussions",u"Discussions")
    elif ptype == 'Audio':
        tempid = _(u"Audios",u"Audios")

    return tempid
开发者ID:eaudeweb,项目名称:ubify.cyninv2theme,代码行数:25,代码来源:__init__.py


示例15: title

 def title(self):
     return _(u"Recent files")
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:2,代码来源:filesportlet.py


示例16: len

    strErrorMessage = ""
    ilen = len(mdatas)
    if ilen > 1:
        for ival in range(1,ilen):
            try:
                performCheck(context,mdatas[ival - 1])
            except PasteError, msg:
                strErrorMessage = strErrorMessage + msg + " "
    elif ilen == 1:
        try:
            performCheck(context,mdatas[ilen - 1])
        except PasteError, msg:
            strErrorMessage = strErrorMessage + msg + " "

    if strErrorMessage <> "":
        strErrorMessage = _(u"error_cannot_paste",u"Cannot paste Folders between different applications.Disallowed to paste item(s).")
        raise PasteError,strErrorMessage

def performCheck(context,mdata):
    strURL = "/".join(mdata)

    rootObject = context.portal_url.getPortalObject()
    copiedObject = rootObject.restrictedTraverse(strURL)
    if copiedObject.portal_type == 'Folder':
        parentObject = copiedObject.getParentNode()
        try:
            getApplication(copiedObject,context,rootObject)
        except PasteError, msg:
            raise PasteError,msg

def getApplication(source,dest,root):
开发者ID:eaudeweb,项目名称:ubify.cyninv2theme,代码行数:31,代码来源:__init__.py


示例17: getjsondata

def getjsondata(context,records=10,type=None):
    site_encoding = context.plone_utils.getSiteEncoding()
    strpath = "/".join(context.getPhysicalPath())
    portal = context.portal_url.getPortalObject()
    
    try:
        from ubify.policy.config import contentroot_details
        rootid = contentroot_details['id']                
        objRoot = getattr(portal,rootid)
        if context == objRoot:
            strpath = "/".join(portal.getPhysicalPath())            
        else:
            strpath = "/".join(context.getPhysicalPath())            
    except AttributeError:
        strpath = "/".join(context.getPhysicalPath())
        
    if type is None:
        raise "No chart type was passed"
    elif type.lower() == "topcontributors":
        chart = template('')
        plot = HBar()
        results = getTopContributors(context,strpath)[:records]
        results.sort(lambda x,y: cmp(x['count'],y['count']),reverse=True)
        objvalues = [k['count'] for k in results if k['count'] > 0]

        users = [j['userid'] for j in results if j['count'] > 0]
        users.reverse()

        xlabels = x_axis_labels()
        xlabels.set_colour("#666666")
        chartsteps = 1.0
        if len(objvalues) > 0:
            chartsteps = getchartsteps(objvalues[-1],objvalues[0])
        chart.set_x_axis(offset = False, labels = xlabels,steps = chartsteps,colour="#cccccc",grid_colour="#f1f1f1")
        chart.set_y_axis(offset=True,labels = users,colour="#666666",grid_colour="#f1f1f1")

        for val in objvalues:
            #plot.append_values(hbar_value((0, val), tooltip = '#right# contributions', colour = '#4092D8'))
            plot.append_values(
                               hbar_value((0, val), 
                               tooltip = '#right# %s' % (context.translate(_(u'lbl_stats_tooltip_contributions',u'contributions'))),
                               colour = '#4092D8')
            )
        chart.add_element(plot)
        chart.set_tooltip(stroke=1,colour="#1f1f1f",bg_colour="#292929",title_style="font-size:12px;color:#ffffff;font-weight:bold",body_style="font-size:12px;color:#ffffff",behaviour="hover")

        chart.set_bg_colour("#FFFFFF")
        return chart.encode()

    elif type.lower() == "topcommenters":
        chart = template('')
        plot = HBar()
        results = getTopCommenter(context,strpath)[:records]
        results.sort(lambda x,y: cmp(x['count'],y['count']),reverse=True)
        objvalues = [k['count'] for k in results if k['count'] > 0]

        users = [j['userid'] for j in results if j['count'] > 0]
        users.reverse()

        xlabels = x_axis_labels()
        xlabels.set_colour("#666666")
        chartsteps = 1.0
        if len(objvalues) > 0:
            chartsteps = getchartsteps(objvalues[-1],objvalues[0])
        chart.set_x_axis(offset = False, labels = xlabels,steps = chartsteps,colour="#cccccc",grid_colour="#f1f1f1")
        chart.set_y_axis(offset=True,labels = users,colour="#666666",grid_colour="#f1f1f1")
        
        for val in objvalues:
            #plot.append_values(hbar_value((0, val), tooltip = '#right# comments', colour = '#57AC0B'))
            #if len(val) == 1:
            #   tooltip_comment = '#right# %s' % (context.translate(_(u'lbl_stats_tooltip_comment',u'comment'))),
            #if len(val) > 1:
            #   tooltip_comment = '#right# %s' % (context.translate(_(u'lbl_stats_tooltip_comments',u'comments'))),
            plot.append_values(
                               hbar_value((0, val), 
                                          #tooltip = '#right# %s' % (tooltip_comment),                                             
                                          tooltip = '#right# %s' % (context.translate(_(u'lbl_stats_tooltip_comments',u'comments'))),
                                          colour = '#57AC0B')
            )
        chart.add_element(plot)
        chart.set_tooltip(stroke=1,colour="#1f1f1f",bg_colour="#292929",title_style="font-size:12px;color:#ffffff;font-weight:bold",body_style="font-size:12px;color:#ffffff",behaviour="hover")

        chart.set_bg_colour("#FFFFFF")
        return chart.encode()

    elif type.lower() == "contentstats":
        #For pie chart
        results = [k for k in getContentItemsCount(context,strpath) if k['count'] > 0]
        results.sort(lambda x,y: cmp(x['count'],y['count']),reverse=True)

        chart = template('')
        plot = Pie(start_angle = 35, animate = True, values = [pie_value(val = k['count'],label = (k['id'],None, None)) for k in results],colours = ['#4092D8', '#57AC0B', '#CC0000', '#862DFF', '#FF6600',  '#00FFF6','#FF37D2', '#5251ff', '#F0EA80', '#abff00',], label_colour = '#666666')
#        plot.set_tooltip('#label#: #val# of #total#<br>#percent# of 100%')
#        plot = Pie(
#		start_angle = 35, 
#		animate = True, 
#		values = [pie_value(val = k['count'],
#		label = (k['id'],None, None)) for k in results],
#		colours = ['#4092D8', '#57AC0B', '#CC0000', '#862DFF', '#FF6600', '#00FFF6','#FF37D2', '#5251ff', '#F0EA80', '#abff00',], 
#		label_colour = '#666666'
#.........这里部分代码省略.........
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:101,代码来源:statistics.py


示例18: Malad

#
#You can also contact Cynapse at:
#802, Building No. 1,
#Dheeraj Sagar, Malad(W)
#Mumbai-400064, India
###############################################################################
from zope.interface import implements

from zope.component.factory import Factory

from plone.locking.interfaces import ITTWLockable
from plone.app.content.interfaces import INameFromTitle
from plone.app.content.container import Container
from Products.ATContentTypes.content.folder import ATFolder

from ubify.policy import CyninMessageFactory as _
from ubify.smartview.interfaces import ISmartView

class SmartView(ATFolder):
    implements(ISmartView, ITTWLockable, INameFromTitle)
    portal_type = "SmartView"
    
    title = u""
    description = u""
    query = u""
    
    def __init__(self, id=None):
        super(SmartView, self).__init__(id)        
    
smartviewFactory = Factory(SmartView, title=_(u"Create a new Advanced View"))
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:30,代码来源:content.py


示例19: fiddle

    def fiddle(self,schema):

        if schema.has_key('location'):
            schema.changeSchemataForField('location', 'settings')
        if schema.has_key('language'):
            schema.changeSchemataForField('language', 'settings')
        if schema.has_key('rights'):
            schema.changeSchemataForField('rights', 'settings')
            schema['rights'].widget.visible = {'edit': 'invisible', 'view': 'visible'}

        fields = [i for i in schema.values() if isinstance(i,atapi.LinesField) and
                                       isinstance(i.widget, atapi.KeywordWidget)]

        for field in fields:
            oldlabel = content_categories_label_name
            olddesc  = field.widget.description
            field.widget = TagSuggestWidget(label=oldlabel,description = _(u'Enter comma (,) separated tags. Example: \"important, related to productx, basic, advanced\". If an autohint selection tip appears, press tab to select the first one, or type further to shorten the hint list.'),role_based_add = True)

        if schema.has_key('contributors'):
            schema['contributors'].widget.visible = {'edit': 'invisible', 'view': 'visible'}

        if schema.has_key('creators'):
            schema['creators'].widget.visible = {'edit': 'invisible', 'view': 'visible'}

        if schema.has_key('tableContents'):
            schema['tableContents'].default = 1;

        if schema.has_key('excludeFromNav'):
            schema['excludeFromNav'].widget.visible = {'edit': 'invisible', 'view': 'visible'}

        if schema.has_key('location') and self.context.portal_type != 'Event':
            schema['location'].widget.label = content_location_label_name

        if self.context.portal_type == 'Blog Entry':
            if schema.has_key('image'):
                schema['image'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            if schema.has_key('imageCaption'):
                schema['imageCaption'].widget.visible = {'edit': 'invisible', 'view': 'visible'}

        if schema.has_key('eventType'):
            schema.changeSchemataForField('eventType', 'categorization')
            schema.moveField('eventType', before='relatedItems')

        if schema.has_key('remoteUrl'):
            schema['remoteUrl'].widget.maxlength = False

        if self.context.portal_type in ('ContentSpace','MemberSpace','ContentRoot') and schema.has_key('allowDiscussion'):
            schema['allowDiscussion'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            
        if self.context.portal_type in ('ContentSpace','ContentRoot'):
            if schema.has_key('effectiveDate'):
                schema['effectiveDate'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            if schema.has_key('expirationDate'):
                schema['expirationDate'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            if schema.has_key('location'):
                schema['location'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            if schema.has_key('language'):
                schema['language'].widget.visible = {'edit': 'invisible', 'view': 'visible'}
            
        if self.context.portal_type in ('Discussion',):
            try:
                portal_url = getToolByName(self.context,'portal_url')
                if portal_url <> None:                    
                    portal = portal_url.getPortalObject()
                    if portal <> None:
                        portal_prop = portal.portal_properties
                        if hasattr(portal_prop,'site_properties'):
                            site_prop = getattr(portal_prop,'site_properties')
                            if hasattr(site_prop,'allow_discussion_title') and getattr(site_prop,'allow_discussion_title') == True:                        
                                if schema['title'] <> None and schema['title'].widget <> None:
                                    schema["title"].widget.visible = {"edit": "visible", "view": "invisible"}
                                    schema['title'].required = True
            except:
                pass
开发者ID:Cenditel,项目名称:cenditel.comunidades.cynin,代码行数:74,代码来源:utils.py


示例20: update

    def update(self):
        menu = getUtility(IBrowserMenu, name='plone_contentmenu_factory')

        portal_state = getMultiAdapter((self.context, self.request),name=u'plone_portal_state')
        context_state = getMultiAdapter((self.context, self.request),name=u'plone_context_state')

        typetool= getToolByName(self.context, 'portal_types')

        object_typename = self.context.portal_type
        fti = getattr(typetool,'Plone Site')
        self.showsitehomemenu = False

        view = self.context.restrictedTraverse('@@plone')
        tabs = view.prepareObjectTabs()
        for eachtab in tabs:
            if eachtab['id'].lower() == 'edit' and eachtab['selected']:
                self.addnewitems = []
        
        available_appviews = []
        show_all_menu = False
        
        if self.context.hasProperty('availableappviews'):
            available_appviews = self.context.getProperty('availableappviews')
            
        if len(available_appviews) == 0:
            show_all_menu = True
            
        self.applications = []
        self.activitystream_item = {}
        self.dashboard_item = {}
        self.applicationviews = getAvailableAppViews(self.context)        
        
        for eachappview in self.applicationviews:
            if eachappview.id == 'activitystream':
                self.activitystream_item = {
                        'title':_(eachappview.title),
                        'id':eachappview.id,
                        'url':eachappview.url_expr.replace("string:",''),
                        'icon':eachappview.icon_expr.replace("string:",''),
                        'selected':False,
                        'visible':show_all_menu or eachappview.id in available_appviews,
                    }
            elif eachappview.id == 'dashboard':
                self.dashboard_item = {
                        'title':_(eachappview.title),
                        'id':eachappview.id,
                        'url':eachappview.url_expr.replace("string:",''),
                        'icon':eachappview.icon_expr.replace("string:",''),
                        'selected':False,
                        'visible':show_all_menu or eachappview.id in available_appviews,
                    }
            else:
                self.applications.append(
                    {
                        'title':_(eachappview.title),
                        'id':eachappview.id,
                        'url':eachappview.url_expr.replace("string:",''),
                        'icon':eachappview.icon_expr.replace("string:",''),
                        'selected':False,
                        'visible':show_all_menu or eachappview.id in available_appviews,
                    }
                )
        
        ##Decide what items to show in the Application menus, here::
        req = self.request
        last = req.physicalPathFromURL(req.getURL())[-1]
        res = [i for i in self.applications if i['url'] in last and i['url'] != '']
        self.lastpart = last
        self.dashboard_selected = False
        self.activitystream_selected = False
        
        if len(res)>0:
            selview = res[0]
            selview['selected'] = True
            self.selectedItem = selview            
        elif last in ('pastEvents','upcomingEvents'):
            calendar_applications = [k for k in self.applications if k['id'].lower() == u'calendar']
            if len(calendar_applications) > 0:
                selview = calendar_applications[0]
                selview['selected'] = True
                self.selectedItem = selview
            else:
                self.selectedItem = None
        elif last in ('placeful_workflow_configuration'):
            selview = {'title':'Workflow Policy','url':'placeful_workflow_configuration','icon':'icon-arrow_switch.png','selected':False,'visible':False,}
            self.selectedItem = selview
        elif last in ('home','dashboard'):
            self.dashboard_selected = True            
        elif last in ('app_all'):
            self.activitystream_selected = True            
        else:
            self.selectedItem = None

        
        
        self.ploneview = self.context.restrictedTraverse('@@plone');
        self.view_actions = self.ploneview.prepareObjectTabs();
        selected_views = [br for br in self.view_actions if br['selected']==True]
        if len(selected_views) > 0:
            self.manage_selectedItem = selected_views[0]
#.........这里部分代码省略.........
开发者ID:Cenditel,项目名称:cenditel.ppm.cynin,代码行数:101,代码来源:ApplicationsMenuViewlet.py



注:本文中的ubify.policy._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python stream_logger.info函数代码示例发布时间:2022-05-27
下一篇:
Python uberdict.udict函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap