I encountered a problem with using paginator with:
https://svn.cakephp.org/repo/trunk/cake/1.2.x.x/cake r6147
For some reason all the table sort links and paging links are coming
out like so: /admin/faqs/admin_index/page:2
That extra /admin_index/ should really be /index/. It appears there's
two patch diffs posted on this bug to fix this problem, but the bug
was marked invalid before these were posted.
The patches fix the sort column issue, but not the paging links.
I created a consolidated patch for paginator.php file, which I could
not attach to the ticket.
Index: paginator.php
===================================================================
--- paginator.php (revision 6147)
+++ paginator.php (working copy)
@@ -212,6 +212,7 @@
* key the returned link will sort by 'desc'.
*/
function sort($title, $key = null, $options = array()) {
+ $admin = Configure::read('Routing.admin');
$options = am(array('url' => array(), 'model' =>
null), $options);
$url = $options['url'];
unset($options['url']);
@@ -225,6 +226,11 @@
if ($this->sortKey($options['model']) == $key && $this-
>sortDir($options['model']) == 'asc') {
$dir = 'desc';
}
+
+ if (preg_match('/'.$admin.'_/i', $this-
>params['action'])) {
+ $url['action'] = preg_replace('/'.$admin.'_/
i', '', $this->params['action']);
+ unset($url[$admin]);
+ }
$url = am(array('sort' => $key, 'direction' => $dir),
$url, array('order' => null));
return $this->link($title, $url, $options);
@@ -238,6 +244,7 @@
* @return string A link with pagination parameters.
*/
function link($title, $url = array(), $options = array()) {
+ $admin = Configure::read('Routing.admin');
$options = am(array('model' => null, 'escape' =>
true), $options);
$model = $options['model'];
unset($options['model']);
@@ -252,6 +259,12 @@
$urlOption = $options['url'];
unset($options['url']);
}
+
+ if (preg_match('/'.$admin.'_/i', $this-
>params['action'])) {
+ $url['action'] = preg_replace('/'.$admin.'_/
i', '', $this->params['action']);
+ unset($url[$admin]);
+ }
+
$url =
am(array_filter(Set::diff(am($paging['defaults'], $paging['options']),
$paging['defaults'])), $urlOption, $url);
if (isset($url['order'])) {
@@ -489,4 +502,4 @@
return $this->output($out);
}
}
-?>
\ No newline at end of file
+?>
James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---