How to initialise the module TextRange after Aloha-Editor initialised Rangy? - rangy

I'm using Aloha Editor for our WYSIWYG form. Since Aloha is using an old version of Rangy, and is initialised by Aloha, is there anyway I can initialise the module TextRange and CssClassApplier after?
Also, updating Rangy-Core dependency of Aloha is not an option right now.

I don't think so. The TextRange module uses API calls that are new in 1.3 so can't be plugged straight into 1.2.

Related

Can globalize-compiler expose CLDR data too?

I am using globalize-compiler to statically load Globalize 1.3.0 and CLDR data. However, I would like to also consume some of the CLDR data directly, for example, to access the value of numbers/symbols-numberSystem-latn/decimal like in Globalize 0.1.1 using .findClosestCulture().
Looking at the compiled formatters, the data is not accessible:
Globalize.b1148906457 = numberFormatterFn(["",,1,,,,,,,,"","0","-0",
"-","",numberRound(),"∞","NaN",{".":",",",":".","%":"%","+":"+",
"-":"-","E":"E","‰":"‰"},]);
Is there any Globalize method or globalize-compiler flag to make CLDR accessible? Do I need to use cldrjs instead?
Maintainer here... It can't. I'm open for ideas on how to make that happen. Possibly this might be helpful https://github.com/globalizejs/globalize/issues/605#issuecomment-205799565

How to enable route security when using AngularFire with Angular ui-router?

Is it possible to use theAngularFire routeSecurity module with angular UI-ROUTER instead of the standard ng-route provider? Is there a version of routeSecurity that would work with ui-router?
#mattvv Gave me this gist while I was talking on him in the angular irc channel. So essentially you would just need to replace the routesecurity.js file in angularfire directory assuming that you used yeoman to scaffold your application.
A neat thing to do is just to create another file named routesecurity-ui-router.js instead of replacing the content of the routesecurity.js.
So to give a little bit of information about the gist, basically mattvv just modified the routes term and use state instead.

Store a file content (binary data) inside plone.app.registry

I need to store inside plone.app.registry binary data in a way compatible from Plone 3.3 to 4.2.
Using simply a schema.Byte type I'm able to quickly reach this on Plone 4.2 (not very user friendly, but it works), but not on Plone 3.3.
On Plone 3.3 the registry is displyaing a file upload control, but when I try to get the saved data I found that it simply stored a string like:
'<... HTTPFileUpload...>'
...so a python repr of an object.
How can I fix this? I need to use plone.namedfile product with collective.z3cform.filewidget?
plone.app.registry is not really designed to store binary data. It is designed to be simple, lightweight and migration-proof.
What are you trying to achieve with this? There is probably a better way.
Since plone.formwidget.namedfile 1.0.12 you can use that wigets on ASCII fields also. Data is then converted to base64. Plone 5 uses that feature for it's site logo, which is stored in the registry.
For an example, see the Plone 4 backport of that feature: https://github.com/collective/collective.sitelogo
Especially:
Usage of an ASCII field for your image: https://github.com/collective/collective.sitelogo/blob/master/src/collective/sitelogo/interfaces.py#L14
Changing the controlpanel widget for the ASCII field to NamedImageFieldWidget: https://github.com/collective/collective.sitelogo/blob/master/src/collective/sitelogo/controlpanel.py#L19
Ok, seems that you can have the same behavior also on Plone 3; in only needed an upgrade of plone.z3cform

How to add CC recipients to an e-mail in Plone 4?

I'm quite new to Plone and as you can read in the Title line I'm working with Plone 4.
Despite being new to both plone and Python, I've managed to get a fully working page to send rich text mail messages to user-selected members of my web site.
What I've done is basically clone (i.e. copy and rename) the sendto, sendto_form, and sendto_template and editing them in order to get what i needed.
As I've said it works quite fine but I need to add a CC recipient, but the MailHost.send() method does not allow for a CC header (and though the secureSend method allows for it, it is a deprecated method in Plone 4).
I've also used a template to let the user add an attachment, the template is available at How to send mail with attachments in Plone using a template approach?.
I know that the python email.Header function does exactly what I need, but when I try to import the library I get an insufficient privileges error (I'm logged in as admin).
I've also tried to work around it by using the following approach:
templ="""Subject: %(subject)s
From: "%(send_from_name)s" <%(envelope_from)s>
To: %(send_to_address)s
CC: %(send_cc_address)s
Content-Type: text/html; charset=UTF-8
Reply-To: %(send_from_address)s
%(comment)s
--
%(signature)s
"""
message=templ % variables
context.MailHost.send(message.encode("utf-8"),encode="quoted-printable")
It works almost fine but can't accept accented characters (which are very common in Italian language).
Any ideas?
Thx in advance,
Luca
You're reaching the limits of the secure python scripting environment you can use TTW in plone. The email module is not allowed to be imported in this type of script.
The old secureSend method on the MailHost object used to have an method parameter for cc which seemed to have been removed in the latest version which only has a "send" method and no cc parameter.
This means you'll have to move the code to a product on the file system in a view in order to use the cc part.

Wordpress widget creation

%wordpress I've created to tool to turn php functions into Wordpress widgets. I use the register_sidebar_widget function but it seems like wp_register_sidebar_widget would give me more options. Is that legal?
P.S. I also generate widgets in the new 2.8 format.
register_sidebar_widget is deprecated--though it can still be used, but you could use wp_register_sidebar_widget. If you do use register_sidebar_widget might want to bracket it in an if ( function_exists('register_sidebar_widget') ) in case that function gets removed in subsequent versions.
Also, there is a plugin, Otto's PHP Code Widget, that allows PHP code in a widget.
http://codex.wordpress.org/WordPress_Widgets_Api/register_sidebar_widget
http://codex.wordpress.org/WordPress_Widgets_Api/wp_register_sidebar_widget
http://wordpress.org/extend/plugins/php-code-widget
Legal? Sure. WordPress is GPL, you can do anything you like as long as you follow the requirements of the license.

Resources