Changeset 2530

User picture

Author: Johan Janssens

(2010/09/02 12:24) Over 1 year ago

re #99 : Translate 'offset' to 'limitstart' to be 100% compatible with Joomla's URL rendering. This will make sure Nooku driven extensions are fully compatible with existing SEF solutions.

Affected files

Updated branches/99-toolbar/code/administrator/components/com_default/controllers/default.php Download diff

25292530
32
		//Register command callbacks
32
		//Register command callbacks
33
		$this->registerCallback(array('after.save', 'after.delete'), array($this, 'setMessage'));
33
		$this->registerCallback(array('after.save', 'after.delete'), array($this, 'setMessage'));
34
	}
34
	}
35
	
36
	/**
37
	 * Set the request information
38
	 * 
39
	 * This function translates 'limitstart' to 'offset' for compatibility with Joomla
40
	 *
41
	 * @param array	An associative array of request information
42
	 * @return KControllerBread
43
	 */
44
	public function setRequest(array $request = array())
45
	{
46
		if(isset($request['limitstart'])) {
47
			$request['offset'] = $request['limitstart'];
48
		}
49
		
50
		$this->_request = new KConfig($request);
51
		return $this;
52
	}
35
53
36
 	/**
54
 	/**
37
	 * Filter that creates a redirect message based on the action
55
	 * Filter that creates a redirect message based on the action

Updated branches/99-toolbar/code/administrator/components/com_default/helpers/paginator.php Download diff

25292530
89
89
90
		return $html;
90
		return $html;
91
	}
91
	}
92
	
93
	protected function _link($page, $title)
94
	{
95
		$url   = clone KRequest::url();
96
		$query = $url->getQuery(true);
97
98
		//For compatibility with Joomla use limitstart instead of offset
99
		$query['limit']      = $page->limit;
100
		$query['limitstart'] = $page->offset;
101
102
		$class = $page->current ? 'class="active"' : '';
103
104
		if($page->active && !$page->current) {
105
			$html = '<a href="'.JRoute::_((string) $url->setQuery($query)).'" '.$class.'>'.JText::_($title).'</a>';
106
		} else {
107
			$html = '<span '.$class.'>'.JText::_($title).'</span>';
108
		}
109
110
		return $html;
111
	}
92
}
112
}

Updated branches/99-toolbar/code/site/components/com_default/controllers/default.php Download diff

25292530
20
class ComDefaultControllerDefault extends KControllerView
20
class ComDefaultControllerDefault extends KControllerView
21
{
21
{
22
	/**
22
	/**
23
	 * Set the request information
24
	 * 
25
	 * This function translates 'limitstart' to 'offset' for compatibility with Joomla
26
	 *
27
	 * @param array	An associative array of request information
28
	 * @return KControllerBread
29
	 */
30
	public function setRequest(array $request = array())
31
	{
32
		if(isset($request['limitstart'])) {
33
			$request['offset'] = $request['limitstart'];
34
		}
35
		
36
		$this->_request = new KConfig($request);
37
		return $this;
38
	}
39
	
40
	/**
23
	 * Browse a list of items
41
	 * Browse a list of items
24
	 *
42
	 *
25
	 * @return void
43
	 * @return void