Plone: hiding Add-ons from Site Setup - plone

I'd like to know if there is any product that can help me to hide an Add-on from the list of available Add-ons in "Site setup". Let me explain why.
I am in the situation of hosting multiple customers Plone sites running on the same Zope instance, each site is using a different Data.fs, and I have made a few packages for each customer customization, something like "Customer A Theme", "Customer B Theme". Now, because they are on the same Zope instance, Customer A can see in its site Add-ons list that "Customer B Theme" is also available, which is what I'm trying to avoid.
Hiding products from the Add-ons list would be also useful in some other cases, for example a more skilled customer can have PloneFormGen installed, while regular customers don't.
I don't know if such a product exist and I'm willing to make one, if some of you can point me to the right direction.
Thank you

In your __ init__.py put somewhere
from zope.interface import implements
from Products.CMFQuickInstallerTool.interfaces import INonInstallable
class HiddenProfiles(object):
"""This hides zope2 profiles from the add-ons control panel/
quick installer tool.
"""
implements(INonInstallable)
def getNonInstallableProducts(self):
return ['DOTTED_PACKAGE_PATH']
Then in a configure.zcml
<utility
factory=".HiddenProfiles"
name="DOTTED_PACKAGE_PATH"
/>
And replace *DOTTED_PACKAGE_PATH* with the real name, i.e. collective.myfancypackage.
Important: If there is more than one profile registered for one dottedpath the alphabetical first is shown as add-on and the others are surpressed.
It is not possible to exclude a single profile, only all profiles of a package. As a workaround it is possible to make a subpackage i.e. collective.myfancypackage.hiddenprofile/profiles/default, register it and put in there all the stuff needed to add a profile. Then exclude the dotted path collective.myfancypackage.hiddenprofile while the main profile located at collective.myfancypackage/profiles/default is still installable as an addon.

yes, you can hide packages from the list of available add-ons; I know how to do it using five.grok, but there should be a direct way also.

Related

Scheduling and publishing replacement pages in a CMS

Does anyone have any ideas or know of any plugins to allow pages to be scheduled and replaced.
preamble:
currently evaluating different content management systems for a new project, we create new pages and also updating existing pages for example as part of a 'maintenance release'.
We will be using either PHP (preferably) or C#
Problem:
We would like our users to be write and save a new revision of an existing page with a go-live date and time in the future, at this date and time we would like the page to be live replacing the existing page, but all links to the page, url etc to be the same.
Currently:
We have two separate installs and schedule updates to pages using a cron job and a PHP script running some mysql queries - this has failed us at critical times in the past when it has failed to run.
finally:
We could probably write this ourselves, either in our own CMS or as a plugin to an existing CMS - simply:
SELECT latest_revision from posts_pages_table
WHERE publishable='yes'
AND max(revision_date);
but does anyone have any experience of this with an existing CMS or from a technical point of view foresee any problems?
How for example in a wordpress backend will a user be sure they are updating the latest version of a page if it hasn't gone 'live' yet.
We have looked at all existing CMSs and searched google but scheduling updates to pages seems to be an uncommon occurrence so relying on some guidance from the trusty SO crowd.
thanks
If you are fine with PHP, you can use SilverStripe. To achieve what you are asking you'd use the CMS Workflow module.
SilverStripe CMS comes with two stages built-in: live and draft. You can keep reworking the draft version, which remain private until you are ready to publish. In the normal scenario you would just push to live.
With the CMS Workflow installed, you can additionally choose the date when the modification should go live ("embargo"). This stores your draft version for "later", and only pushes to live at the date you've chosen (this plugs in via the cron job).
There is also an "expiry" you can set on the page, at which point the page will be unpublished and will no longer be available publicly.
Embargo, expiry and publishing operations do not affect the URL nor ID of the page, so all the relations stay intact while you are reworking the page via the CMS.
References:
PDF manual, see page 16 for description of the embargo
Module page with a short description
Source
In Joomla, there is a way to do this out of the box without touching any code. Here's how I would do it -
Create a category for the page that will be getting replaced
Create a menu item pointing to that category. Set it to display 1 item only, ordered by newest date
Create a template override so that the category item displays like an article detail page
Create new articles with a start publish date that determines when it starts displaying
Basically, you'd be displaying a category but it would look like an article. It would always pull the newest article that has reached it's start publish date. It would be easy to keep track of because you would have copies of every version you post, each update you would simply make a copy of the last one to edit.
You could probably write something custom to accomplish the same thing, but why spend the time and effort when it can be done easily with a template override?

Paypal Express Checkout Language - How to set it in Drupal 7 - Ubercart 3

