Hide Joomla Template in Controller - templates

i have a big Joomla 1.5 Problem. I'll create my own Gallery Component/PlugIn and want to add an AJAX Sorting possibility.
In the Backend i want to reorder the Images by Drag&Drop in an Gallery. It works, but for the Output i have the following Problem:
I send the AJAX Request to
index.php?option=com_cwgallery&controller=gallerie&task=ajax
As i told you, it works, but i want to display the result in a Layer. But Joomla always sends the complete Template and the Result back.
How can i disable sending the Admin Template??? Hope you understand what i mean?
Thanks,
Sascha

Add &format=raw to the end of your URL.

Related

Single-page login in Django app

I'm currently using out-of-the-box django.contrib.auth to handle authentication in my Django app. This means that the user starts at a log in page and is redirected to the app on successful login. I would like to make my app single-page, including this login process, where a redirect doesn't happen, but maybe a "hot" template switch-out or some fancy client-side div magic (that still remains secure). My Google searching turned up pretty short, the closest solution dealing with putting a log in form on every page.
Any direction or ideas here would be much appreciated. I would obviously prefer to work within the existing confines of django.contrib.auth if possible, but I'm open to all solutions.
I'm not sure I understand your question completely. I think you want to have a single page. If so, put logic in your template that checks to see if the user is authenticated. If not, display a login form that POSTS to the appropriate django.contrib.auth view. You can supply an argument to this view to have it redirect back to your page. When you come back, the user will be authenticated, so you won't display the login form.
Have a look at Django-Easy-Pjax https://pypi.python.org/pypi/django-easy-pjax - it works like a charm and is well documented. Everything you like is being made with AJAX requests: links, forms using GET and forms using POST.
Essentially you only need to add a data-pjax="#id_of_the_container_where_the_result_goes" attribute in your a and form tags.
And the great thing about it: It updates the title and location bar of your browser.
One caveat: If you want to upload files in some form, this is not supported by Easy-Pjax, so you might want to use some workaround jQuery library for that.

Implementing Ajax requests / response with django-allauth

I am using django-allauth for one of my project. I would like to implement login/signup process via ajax. I would like to have customized signup form. I was going through their signupmixin and signup form. Sounds like I can write custom views for each action and map it to the url config. I am not sure what is the best way to do this.
Thank you so much for any help or advice on this.
It depends a bit on what you mean by ajax. If you just want to have a popup-style login/signup box on every page, then you can simply add the form to your base template and show it dynamically using Javascript in a popup box or so. If you keep the form action url to the original allauth urls then this will already give the feel of an ajax signin. You could also tweak things by using $.ajax or $.post to post to the original allauth views.
Something like the above is done on http://officecheese.com/ -- this is an allauth based site, though I am not affiliated with it.
If by ajax you mean that all authentication related views should be displayed via ajax, without causing a new document reload, then I am afraid you are a little bit out of luck. This simply is problematic for scenario's where e-mail verification, or OAuth handshakes are involed, as here you are typically navigating to a new URL from your mailbox, or redirecting to Twitter and so on.

its possible to display different categories from another site?

Im working a newspaper, and I was wondering if its possible to display different categories from another Website, and display in my website. This site created by Joomla 2.5, I Hope someone understands this :)
Since your site is the Joomla one, you could either write a custom extension or more simply use the Jumi extension so you can write PHP code directly in the article or page on which you need to grab the content from the other site.
Then depending on what you know about the other site, there are different approaches. If it offers an API or RSS feed, you can use that to pull the content you need (and use PHP string functions for instance to modify it as you need). If the other site doesn't have an obvious way of offering content through a web service, try PHP curl, and again you can modify the content before displaying it. Check out this page too: How to parse actual HTML from page using CURL?
As Arunu said an iFrame could also work if you don't need to modify the other site's content.
What u wish to do can be accomplished using RSS feed or an i-frame.But from ur question
it's not clear which site is using joomla.

Reload googlemaps after user clicks a link in Django

I am doing a project in Django and i want to have some google maps displayed in my site. So, i installed django-easy-maps and successfully used it in a sample template. So, i am ready with my maps.
The interface i want to implement is this
http://i49.tinypic.com/sowm74.png
I want to display the maps where the Hellow World! container is and with different links on the sidebar i want to refresh the map being displayed on user click without reloading the page.
I did some researching and it seems Ajax is the solution...
Can anybody tell me how i might achieve this (with or without Ajax ) ?
Sorry for sounding like a noob but i am fairly new to this.
The basic steps are:
Create a view for the Google Maps section to the right. This view does not return a full HTML page but only the HTML for that section (which contains your Google Maps map).
When the user clicks on a link on the left, use JavaScript to perform an ajax call to request that page. In short this means: attach an event handler to the onclick event of those links and in code you can perform an ajax call .Many people use a JavaScript library for this purpose, such as jQuery (which has $.ajax()).
You can then use JavaScript to put the received HTML inside the container on the right (using $.html()).

Modifying the django-cms 'add plugin' template on a per plugin basis?

The template I'm specifically talking about is the one that is used when a user add's a plugin to a page. Both in the admin area, and when modifying pages directly, it is displayed using an iframe.
The template itself is located cms/templates/admin/cms/page/plugin_change_form.html.
My problem is that I need some javascript to populate a drop down list within the form. All the javascript is run before the iframe is added to the page though, so I thought if I managed to edit the template I can tell the iframe to load some specific js. I can obviously just change the template directly, but that's a bit of an undesirable solution. I would rather keep it within the django application and even better have the js run only on specific plugins.
Any thoughts are appreciated.
You can set the change_form_template on your CMSPluginBase subclass, as CMSPluginBase is a subclass of django.contrib.admin.options.ModelAdmin.