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."
- "; + "; diff --git a/e107_tests/tests/unit/e107Test.php b/e107_tests/tests/unit/e107Test.php index 969cbfa65..c058dc320 100644 --- a/e107_tests/tests/unit/e107Test.php +++ b/e107_tests/tests/unit/e107Test.php @@ -832,13 +832,42 @@ class e107Test extends \Codeception\Test\Unit $res = null; $this->assertTrue($res); } - +*/ public function testGetUrlConfig() { - $res = null; - $this->assertTrue($res); - } + + $expected = array ( + 'index' => + array ( + 'alias' => 'contact', + 'regex' => '^{alias}\\/?$', + 'sef' => '{alias}', + 'redirect' => '{e_BASE}contact.php', + ), + ); + + $result = e107::getUrlConfig(); + $this->assertNotEmpty($result['contact']); + $this->assertSame($expected, $result['contact']); + + // ---- + + $expected = array ( + 'alias' => 'contact', + 'regex' => '^{alias}\\/?$', + 'sef' => '{alias}', + 'redirect' => '{e_BASE}contact.php', + ); + + $result = e107::getUrlConfig('route'); + $this->assertNotEmpty($result['contact/index']); + $this->assertSame($expected, $result['contact/index']); + + + + } +/* public function testGetThemeInfo() { $res = null; diff --git a/e107_themes/bootstrap3/css/modern-light.css b/e107_themes/bootstrap3/css/modern-light.css index d7934f942..141ddfbaa 100644 --- a/e107_themes/bootstrap3/css/modern-light.css +++ b/e107_themes/bootstrap3/css/modern-light.css @@ -634,7 +634,7 @@ .table-bordered,.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid rgba(0,0,0,0.3)} .table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px} .table-striped>tbody>tr:nth-of-type(odd){background-color:#fff} - .table-hover>tbody>tr:hover,.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#565656} + .table-hover>tbody>tr:hover,.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color: rgba(0,0,0,0.1);} table col[class*=col-]{position:static;float:none;display:table-column} table td[class*=col-],table th[class*=col-]{position:static;float:none;display:table-cell} .btn-group>.btn-group,.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group,.dropdown-menu{float:left} @@ -1643,7 +1643,8 @@ ul.col-selection { background-color: #FCFDFF; } .e-chart svg text { fill: rgba(0,0,0,0.75); } /* Google charts */ .admin-right-panel .alert a.close { text-shadow: 0 1px 0 #fff; color: rgba(0,0,0,0.6) } - +.admin-right-panel .dropdown-menu { background-color: rgb(252, 253, 255); color: rgba(0,0,0,0.75) } +.admin-right-panel .dropdown-menu a { color: rgba(0,0,0,0.75); } #admin-menus #sc-admin-help { background: #373737 } diff --git a/e107_web/lib/bootstrap-suggest b/e107_web/lib/bootstrap-suggest new file mode 160000 index 000000000..53cccc3fa --- /dev/null +++ b/e107_web/lib/bootstrap-suggest @@ -0,0 +1 @@ +Subproject commit 53cccc3fa4d88b6ad05727fcc925c82b73d41854