Commit aab22bda authored by profix898's avatar profix898

*** empty log message ***

parent fac262b1
......@@ -63,7 +63,9 @@ function gallery_menu_menu() {
// Initialize G2 and build the router items
if (_gallery_init(TRUE)) {
$skiparg = 0;
$depth = variable_get('gallery_menu_depth', 5);
$url_generator =& $GLOBALS['gallery']->getUrlGenerator();
for ($i=1; $i<=$depth; $i++) {
$path = variable_get('gallery_base', 'gallery') .'/'. implode('/', array_fill(0, $i, '%gallery_menu'));
$items[$path] = array(
......@@ -72,12 +74,16 @@ function gallery_menu_menu() {
'load arguments' => array('%map', '%index'),
'type' => MENU_CALLBACK
);
$url_generator =& $GLOBALS['gallery']->getUrlGenerator();
if (!(isset($url_generator->_shortUrls) && variable_get('gallery_menu_rewrite', 0))) {
$items[$path]['page callback'] = 'gallery_menu_album';
$items[$path]['page arguments'] = array($i);
}
}
// Derive $skiparg parameter from current rewrite rules
if (!(isset($url_generator->_shortUrls) && variable_get('gallery_menu_rewrite', 0))) {
$skiparg = 1; // TODO: detection/derivation routine
}
variable_set('gallery_menu_skiparg', $skiparg);
}
}
......@@ -93,6 +99,12 @@ function gallery_menu_load($arg, $map, $index) {
return FALSE;
}
// Skip args that are static in the G2 rewrite rules
$skiparg = variable_get('gallery_menu_skiparg', 0);
if ($index <= $skip_arg) {
return TRUE;
}
// Check whether the $arg item/path exists and return the G2 item id (if available)
$clean_urls = (isset($url_generator->_shortUrls) && variable_get('gallery_menu_rewrite', 0));
$path = $clean_urls ? implode('/', $map) : $arg;
......@@ -189,6 +201,7 @@ function gallery_menu_build_links() {
$depth = variable_get('gallery_menu_depth', 5);
$tree = gallery_album_tree(NULL, $depth ? $depth : NULL);
_gallery_menu_traverse($tree);
// TODO: disabled menu items
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment