User control panel. Sort by title doesn't work

Phoca Gallery - image gallery extension
flavio
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Sep 2014, 10:58

User control panel. Sort by title doesn't work

Post by flavio »

Hi,

I have an "User Control Panel" on my Joomla 3.2.3, and my Phocagallery version is 4.1.1
When the user goes to the "control panel" on the front end, if he wants to sort the subcategories or the images by title or by the column called "Order", nothing happens.
I can see a Javascript error on the console:
core.js (line 9, col 104)

Code: Select all

TypeError: d is null
...d=document.getElementById("adminForm"));d.filter_order.value=a;d.filter_order_Di...
-------------------------------------------î

It happens using an Artisteer template, but I have tried it with the original template of Joomla 3 "protostar", and the issue is the same.

Could you help me?
Thanks!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: User control panel. Sort by title doesn't work

Post by Jan »

Hi, it is known issue, I have pasted it into Joomla! bug tracker:
http://joomlacode.org/gf/project/joomla ... 42&start=0

I hope, this will be finished soon, I have prepared small hack so if this will be not solved in Joomla! I will add the hack to next version of Phoca Gallery :idea:

Thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
flavio
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Sep 2014, 10:58

Re: User control panel. Sort by title doesn't work

Post by flavio »

This problem is it:
-You can use

Code: Select all

JHtml::_('grid.sort',  'COM_PHOCAGALLERY_TITLE', 'a.title', 'order_Dir', 'order', 'subcategory')
but ONLY if the form has id="adminForm", and in the "user control panel", this form hasn't id. The name of it is name="phocagallerysubcatform"
-When one user click on the title of a column to sort by it, a Javascript is called into the file media/system/js/core.js
-In this file, the function Joomla.tableOrdering searchs a form which id is "adminForm" and assigns two values: form.filter_order.value and form.filter_order_Dir.value

Code: Select all

Joomla.tableOrdering = function(order, dir, task, form) {
	if (typeof(form) === 'undefined') {
		form = document.getElementById('adminForm');
		/**
		 * Added to ensure Joomla 1.5 compatibility
		 */
		if(!form){
			form = document.adminForm;
		}
	}

	form.filter_order.value = order;
	form.filter_order_Dir.value = dir;
	Joomla.submitform(task, form);
}
Javascript on "user control panel" fails coz it can't find the "adminForm".

My initial solution was to assign an id to the phocagallerysubcatform, but we have another problem: in the tab "images", we have other form with the same issue. If we want to fix the two forms, they couldn't have the same id. :o

I don't know if I'll finish rewriting this panel, coz my customer wants a solution. :idea:
flavio
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Sep 2014, 10:58

Re: User control panel. Sort by title doesn't work

Post by flavio »

You can read about it on:
http://docs.joomla.org/Adding_sortable_ ... _component

On Step 3: The Template you'll find:
Notice that the form name must be "adminForm"
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: User control panel. Sort by title doesn't work

Post by Jan »

Hi, this is why I have posted the pull request on joomlacode.org

There is fixed name "adminForm" without any sense or any reason, in the javascript, it is easy to change the javascript to accept every name you add and this solve the problem with more IDs on one page (so every form can have other ID and name)

If you add "adminForm" to all your forms on the site (e.g. there are three forms on one site) then the javascript cannot link to right part as there will be three parts with the same name.

So the fixed name "adminForm" is in fact very limiting, really no idea what this is set in Joomla! so I have fixed it and send it to Joomla! project, not sure if they will set it.

"Notice that the form name must be "adminForm" but how to handle it with more forms on one site?

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: User control panel. Sort by title doesn't work

Post by Jan »

Hi, solved in 4.1.2, I have added there own ordering class, so it is not independent to the Joomla! order (grid) method and should work.

Jan
If you find Phoca extensions useful, please support the project
Post Reply