I have a site entirely in English language about tourism in Italy.
Now when the user clicks on "Paypal express check out" button finds the italian version of the Paypal Page.
I would like to force paypal to be in English language too, because if a customer speaking english language comes in Italy, he would like to have also paypal in the same language of the site and not based on his IP address, Browser Location, or anything else.
So, my question is: how can i be sure that all visitors see Paypal in the same language (English) of the rest of the site?
I have Drupal 7 and Ubercart 3 installed.
I downloaded the Paypal SDK for PHP 5.2 and verified that it's enough to add
&LOCALECODE=en_UK
in the nvp string.
Where do I have to modify Ubercart to integrate this update?
I tried to modify the uc_paypal.module adding
watchdog('paypal', "uc_paypal_ec_checkout",$variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL);
in all functions containing a $nvp_request array definition, but i can't see any new row in the watchdog table.
Obviously i tried also to add a
'LOCALECODE' => 'en_UK',
row in the definition of the array, but with no effects.
I have the "Paypal express check out" button in the cart, and when i click on it, i obtain the italian version of the Paypal page.
If you have any idea about what file i have to modify and where, please help me.
If you need more info, let me know.
Thank you
I've recently been searching for a solution to this. Some mention being able to change the language of the actual Paypal account, although i've not managed to find that option hidden away with the paypal account setting pages. Plus it is useful for some to provide the payment pages in one language yet still have your account in your own language. So like you I was looking for exactly this.
I've looked through the uc_paypal module code and there doesn't seem to be any easy way to add to the SetExpressCheckout request neatly, so patching the code as you have done seems to be the only way.
The change you have made is the same as mine, except the locale code you are using isn't listed in the PayPal guide I have. I've been referencing the PayPal Express Checkout Advanced Features Guide.
If you use 'US' or 'UK' for your 'LOCALECODE' entry it should work for you. This has worked for me in Ubercart 3.0-rc3, and scanning the latest Ubercart code v3.1 it doesn't look like much has changed so this should work there too.
Note: there are 2 locations relating to the Paypal 'SetExpressCheckout' request which need to have the LOCALECODE added. (One in function uc_paypal_ec_checkout, and one in uc_paypal_ec_form_submit)
Hopefully that helps you.
I hate changing core code and really really really avoid doing it at all costs, and I don't agree with making these types of code changes, but it just wasn't possible on this occasion. If anyone has a better way to do this then please provide it. I think the real answer is to patch the Ubercart uc_paypal module to allow the LOCALECODE to be selected in the settings UI and then incorporate it into the SetExpressCheckout request. Not sure why it isn't currently in there, perhaps Paypal have added this feature after the module was written. I'll look into submitted a patch at some point if others haven't already, but if some one is better placed to make that change/patch then go right ahead! :) I just haven't yet fully familiarised myself with all the Drupal hoops to jump through for getting a patch submitted.

Prefixing the pathauto structure with a country code

My client wants their site to be localised, so that example.com/uk presents the uk version, example.com/aus would be the australian version etc etc. However, I want the actual content, and the nodes delivered, to remain and the basic path structure to not change- just prefixed with the country code. Of course I want a 'switch country' button, automatic redirections based on geoIP etc, but for now I just want to focus on the path structure. However, I still want the country selected to be available within views, content types, template files etc, so that uk/products/chairs and aus/products/chairs will still be aliases of node/1 but will then be supplied with a session/cookie/variable set as 'uk' or 'aus'.
Does anyone know any way of doing this please? Google hasn't really supplied much knowledge :/
Many fanks! :)
If you're on Drupal 7, just go to admin/config/regional/language and click "edit" for each language which will allow you to set the "Path prefix language code." This will append the phrase of your choosing after the domain and before the Drupal path just as you requested.
The "Switch country" button can be found on the Blocks page as the "Language switcher" block.
As for uk/products/chairs and aus/products/chairs, so long as one is a translation of the other (using the built-in locale module and possibly the internationalization module, you shouldn't have any problems.

Wordpress/MovableType: How does Lifehacker implement their comment system?

I really like how Lifehacker.com (and Gawker.com) implements their comment system.
I believe, but am not certain, they use Movable Type as the platform for their blog.
What I like about their comment system is that it's a simple open text field and once you click "Share" it then asks you to register.
Question: Anyone know how to accomplish this same functionality with either Wordpress or Movable Type?
The Gawker blogging network (of which lifehacker and gizmodo are part) use their own custom blogging platform (Pingdom blog post at beginning of last year)
If you want users to register before they leave comments, go to Admin > Options > General and check "users must register to leave comments" (or at least I think that's the right path, I'm doing it from memory)

Drupal: best practice to arrange various Drupal entities into one site /subsection

It's perhaps a common task to create a subsection on site, which will reside under sitename.com/subpath.
The subsection will contain own menu with a few links (Calendar view, Add MyEvent content type form, Table View).
But clicking these links will lead out of this /subpath.
Is there a know solution for this (to stay in subsection)?
Or it's normal to use custom code to manage such a subsection, e.g. create pages under /subpath with custom PHP code that will load CCK forms (drupal_get_form())?
Also, is it a tolerable solution to modify from "View links to node forms" to "View links to /subpath pages with programmatically created node forms"?
I'm not sure I completely understood your question - if I didn't and I'm off-topic, I apologize in advance.
Anyway:
Creating pages with code in them using PHP filter, is never accepted practice. There's a reason why the filter was moved to its own module in 6.x - so you can turn it off altogether.
You can go to Site building->URL aliases->Create alias and point the wanted system paths (say, node/add/mycontent) to your subsection path (say, mysection/add/mycontent). All the links to the system path should change to the new alias.
EDIT:
Also, check out pathauto and Sub-path URL Aliases for paths like node/1 and node/1/edit

Resources