How to discard unpublished changes in django-cms? - django-cms

I already found out there's no way to discard unpublished changes in django-cms from the Admin. Therefore I'm looking for a way to hotfix this from the shell via ORM.
I see there's a Page model which has 2 instances for each page, one public and one draft. Is it perhaps possible to discard those changes by copying some particular data from the public instance to the draft instance? Thanks.

From the Page menu you select "Revert to live" and that'll discard the draft changes.

Related

How to extend existing pages, such as Customer or Shopping Cart, through plugins?

I've read everywhere that it's better to write new plugin than touch the core code. The problem is that I've not been able to find documentation where it's explain clearly how to modify pages from the plugin.
The way I understood it, to display partial pages from the plugin, one needs to tells where to display them by return using this method:
public IList<string> GetWidgetZones()
But if you return more than one zone, the widget will be displayed in multiple zones. What if I want to display bit of information on different zones?
To start off, I'd like to extend the the Customer page. The menu on that page has 7 items: customer info, addresses, orders, downloadable products, back in stock subscriptions, reward points, and change password.
I'd like to add 2 more items: personal info and connections. When personal info is clicked, the customer will able to add extra info, such as his/her photo. When the connections is clicked, user would be able to see what other have been doing.
Can someone point me to the documentation that explain how one can extend existing pages, such as Customer and Shopping Cart, without touching the core code.
Thanks for helping
I have read people saying do modifications as much as using plugin. But in practical i do find modifying core logic is one good way to find elegant and less complex way of customizing to our need.
Because, plugins only provides up to a certain limit of modification. In your case, widgets can be extended. But i don't think customer detail page can be extended using plugins. based on your requirements, you may need to add additional columns/attributes for customers. Yes, you can add/remove columns while installing/removing plugins. But in practical, any user in admin can uninstall a pluign. Think if this happens in PROD. Also you have not elaborated about connections.
I have done 250+ custom modifications (to suite our need) on core nopcommerce for my organization over the period of 2.5years. I started with nop 2.65 then moved to 2.80 and then moved to 3.20. Its bit complex to upgrade nop commerce versions on top of our custom modifications. But i can be done, if you are organized from day one.
Here are few rules i follow,
Keep a detailed custom modification list in excel.
Always update code in such as way that new feature can be managed from admin. Example: if you add a new menu in the header, just make sure it can be shown/hidden under admin settings. And this helps to contribute back to nop commerce if possible.
Use a good database Diff tool.
Use version control.
So when a new version of nop is released, i quickly compare my excel with release notes. for migration details see here

Multiple page publishing in SDL Tridion

How can I publish a page to more than one child publication at a time using the SDL Tridion 2009 GUI?
Here is an example of what I want to achieve: I have a Publication called "Global" with a Page called home.aspx and then two child Publications (UK and USA). I want to publish both child home.aspx pages at the same time, is it possible?
You'd need to associate your parent (Global) publication to the publication target that the children pages need to publish too.
this unfortunately means your 'global' page will also publish to the server. You could write a custom resolver around this to remove the page from the published zip package, but this will require some development work to implement.
Bart Koopman has written a post which explains how you can do this here : http://www.tridiondeveloper.com/no-faking-publish-from-a-parent-publication-without-faking-a-publication-target
To publish pages in child publications by selecting publishing of a master page you could employ the event system. Since you're on Tridion 2009 you will need to use the COM+ event system (can't use the new TOM.NET one).
The logic should be as follows:
You may want to put a publication metadata schema on the parent publication that will specify the IDs of the child publications that this cascaded publishing should work for (or create a configuration component). You will also need to specify which publication targets you'll want to publish to for the child publications.
In OnPublishPre (or Post) event use the TOM API to get Pages in the child publications and do page.Publish().
The advantage here is that content managers/publishers don't need to worry about having to go into the Advanced tab and select additional options.
If you want to publish the same page in multiple child publications, click on the advanced tab of the publish dialog, and check the "also publish in child publications" check box.
There is more information on this approach in this post http://www.tridiondeveloper.com/no-faking-publish-from-a-parent-publication-without-faking-a-publication-target.
Depending on whether your parent publication should actually be published, you may want to consider one of the Custom Resolver or Event System solutions offered by John Winter or Nickoli Roussakov in the other answers on this page.

Deleting a post in Drupal forum messes up the numbering

I am subscribed to a Drupal 5 site with the Advanced Forum module. When a user decides to delete her post, the post dissappears and the following posts are moved up.
So if #2 is deleted the existing #3 will become #2 and so forth. The problem with this is if people reference previous posts which are now incorrectly numbered. Consequently it can lead to much confusion or even make people angry because they feel a comment is not appropriate - which it isn't after all!
What we would like is that the deleted post is simply removed without renumbering the rest. There is no option for this in the settings, so I will most likely have to mod the files.
Do you know if there already exists a patch to accomplish this, or can you alternatively point to where I need to modify the code?
I am a experienced PHP developer, but Drupal is new to me.
Possible workaround would be to set status field in comment table to 0, instead of deleting the comment. THat way it would not appear in comment list and other cid's would not be changed. You could do this in a custom module with a hook but I am not sure what hook calls comment_delete, normally you would override hook_nodeapi
but comments if I remember correctly may be handled differently than nodes.
Look in the comment module under /modules and check out from what hook comment_delete is called and override that in a custom module, that way you would not have to hack any core code.
Good-luck

Drupal 6 - change Author of a node

Is there an easy way to change the author of a node to another user? I can't seem to find it. I found a workaround, which was to setup an "action" to change the author of a node to a specific user, and then temporarily setup a "trigger" so that whenever i update a node, it should run that action. It works, but is ugly. I suppose I could also attack the db directly, but these both seem like rather inelegant solutions.
I appreciate this shouldn't be that common an requirement. This is what happened: I setup the site, including place-holder content, which the publisher users then populated with real content. This was clearly not the right way to go about it, but it's the situation I find myself in...
Can't you simply edit the node, expand the Authoring Information section near the bottom of the page, and change the Author name.
You can also change the Authored on date too.
If you need to change the Authoring information of lots of pages, I'd recommend Views Bulk Operations. Changing the Author is one of the options.
Can't you simply edit the node, expand the Authoring Information section near the bottom of the page, and change the Author name.
It should be noted that in order to change these the administer nodes permission must be set for that account. If this is undesired (and in production environments, it is), you can use the Rules module or use the nodeapi hooks to change the desired fields.

Drupal reserve checkbox module?

I have a drupal site I'm working on here: selkirk.treethink.net
I have CCK and Views modules installed, so on the frontend you see the Request Work page created using CCK. On the backend admins and students can view all the work post through that form with the Views module.
I need to add a checkbox that the person submitting the work can't see but students can see in the page that lists the work through "Views". This checkbox will need to only be able to be checked once as it will reserve the job for that student. But the same student that checked it needs to be able to uncheck it...And only that student (or an admin)
In other words: Just a little box that sits on the "Views" page that a student can check and then no one else can uncheck it afterwards except the student that checked it or an admin.
Is there a module that can do this?
Thanks, Wade
My first thought when reading your question was Flag module. There is already a thread in the issue queue about exactly your question: http://drupal.org/node/624746. What it comes down to, is that flag can do most of the job, but you would have to write some code yourself (or possibly use the Rules module) to register which user flagged the node.
Another option would be to use the Workflow module and create an 'assigned' state. I have not done much with workflow myself so I can't really tell you which option is better.
The Field Permissions module lets you specify create, view, and edit permissions for CCK fields. I don't think it will do everything you want, but it's a start.

Resources