Bug with the button back - corrected!

Phoca Gallery - image gallery extension
dr.archik
Phoca Member
Phoca Member
Posts: 23
Joined: 14 Aug 2009, 23:05

Bug with the button back - corrected!

Post by dr.archik »

Hello Jan In the first I congratulate your country on victory over us in the final ! The first time has seen as have protected goal by Skat ))

Please debag one error ))) bag with back button !

If in the main menu of joomla, create some links type "index.php?option=com_phocagallery&view=categories" with param (show only id of cat .....), the "back button" work is not correct ( incorect get Itemid of second and other menu items -"view->categories")

My working code:
correct Back Button to CATEGORIES VIEW
file edit (www\components\com_phocagallery\views\category\view.html.php) line #671 - 678

WAS:

Code: Select all


		$itemId	= 0;
		if(isset($itemsLink[0])) {
			$itemId = $itemsLink[0]->id;
		}	
		$backLink = 'index.php?option=com_phocagallery&view=categories&Itemid='.$itemId;
BECOME:

Code: Select all

		$itemId	= 0;
		$Itemid_normal = JRequest::getInt( 'Itemid', 0, 'get' );
		if($Itemid_normal > 0){
		$itemId = JRequest::getInt( 'Itemid', 0, 'get' );
		}
		elseif (isset($itemsLink[0])) {
			$itemId = $itemsLink[0]->id;	
		}
		
		$backLink = 'index.php?option=com_phocagallery&view=categories&Itemid='.$itemId;
elseif (isset($itemsLink[0] .... It isn't obligatory

Can thank me in changelog: Arthur Shurskiy (Rus. Fed.)
(Raiting category \ Show only category ID \ bag button back)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug with the button back - corrected!

Post by Jan »

Hi,
Hello Jan In the first I congratulate your country on victory over us in the final
Great, thank you, :| For the next time you need more Ovechkins :|
The first time has seen as have protected goal by Skat
Sorry I don't understand?


Back Button - seems like there is obsolete code. This should be solved through:
administrator\components\com_phocagallery\libraries\phocagallery\path\route.php

So the code should be:
$backLink = PhocaGalleryRoute::getCategoriesRoute();
Please test it and let me know.

Thank you, Jan
If you find Phoca extensions useful, please support the project
dr.archik
Phoca Member
Phoca Member
Posts: 23
Joined: 14 Aug 2009, 23:05

Re: Bug with the button back - corrected!

Post by dr.archik »

Sorry I don't understand?
One of forward your national team, рas scored goal foot (by Skat) аnd referee goal have included (((

Back Button - seems like there is obsolete code. This should be solved through:
administrator\components\com_phocagallery\libraries\phocagallery\path\route.php

$backLink = PhocaGalleryRoute::getCategoriesRoute();
Please test it and let me know.
Your example doesn't work!
I have written completely working decision, than it doesn't suit you?
dr.archik
Phoca Member
Phoca Member
Posts: 23
Joined: 14 Aug 2009, 23:05

Re: Bug with the button back - corrected!

Post by dr.archik »

Sorry I don't understand?
One of forward your national team, рas scored goal foot (by Skat) аnd referee goal have included (((
$backLink = PhocaGalleryRoute::getCategoriesRoute();
Please test it and let me know.
Your example doesn't work!
I have written completely working decision, than it doesn't suit you?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug with the button back - corrected!

Post by Jan »

Hi,
One of forward your national team, рas scored goal foot (by Skat) аnd referee goal have included (((
:-) Yes, It was the right decision.You should read the IIHF Rule Book:
http://www.iihf.com/iihf-home/sport/iihf-rule-book.html

rules_part_one.pdf


Rule 471 - DISALLOWING A GOAL
a) No goal shall be allowed:
1. If an attacking player deliberately kicks, throws, bats with the hands or otherwise
directs the puck by any means other than his stick into the goal net even if the
puck has been further deflected by any player, goalkeeper or official,
deliberately
Image

not deliberately
Image
have written completely working decision, than it doesn't suit you?
It is not about if it doesn't suit me or not. The Itemid selection should be solved in one code part only, in PhocaGalleryRoute class, so it can be changed e.g. if Joomla! will be updated easily. Not all parts of code (there are ten thousands lines of code) was moved to PhocaGalleryRoute class but all of them should be. I will take a look at it and will try to combine it (the code you have added move to Phoca Gallery Route class)

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

Re: Bug with the button back - corrected!

Post by Jan »

I have changed the:
administrator\components\com_phocagallery\libraries\phocagallery\path\route.php

done some tests and should work:

Code: Select all

class PhocaGalleryRoute
{
	function getCategoriesRoute() { ...
call following method:

Code: Select all

if($item = PhocaGalleryRoute::_findItem($needles, 1)) {
The _findItem looks:

Code: Select all

function _findItem($needles, $notCheckId = 0) {
		$component 		= &JComponentHelper::getComponent('com_phocagallery');
		$menus			= &JApplication::getMenu('site', array());
		$items			= $menus->getItems('componentid', $component->id);
		$currentItemId 	= JRequest::getVar('Itemid', 0, '', 'int');
		
		if(!$items) {
			return JRequest::getVar('Itemid', 0, '', 'int');
		}
		
		$match = null;
		foreach($needles as $needle => $id) {
			
			if ($notCheckId == 0) {

				// Try to find the same Itemid like the current site has
				// The itemid of current site can be itemid of other view
				// In such case and in case no itemid will be found
				// try to find some other itemid
				// Example: categories view - if not found: currentItemid is not
				//          found in categories view, try to find some other
				//          categories view itemid (by backlinks e.g.)
				$sameIdFound = 0;
				foreach($items as $item) {
					if ((int)$currentItemId > 0) {
						if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id) && ($currentItemId == $item->id)) {
						$match = $item;
						$sameIdFound = 1;
						break;
						}
					}
				}	
				// Continue searching of other itemid
				if ($sameIdFound == 0) {
					foreach($items as $item) {
						if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) {
							$match = $item;
							break;
						}
					}
				}
			} else {
				$sameIdFound = 0;
				foreach($items as $item) {
					if ((int)$currentItemId > 0) {
						if ((@$item->query['view'] == $needle) && ($currentItemId == $item->id)) {
						$match = $item;
						$sameIdFound = 1;
						break;
						}
					}
				}
				if ($sameIdFound == 0) {
					foreach($items as $item) {
						if (@$item->query['view'] == $needle) {
							$match = $item;
							break;
						}
					}
				}
			}

			if(isset($match)) {
				break;
			}
		}

		return $match;
	}
It means, first the needles will be searched, e.g. view = categories. If this is found, then the script will try to find such menu item with the same Itemid which is on the current site (the itemid can be itemid of other view e.g. of category view, so it must be checked if 1. is categories view itemid, 2. there is some menu link, 3. itemid of menu link is the same as itemid of current site)

If there is no itemid which is the same as currentitemid in menu link, then the script will try to search some categories view itemid so the backlink can be created.

Will be added into the next version.

Jan
If you find Phoca extensions useful, please support the project
dr.archik
Phoca Member
Phoca Member
Posts: 23
Joined: 14 Aug 2009, 23:05

Re: Bug with the button back - corrected!

Post by dr.archik »

I corrected since the childhood I know, the arbitrator was right I don't argue but I always considered this rule incorrect!
To simply me it is very insulting (

Thanks for the corrected bug!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug with the button back - corrected!

Post by Jan »

I always considered this rule incorrect
I think the goal was OK, because the player really didn't kick the puck advisedly, but what was not OK, was the 5 minut penalty for the bodycheck :-( (but maybe if you ask in Omsk, they will tell you, it is not possible to make such bodycheck to Jágr :D :| )
Thanks for the corrected bug
In fact it is not a bug, there is some specific rule in Joomla! for Itemids which does not work 100% (but has a lot of features) und finding the Itemid and replacing it - hack in the extensions is still not complete. There are a lot of ways in the extensions and mostly if someone will find some good rule, this then break some other feature (so improving this is a neverending story) and it can happen that sometime the finding and replacing itemid will consum so much memory so it will be better to not use it :|
If you find Phoca extensions useful, please support the project
Post Reply