Changeset 127
- Timestamp:
- 12/27/05 05:23:32
- Files:
-
- ShortMessage/trunk/Extensions/Install.py (modified) (3 diffs)
- ShortMessage/trunk/Extensions/Sm_Workflow.py (modified) (5 diffs)
- ShortMessage/trunk/HISTORY.txt (modified) (1 diff)
- ShortMessage/trunk/INSTALL.txt (modified) (1 diff)
- ShortMessage/trunk/README.txt (modified) (1 diff)
- ShortMessage/trunk/ShortMessage.py (modified) (2 diffs)
- ShortMessage/trunk/__init__.py (modified) (2 diffs)
- ShortMessage/trunk/tests/testSm.py (modified) (1 diff)
- ShortMessage/trunk/validators.py (modified) (1 diff)
- ShortMessage/trunk/version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ShortMessage/trunk/Extensions/Install.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 13:10:10 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """ 7 This module is created for installing ShortMessage product to Plone site. 8 It has such functions: 9 10 - `install`: this function sets all types in ShortMessage product, also install skin directory and other 11 - `install_workflow`: this function create new workflow and sets it to ShortMessage type 12 - `setPortalFactoryType`: sets ShortMessage type to PortalFactory 13 """ 14 __docformat__ = 'restructuredtext' 15 1 16 from Products.Archetypes.public import listTypes 2 17 from Products.Archetypes.Extensions.utils import installTypes, install_subskin … … 9 24 10 25 def setPortalFactoryType(self, out,): 26 """sets ShortMessage type to PortalFactory""" 11 27 pf=getToolByName(self, 'portal_factory') 12 28 ftypes=list(pf.getFactoryTypes()) … … 20 36 21 37 def install_workflow(self, out): 22 38 """this function create new workflow and sets it to ShortMessage type""" 23 39 setupWorkflow(self) 24 40 print >> out, "Installed workflow..." 25 41 26 42 def install(self): 27 43 """this function sets all types in ShortMessage product, also install skin directory and other""" 28 44 out=StringIO(); 29 45 ShortMessage/trunk/Extensions/Sm_Workflow.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 13:33:15 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """ 7 This is workflow for ShortMessage type that sends SMS upon object publishing. 8 This module define the following functions: 9 10 - `createWorkflow`: create new workflow. 11 - `fillWorkflow`: takes created workflow and add to it state, transitions, permissions and etc. 12 - `addWorkflowScripts`: add ExternalMethod named send_publishedMessage to the workflow 13 - `setupWorkflow`: setup created workflow to portal and set it to ShortMessage type 14 - `send_publishedMessage`: Send message if it is published 15 """ 16 __docformat__ = 'restructuredtext' 17 1 18 from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition 2 19 from Products.CMFCore.CMFCorePermissions import ModifyPortalContent … … 9 26 from Products import ShortMessage 10 27 11 #add ExternalMethod named 'send_publishedMessage'12 28 def addWorkflowScripts(wf): 29 """add ExternalMethod named send_publishedMessage to the workflow""" 13 30 if 'send_publishedMessage' not in wf.scripts.objectIds(): 14 31 wf.scripts.manage_addProduct['ExternalMethod'].manage_addExternalMethod('send_publishedMessage', 'Send Message', 'ShortMessage.Sm_Workflow', 'send_publishedMessage') 15 32 16 33 def fillWorkflow(wf): 34 """takes created workflow and add to it state, transitions, permissions and etc""" 17 35 for state in ('pending', 'visible', 'published',): 18 36 wf.states.addState(state) … … 35 53 wf_visible.setPermission(p_modify, 0, (r_manager, r_owner)) 36 54 37 # wf.permissions+=(CMFCorePermissions.ListFolderContents, )38 # wf.states.private.permission_roles[CMFCorePermissions.ListFolderContents]=['Authenticated', r_manager]39 55 40 56 wf_visible = wf.states['pending'] … … 54 70 wf_published.setPermission(p_modify, 0, (r_manager, )) 55 71 56 # wf.states.published.permission_roles[CMFCorePermissions.ListFolderContents]=[r_anon,]57 72 58 73 tdef = wf.transitions['submit'] … … 102 117 103 118 def send_publishedMessage(self, state_change): 104 """Send ingmessage if it is published"""119 """Send message if it is published""" 105 120 message_obj = state_change.object 106 121 #send message to user(s) 107 122 state_change.getPortal().portal_smsCommunicator.send_Request(message_obj.getSender(), message_obj.getRecipient(), message_obj.getBody()) 108 123 109 #create workflow110 124 def createWorkflow(id): 125 """create new workflow""" 111 126 wf = DCWorkflowDefinition(id) 112 127 fillWorkflow(wf) ShortMessage/trunk/HISTORY.txt
r126 r127 1 0.1.4 2005-12-27 2 ================ 3 4 - add docstring to all classes and functions 5 1 6 0.1.3 2005-11-14 2 7 ================ ShortMessage/trunk/INSTALL.txt
r126 r127 1 2 Product installation 3 ==================== 4 5 For installation you must first off all copy ShortMessage 6 to your Products directory, second restart your instance 7 then go to plone setup->Add/Remove Products and install ShortMessage. ShortMessage/trunk/README.txt
r126 r127 1 Quintagroup ShortMessage 2 3 This product lets you create your own short message in Plone websites. 4 It consists of sender, recipient or recipients, and body(message text). 5 But if you want to send this short message you also need to install 6 PloneSMSCommunicator on your Plone site. If you installed PloneSMSCommunicator 7 then you can send your message to somebody. For that you must do three things: 8 - you must create new short message or select old one 9 - change state from visible to submit 10 - and the last step that is sending message to recipient is: 11 you have to publish your message and for that you must have manager rights ShortMessage/trunk/ShortMessage.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 12:57:23 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """ShortMessage is Archetypes-based content type. It has Workflow that sends Short message upon object publishing. 7 This module defines the following classes: 8 9 - `ShortMessage`, a ShortMessage type that allows you to create your own short message 10 Methods: 11 - `ShortMessage.setDefaultSender`: sets none to Sender field if policy is free and enforceOriginator in other case""" 12 13 __docformat__ = 'restructuredtext' 14 1 15 from Products.CMFCore.utils import getToolByName 2 16 from Products.Archetypes.public import * … … 36 50 37 51 class ShortMessage(BaseContent): 38 52 """ShortMessage type allows you to create your own short message""" 39 53 schema = schema 40 54 archetype_name=ARCHETYPE_NAME 41 55 42 56 def setDefaultSender(self): 57 """ sets none to Sender field if policy is free and enforceOriginator in other case""" 43 58 communicator = getToolByName(self, 'portal_smsCommunicator') 44 59 policy = communicator.getProperty('policy') ShortMessage/trunk/__init__.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 13:10:22 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """ 7 This is the init module for ShortMessage product that will initialize all 8 types in product. 9 """ 10 __docformat__ = 'restructuredtext' 11 1 12 from Products.Archetypes.public import * 2 13 from Products.CMFCore import utils … … 4 15 from config import * 5 16 6 #registerDirectory(SKINS_DIR, GLOBALS)7 17 8 18 def initialize(context): ShortMessage/trunk/tests/testSm.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 13:47:40 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """This module contains class that tests short message """ 7 1 8 from Testing import ZopeTestCase 2 9 from Products.Archetypes.tests import ArchetypesTestCase ShortMessage/trunk/validators.py
r126 r127 1 # Author: Melnychuk Taras 2 # Contact: fenix@quintagroup.com 3 # Date: $Date: 2005-11-23 13:15:21 +0200 (Thu, 23 Nov 2005) $ 4 # Copyright: quintagroup.com 5 6 """In this module define MaxSmValidator class that validate text block not more then 160 symbols""" 7 8 __docformat__ = 'restructuredtext' 9 1 10 from Products.validation.interfaces.IValidator import IValidator 2 11 3 12 class MaxSmValidator: 4 """validator for short message"""5 13 6 14 __implements__ = IValidator ShortMessage/trunk/version.txt
r126 r127 1 0.1. 31 0.1.4
