コード例 #1
0
ファイル: ToolMixin.py プロジェクト: ajmirsky/appy
 def performLogout(self):
     '''Logs out the current user when he clicks on "disconnect".'''
     rq = self.REQUEST
     userId = self.portal_membership.getAuthenticatedMember().getId()
     # Perform the logout in acl_users
     try:
         self.acl_users.logout(rq)
     except:
         pass
     skinvar = self.portal_skins.getRequestVarname()
     path = '/' + self.absolute_url(1)
     if rq.has_key(skinvar) and not self.portal_skins.getCookiePersistence():
         rq.RESPONSE.expireCookie(skinvar, path=path)
     # Invalidate existing sessions, but only if they exist.
     sdm = self.session_data_manager
     session = sdm.getSessionData(create=0)
     if session is not None:
         session.invalidate()
     from Products.CMFPlone import transaction_note
     transaction_note('Logged out')
     self.getProductConfig().logger.info('User "%s" has been logged out.' % \
                                         userId)
     # Remove user from variable "loggedUsers"
     from appy.gen.plone25.installer import loggedUsers
     if loggedUsers.has_key(userId): del loggedUsers[userId]
     return self.goto(self.getParentNode().absolute_url())
コード例 #2
0
## Script (Python) "prefs_ploneradio_set"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Setup PloneRadio
##
from Products.CMFPlone import transaction_note
request = context.REQUEST
preferences = { 'stream1_enable' : request.get('stream1_enable', ''),
'stream1_name' : request.get('stream1_name', ''),
'stream1_url1' : request.get('stream1_url1', ''),
'stream1_url1_remarks' : request.get('stream1_url1_remarks', ''),
'stream1_url2' : request.get('stream1_url2', ''),
'stream1_url2_remarks' : request.get('stream1_url2_remarks', ''),
'stream1_loganalysis_enable' : request.get('stream1_loganalysis_enable', ''),
'stream1_loganalysis_type' : request.get('stream1_loganalysis_type', ''),
'stream1_loganalysis_url' : request.get('stream1_loganalysis_url', ''),
'stream1_loganalysis_album_url' : request.get('stream1_loganalysis_album_url', ''),
'stream1_loganalysis_recentsongstolist' : request.get('stream1_loganalysis_recentsongstolist', ''),
'stream1_loganalysis_showlisteners' : request.get('stream1_loganalysis_showlisteners', ''),
'stream1_loganalysis_history_url' : request.get('stream1_loganalysis_history_url', ''),
'stream1_loganalysis_history_type' : request.get('stream1_loganalysis_history_type', ''),
'stream1_loganalysis_history_songstolist' : request.get('stream1_loganalysis_history_songstolist', ''),
'stream2_enable' : request.get('stream2_enable', ''),
'stream2_name' : request.get('stream2_name', ''),
'stream2_url1' : request.get('stream2_url1', ''),
'stream2_url1_remarks' : request.get('stream2_url1_remarks', ''),
コード例 #3
0
ファイル: discussion_reply.py プロジェクト: kroman0/products
    # Get entered anonymous name
    comment_creator = comment_creator
else:
    member = context.portal_membership.getAuthenticatedMember()
    # Get Member Full name.If not entered - get user login name
    comment_creator = member.getProperty('fullname')
    if not comment_creator:
        comment_creator = member.getUserName()

tb = context.talkback
id = tb.createReply(title=subject, text=body_text, Creator=comment_creator)
reply = tb.getReply(id)


#XXX THIS NEEDS TO GO AWAY!
portal_discussion=context.portal_discussion
if hasattr(portal_discussion.aq_explicit, 'cookReply'):
    portal_discussion.cookReply(reply, text_format='plain')

parent = tb.aq_parent

from Products.CMFPlone import transaction_note
transaction_note('Added comment to %s at %s' % (parent.title_or_id(), reply.absolute_url()))

target = '%s/%s' % (parent.absolute_url(), parent.getTypeInfo().getActionById('view'))

# Send notification e-mail
send_email(reply, context)

return req.RESPONSE.redirect(target)
コード例 #4
0
## Script (Python) "user_delete"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Delete objects from a folder
##
from Products.CMFPlone import transaction_note

REQUEST=context.REQUEST
if REQUEST.has_key('email') and REQUEST['email']:
    transaction_note( context.absolute_url() + ' ' + str(REQUEST['email'])+' has been added' )
    context.adduser(REQUEST)
    return REQUEST.RESPONSE.redirect(context.absolute_url() + '/users_view?portal_status_message=Added.')
else:
    return REQUEST.RESPONSE.redirect(context.absolute_url() + '/users_view?portal_status_message=Please+enter+an+email.')
コード例 #5
0
## Script (Python) "discussion_publish_comment"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=obj=None
##title=
##
from Products.CMFPlone import transaction_note
from Products.qPloneComments.utils import publishDiscussion

# Publish discussion item
publishDiscussion(context)

transaction_note('Published discussion item')
target = '%s/%s' % (context.absolute_url(), context.getTypeInfo().getActionById('view') )

return context.REQUEST.RESPONSE.redirect(target)
コード例 #6
0
ファイル: render_html.py プロジェクト: Fat-Zer/LDP
from Products.CMFPlone import transaction_note

REQUEST = container.REQUEST

body = ''
l = context.objectValues(['LampadasCVSFile']) # list the objects
for i in (range(len(l))):
    sourcefile = l[i]
    body += str(sourcefile.body)
context.setBody(body)

referer = REQUEST.HTTP_REFERER
referer = context.absolute_url()

view = context.getTypeInfo().getActionById('view')
note = 'Document html has been rendered.'
transaction_note(note)

return REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % ( referer
                                                                    , view
                                                                    , note) )

