diff --git a/.gitmodules b/.gitmodules index 3863860f6..6ad1ec72f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = e107_tests/lib/cpaneluapi url = https://github.com/N1ghteyes/cpanel-UAPI-php-class.git branch = master +[submodule "e107_web/lib/bootstrap-suggest"] + path = e107_web/lib/bootstrap-suggest + url = https://github.com/e107inc/bootstrap-suggest.git diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 6a0335ff8..1e3d4a15f 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -31,6 +31,79 @@ if(!empty($_GET['iframe'])) } +//e107::js('core','bootstrap-suggest/dist/bootstrap-suggest.min.js'); +//e107::css('core','bootstrap-suggest/dist/bootstrap-suggest.css'); +//e107::js('core','bootstrap-suggest/bootstrap-suggest.js'); +//e107::css('core','bootstrap-suggest/bootstrap-suggest.css'); +e107::library('load', 'bootstrap-suggest'); +/* +e107::js('footer-inline', " +$('textarea').suggest(':', { + data: function(q, lookup) { + + $.getJSON('theme.php', {q : q }, function(data) { + console.log(data); + console.log(lookup); + lookup.call(data); + }); + + // we aren't returning any + + } + +}); + + +");*/ + + +e107::js('footer-inline', " + +$('textarea.input-custompages').suggest(':', { + + data: function() { + + var i = $.ajax({ + type: 'GET', + url: 'theme.php', + async: false, + data: { + mode: 'suggest' + } + }).done(function(data) { + // console.log(data); + return data; + }).responseText; + + try + { + var d = $.parseJSON(i); + } + catch(e) + { + // Not JSON. + return; + } + + return d; + }, + filter: { + casesensitive: false, + limit: 300 + }, + endKey: \"\\n\", + map: function(item) { + return { + value: item.value, + text: item.value + } + } +}) + +"); + + + class theme_admin extends e_admin_dispatcher { /** @@ -78,6 +151,18 @@ class theme_admin extends e_admin_dispatcher function init() { + + if(e_AJAX_REQUEST) + { + + $newRoutes = $this->getAllRoutes(); + + echo json_encode($newRoutes); + + + exit; + } + } @@ -169,7 +254,57 @@ class theme_admin extends e_admin_dispatcher } + /** + * @return array + */ + private function getAllRoutes(): array + { + $legacy = array( + 'gallery/index/category', + 'gallery/index/list', + 'news/list/items', + 'news/list/category', + 'news/list/all', + 'news/list/short', + 'news/list/day', + 'news/list/month', + 'news/list/tag', + 'news/list/author', + 'news/view/item', + 'page/chapter/index', + 'page/book/index', + 'page/view/index', + 'page/view/other', + 'page/list/index', + 'search/index/index', + 'system/error/notfound', + 'user/myprofile/view', + 'user/myprofile/edit', + 'user/profile/list', + 'user/profile/view', + 'user/login/index', + 'user/register/index' + ); + + + $newRoutes = e107::getUrlConfig('route'); + + foreach($legacy as $v) + { + $newRoutes[$v] = $v; + } + + ksort($newRoutes); + + $ret = []; + foreach($newRoutes as $k => $v) + { + $ret[] = array('value' => $k, 'label' => $k); + } + + return $ret; + } } diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 60763ac18..02c2c65e8 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -3021,6 +3021,19 @@ class e107 $array = self::callMethod($obj, $methodName,$profile); + if($mode === 'route' && !empty($array)) + { + foreach($array as $k=>$v) + { + if(empty($v['alias']) && !empty($obj->alias)) + { + $v['alias'] = $obj->alias; + } + $new_addon[$key.'/'.$k] = $v; + } + continue; + } + if($array) { foreach($array as $k=>$v) diff --git a/e107_handlers/library_manager.php b/e107_handlers/library_manager.php index 3509d4039..d493d4c02 100755 --- a/e107_handlers/library_manager.php +++ b/e107_handlers/library_manager.php @@ -944,7 +944,7 @@ class core_library - // Animate (local). + // Animate (local). $libraries['animate.css'] = array( 'name' => 'Animate.css (local)', 'vendor_url' => 'https://daneden.github.io/animate.css/', @@ -960,25 +960,38 @@ class core_library ), ), ), - /* 'variants' => array( - // 'unminified' version for debugging. - 'dev' => array( - 'files' => array( - 'css' => array( - 'css/font-awesome.css' => array( - 'zone' => 2, - ), - ), - ), - ), - ),*/ - // Override library path. + 'library_path' => '{e_WEB}lib/animate.css', // 'path' => '3.5.2', 'version' => '3.5.2', ); + // Animate (local). + $libraries['bootstrap-suggest'] = array( + 'name' => 'Bootstrap Suggest (local)', + 'vendor_url' => 'https://github.com/lodev09/bootstrap-suggest', + 'version_arguments' => array( + 'file' => 'bootstrap-suggest.js', + 'pattern' => '/(\d\.\d\.\d+)/', + 'lines' => 3, + ), + 'files' => array( + 'css' => array( + 'bootstrap-suggest.css' => array( + 'zone' => 2, + ), + ), + 'js' => array( + 'bootstrap-suggest.min.js' => array( + 'zone' => 2, + ), + ), + ), + 'library_path' => '{e_WEB}lib/bootstrap-suggest', + 'path' => 'dist', + 'version' => '2.0.3', + ); return $libraries; diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 4806bc9a5..ff813d2b5 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -2599,7 +2599,7 @@ class themeHandler //if(isset($pref['sitetheme_custompages'][$key])) //{ $itext .= $custompage_diz."