How Joomla implement the item publishing and item unpublishing function? - joomla

Refer to my last post, I have figured out that Joomla call the controller with the POST data task=X.Y, however I found that if I publish an item (task items.publish) or unpublish an item (task items.unpublish), they also calling the controller JControllerAdmin of the function publish but not the function of publish and unpublish.
I know that Joomla may convert the POST data task items.unpublish to call the publish function instead of unpublish, but anyone know where is the code of converting this POST data?
p.s.: I have added the code exit(); at the beginning of the function publish under controller JControllerAdmin and testing for publish or unpublish an item, the result is same --> blank page. So I wondering how Joomla implement these function.

Joomla's Default function for publish and unpublished are written in this file
libraries\joomla\application\component\controlleradmin.php
But its better to avoid editing on that and override those function if you require customization on it in your controller file.
Hope its helps..

Related

How to load custom post data into a sidebar using ajax?

I have a list of custom posts, and I want to have a sidebar, wherein the information associated with a post selected from the list to load.
If you insist on using ajax to do this then you will need an API for your WordPress site to call back into. Take a look at http://wp-api.org/. It won't necessarily be easy, but you should be able to get it setup and running and then put a piece of JavaScript in a widget to make the call and display the data.
Be careful, that plugin is under active development.
IMO, it would be easier to do this without ajax. Off the top of my head I would say that you could define a shorttag in your functions.php file and then put it in your widget. If the widget appears on a page with a post, pick up the post id, fetch the meta data, and display it.
Cheers!
=C=

How to add a history item from a Redmine plugin (via button/link)

Maybe my request is simple, maybe not. I'm fairly new to ruby and everything and face the problem that I need to add a history item from a plugin. I refer to the ticket system Redmine.
Is there a simple way to trigger an event which adds a predefined comment (like "News sent on [date]")? Preferrably the event should be triggered by pressing a button or clicking a link in the redmine web frontend. Like an additional button/link next to the default ones "edit, watch,...).
Can anyone help me here?
The easiest way would be to add a link, with a href to call a javascript function:
Add news entry
The function should add the text you want in the "issue_notes" text field, and send a submit to the "issue-form" form:
function addNewsEntry() {
$('#issue-notes').value = "News sent on [date]";
$('#issue-form').submit();
}
A good example of this is the status_button redmine plugin, this might be a good reference for you as:
it does add some links to the issue page (you also want to add a link to add a new note)
it does change the status on the issue form and submit it (you also want to change a form field and submit it)

Joomla execute function on user login

I need to execute a internal php function to insert a record in database when user login in joomla. How can I do this creating on component, plugin or extensior?
the event onUserLogin works on joomla 2.5? thank you.
You would need to create a plugin and use the event hooks in joomla. So trigger the event and it will talk to your plugin and do w/e it is you want in this case take some user details.
I don't know how to help you code it out if you don't post code so here are some good links to take a look at
Documentation on user events ---> http://docs.joomla.org/J1.5:Plugin/Events/User
Documentation on events ---> http://docs.joomla.org/Plugin/Events
Notice a lot are being "moved" so click through the links to get to the new pages and notice the name changes in the deprecated events.
Hope this helps and post back some code for more feed back.

How to embed grocery crud inside another view?

I have a CI view which uses jquery tab to show some content. One of the tabs loads another controller which uses grocery crud. So the initial display is embeded inside this view. However if I try to edit or update it opens it in a completely seperate page and from then all actions on the grocery crud is in a separate page. How can I embed grocery crud inside a CI view?
This is not yet supported in grocery CRUD but it will be supported as for the new big release of version 1.4 that it is not yet released. If you like to implement the alpha version at your project, you can simply download the latest zip file from github https://github.com/scoumbourdis/grocery-crud (https://github.com/scoumbourdis/grocery-crud/archive/master.zip) and simply go to: application/config/grocery_crud.php and change the line:
$config['grocery_crud_dialog_forms'] = false;
to:
$config['grocery_crud_dialog_forms'] = true;
That's it actually :) . You can see some scrennshort to make sure that this is what you need.
I suggest though for you to wait, at least for the BETA version to release, as it is not 100% done yet.
you should allow sending csrf with the ajax call to allow loading the file with ajax
when we use
$config['csrf_protection'] = TRUE;
what is the place that can i edit to send CSRF of codeigniter with the ajax call ?

CGridView add another delete button with ajax post request

Hello is it possible to add another delete button to Yii CGridView?
I would like it to make an ajax post request to one of mine controllers.
An use case would be:
Lets say I have a blog entry with comments. In administration I would like to have a gridview where I can delete this blog entry (this is already) possible. I would also like to have another delete button next to the original delete button which would only delete blog's comments (which I don't know how to add).
I looked over the HTML generated by Yii framework to see how the original delete button works. One possible solution would be to copy/paste that delete and refresh java script code and modify it a bit. But I don't like this. I have some concerns that if I do this, when I upgrade Yii framework there is no guarantee that my solution will still work.
Use above tutorial and add class="delete" to the new button
'options'=>array('class'=>'delete')
Yii framework assigns ajax call to this class.
array('class'=>'CButtonColumn','template'=>'{remove}{view}{update}{delete}',
'htmlOptions'=>array('style'=>'width:65px'),
'buttons'=>array(
'remove'=>array('url'=>'Yii::app()->createUrl("resolution/removeApp", array("id_application"=>$data->id_application,"id_resolution"=>'.$model->id_resolution.'))','label'=>'Remove application from resolution.','imageUrl'=>Yii::app()->request->baseUrl.'/images/remove.png','options'=>array('class'=>'delete')),
))
You can follow this Using CButtonColumn to customize buttons in CGridView to add a new button which will be calling the action in your controller to delete comments. Cheers.

Resources