コード例 #7
0
ファイル: render_html.py プロジェクト: dnessorga/LDP
from Products.CMFPlone import transaction_note

REQUEST = container.REQUEST

body = ''
l = context.objectValues(['LampadasCVSFile'])  # list the objects
for i in (range(len(l))):
    sourcefile = l[i]
    body += str(sourcefile.body)
context.setBody(body)

referer = REQUEST.HTTP_REFERER
referer = context.absolute_url()

view = context.getTypeInfo().getActionById('view')
note = 'Document html has been rendered.'
transaction_note(note)

return REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' %
                                 (referer, view, note))
コード例 #8
0
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Delete objects from a folder
##

from Products.CMFPlone import transaction_note
ids=context.REQUEST.get('ids', [])
titles=[]
titles_and_ids=[]

status='failure'
message='No vocabulary to delete.'

for id in ids:
    obj=context.restrictedTraverse(id)
    titles.append(obj.title_or_id())
    titles_and_ids.append('%s (%s)' % (obj.title_or_id(), obj.getId()))

if ids:
    status='success'
    message=', '.join(titles)+' has been deleted.'
    transaction_note('Deleted %s from %s' % (', '.join(titles_and_ids), context.absolute_url()))
    context.manage_delObjects(ids)

qs = context.create_query_string(portal_status_message=message)

return context.REQUEST.RESPONSE.redirect('%s/view?%s' % (context.absolute_url(),qs))
コード例 #9
0
ファイル: register.py プロジェクト: glehmann/bdr
    state.setError('username', 'The login name you selected is already in use or is not valid. Please choose another.')
    return state.set(status='failure', portal_status_message='Please correct the indicated errors.')

if site_properties.validate_email or REQUEST.get('mail_me', 0):
    try:
        portal_registration.registeredNotify(username)
    except ConflictError:
        raise
    except Exception, err: 

        # TODO registerdNotify calls into various levels.  Lets catch all exceptions.
        #    Should not fail.  They cant CHANGE their password ;-)  We should notify them.
        #
        # (MSL 12/28/03) We also need to delete the just made member and return to the join_form.
               
        state.setError('email', 'We were unable to send your password to your email address: '+str(err))
        state.set(came_from='logged_in')
        context.acl_users.userFolderDelUsers([username,])
        return state.set(status='failure', portal_status_message='Please enter a valid email address.')

state.set(portal_status_message=REQUEST.get('portal_status_message', 'Registered.'))
state.set(came_from=REQUEST.get('came_from','logged_in'))

if came_from_prefs:
    state.set(status='prefs', portal_status_message='User added.')

from Products.CMFPlone import transaction_note
transaction_note('%s registered' % username)

return state
コード例 #10
0
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Delete objects from a folder
##

from Products.CMFPlone import transaction_note
ids = context.REQUEST.get('ids', [])
titles = []
titles_and_ids = []

status = 'failure'
message = 'No vocabulary to delete.'

for id in ids:
    obj = context.restrictedTraverse(id)
    titles.append(obj.title_or_id())
    titles_and_ids.append('%s (%s)' % (obj.title_or_id(), obj.getId()))

if ids:
    status = 'success'
    message = ', '.join(titles) + ' has been deleted.'
    transaction_note('Deleted %s from %s' %
                     (', '.join(titles_and_ids), context.absolute_url()))
    context.manage_delObjects(ids)

qs = context.create_query_string(portal_status_message=message)

return context.REQUEST.RESPONSE.redirect('%s/view?%s' %
                                         (context.absolute_url(), qs))