diff --git a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_afterSend.xml b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_afterSend.xml new file mode 100644 index 0000000000000000000000000000000000000000..c1682852a7e35454b074b7421a0165ec082fc9aa --- /dev/null +++ b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_afterSend.xml @@ -0,0 +1,121 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""Save the message id of the relative document"""\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>message_id, document_relative_url=None</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>message_id</string> + <string>document_relative_url</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>SMSTool_afterSend</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_pushNewSMS.xml b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_pushNewSMS.xml similarity index 96% rename from bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_pushNewSMS.xml rename to bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_pushNewSMS.xml index fbfd1e5c992f18f137018eb129f5f2dc9ded9b83..c53cab743b72026270981b6a0d0fdffc8a416f1e 100644 --- a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_pushNewSMS.xml +++ b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_pushNewSMS.xml @@ -59,7 +59,8 @@ text_content -- the message (String)\n message_type -- Type of message (String)\n reception_date -- The date when the message was received (DateTime)"""\n #XXX-Should be replace by portal_contribution\n -event = context.newContent(portal_type="Short Message",\n +module = context.getDefaultModule("Short Message")\n +event = module.newContent(portal_type="Short Message",\n sender=sender,\n recipient=recipient,\n content_type=message_type,\n @@ -132,6 +133,7 @@ event.setDestinationValue(searchParentOfTelephoneNumber(recipient))\n <string>reception_date</string> <string>_getattr_</string> <string>context</string> + <string>module</string> <string>event</string> <string>searchParentOfTelephoneNumber</string> </tuple> @@ -150,7 +152,7 @@ event.setDestinationValue(searchParentOfTelephoneNumber(recipient))\n </item> <item> <key> <string>id</string> </key> - <value> <string>EventModule_pushNewSMS</string> </value> + <value> <string>SMSTool_pushNewSMS</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_setEventDelivery.xml b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_setMessageDelivery.xml similarity index 98% rename from bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_setEventDelivery.xml rename to bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_setMessageDelivery.xml index b128ef61c8ec62fb6ead1ce41c73af54b8f14789..96fc8707cffc271488b4d3b2657c0cdb4e782da0 100644 --- a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/EventModule_setEventDelivery.xml +++ b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/SMSTool_setMessageDelivery.xml @@ -125,7 +125,7 @@ if event is not None:\n </item> <item> <key> <string>id</string> </key> - <value> <string>EventModule_setEventDelivery</string> </value> + <value> <string>SMSTool_setMessageDelivery</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_init.xml b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_init.xml new file mode 100644 index 0000000000000000000000000000000000000000..60c4419c5a933636238629dd2ae589a8a3d14f69 --- /dev/null +++ b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_init.xml @@ -0,0 +1,157 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""Owner Proxy Role allows anonymous users to create events\n +through web sites.\n +\n +Reference will be probably generated with dedicated tool\n +in near future\n +"""\n +portal = context.getPortalObject()\n +type_definition = context.getTypeInfo()\n +\n +short_portal_type = type_definition.getShortTitle()\n +if not short_portal_type:\n + short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n +\n +id_group = (\'reference\', short_portal_type)\n +default = 1\n +new_id = portal.portal_ids.generateNewId(id_group=id_group, default=default)\n +reference = \'%s-%s\' % (short_portal_type, new_id)\n +\n +# Set preferred text format and reference\n +context.edit(content_type=\'text/plain\',\n + reference=reference)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>*args, **kw</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>args</string> + <string>kw</string> + <string>_getattr_</string> + <string>context</string> + <string>portal</string> + <string>type_definition</string> + <string>short_portal_type</string> + <string>_getiter_</string> + <string>id_group</string> + <string>default</string> + <string>new_id</string> + <string>reference</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ShortMessage_init</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_send.xml b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_send.xml new file mode 100644 index 0000000000000000000000000000000000000000..26f474ef685e137c03b54a098677e54b26fb3a9a --- /dev/null +++ b/bt5/erp5_short_message/SkinTemplateItem/portal_skins/erp5_short_message/ShortMessage_send.xml @@ -0,0 +1,179 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""\n + Send the current sms by using a SMS gateway.\n + Use default mobile phone of source and destination\n +"""\n +\n +#Get recipients\n +if not to_url:\n + recipient_phone_list = [person.getDefaultMobileTelephoneValue() for person in context.getDestinationValueList()]\n + if None in recipient_phone_list:\n + raise ValueError, "All recipients should have a default mobile phone"\n +\n + to_url = [phone.asURL() for phone in recipient_phone_list]\n + if None in to_url:\n + raise ValueError, "All recipients should have a valid default mobile phone number"\n +\n +#Get sender\n +if not from_url:\n + if context.getSourceValue():\n + sender_phone = context.getSourceValue().getDefaultMobileTelephoneValue()\n + if not sender_phone:\n + raise ValueError, "The sender should have a default mobile phone"\n + #We use title of sender\n + from_title = sender_phone.getTitle() \n + from_url = sender_phone.asURL()\n +\n + \n +\n +if not body:\n + body = context.getTextContent()\n +\n +context.portal_sms.send(text=body, recipient=to_url, sender=from_url, sender_title=from_title,message_type="text", test=download, **kw)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>from_url=None, from_title=None, to_url=None, reply_url=None, subject=None, body=None, attachment_format=None, attachment_list=None,download=False,**kw</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>9</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>from_url</string> + <string>from_title</string> + <string>to_url</string> + <string>reply_url</string> + <string>subject</string> + <string>body</string> + <string>attachment_format</string> + <string>attachment_list</string> + <string>download</string> + <string>kw</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>_getattr_</string> + <string>context</string> + <string>person</string> + <string>recipient_phone_list</string> + <string>None</string> + <string>ValueError</string> + <string>phone</string> + <string>sender_phone</string> + <string>_apply_</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + <none/> + <int>0</int> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ShortMessage_send</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_short_message/bt/revision b/bt5/erp5_short_message/bt/revision index bf0d87ab1b2b0ec1a11a3973d2845b42413d9767..7813681f5b41c028345ca62a2be376bae70b7f61 100644 --- a/bt5/erp5_short_message/bt/revision +++ b/bt5/erp5_short_message/bt/revision @@ -1 +1 @@ -4 \ No newline at end of file +5 \ No newline at end of file diff --git a/bt5/erp5_short_message/bt/version b/bt5/erp5_short_message/bt/version index ceab6e11ece0bcec917c12e11d350946f085d549..2f4536184bcac31936bd15a5f9cf931dd526c022 100644 --- a/bt5/erp5_short_message/bt/version +++ b/bt5/erp5_short_message/bt/version @@ -1 +1 @@ -0.1 \ No newline at end of file +0.2 \ No newline at end of file