From e3d0632237290d975515a913c3b8113aa33aaa6d Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Tue, 6 Feb 2024 15:28:54 -0600 Subject: [PATCH] bug fixes --- cms/cloud.py | 11 +++-- index.py | 25 +++++----- static/css/themes/magazine.css | 18 ++++++- static/css/themes/oss.css | 23 +++++++-- static/js/search.js | 85 ---------------------------------- templates/menu.html | 2 +- 6 files changed, 55 insertions(+), 109 deletions(-) diff --git a/cms/cloud.py b/cms/cloud.py index 2454dde..4b6df8d 100644 --- a/cms/cloud.py +++ b/cms/cloud.py @@ -121,13 +121,14 @@ def html (uri,_config) : # return _config def download(**_args): _auth = _args['config']['system']['source']['auth'] - # + + _request = _args['request'] _handler = login(_auth) - - if _args['doc'][-2:] in ['md','ht']: - _stream = html(_args['doc'],_args['config']) + + if _request.args['doc'][-2:] in ['md','ht']: + _stream = html(_request.args['doc'],_args['config']) else: - _stream = _handler.get_file_contents(_args['doc']) + _stream = _handler.get_file_contents(_request.args['doc']) _handler.logout() return _stream pass diff --git a/index.py b/index.py index c08fef1..0c8d15c 100644 --- a/index.py +++ b/index.py @@ -125,18 +125,19 @@ def _getproxy(module,name) : uri = '/'.join(['api',module,name]) - _args = dict(request.args,**{}) - _args['config'] = _handler.config() + # _args = dict(request.args,**{}) + # _args['config'] = _handler.config() _plugins = _handler.plugins() if uri not in _plugins : _data = {} _code = 404 else: pointer = _plugins[uri] - if _args : - _data = pointer (**_args) - else: - _data = pointer() + # if _args : + # _data = pointer (**_args) + # else: + # _data = pointer() + _data = pointer(request=request,config=_handler.config()) _code = 200 if _data else 500 @@ -150,18 +151,20 @@ def _post (module,name): _plugins = _handler.plugins() uri = '/'.join(['api',module,name]) - _args = request.json - _args['config'] = _config + # _args = request.json + # _args['config'] = _config code = 404 _info = "" - if uri in _plugins and _args: + if uri in _plugins : _pointer = _plugins[uri] - _info = _pointer(**_args) + # _info = _pointer(**_args) + _info = _pointer(request=request,config=_handler.config() ) if _info: code = 200 else: - _info = "" + # _info = "" + code = 500 # _info =io.BytesIO(_info) diff --git a/static/css/themes/magazine.css b/static/css/themes/magazine.css index dbe3211..a251bd3 100644 --- a/static/css/themes/magazine.css +++ b/static/css/themes/magazine.css @@ -3,7 +3,7 @@ padding:4px; display:grid; grid-template-columns: 50% 50% ; gap:4px; - grid-template-rows: 48px 48px auto 32px; + grid-template-rows: 48px 64px auto 32px; font-family: sans-serif; font-weight: lighter; font-size:18px; @@ -24,11 +24,24 @@ .main .header .title {font-size:28px; text-transform: capitalize; font-weight:bold} .main .header .subtitle {font-size:14px} .main .header img { width:44px; height:44px;} -.main .menu { grid-row:2; grid-column: 1 / span 2; background-color: #f3f3f3; +.main .menu { grid-row:2; grid-column: 1 / span 2; background-color: #FFFFFF; display:grid; grid-template-columns: 75px repeat(3,250px) ; gap:4px; align-items: left; + border:0px; padding:4px; + border-bottom:3px dotted darkgray; + + } +.main .menu img { width:28px; height:28px;} +.main .menu .icon .button { + border:1px solid #CAD5E0; border-radius:4px; padding:4px; + background-color:#f3f3f3; + height:100%; + ; +} + + .main .content { grid-row:3; grid-column: 1 ; @@ -40,6 +53,7 @@ } + .main .content #index { text-align: left; text-wrap: wrap; diff --git a/static/css/themes/oss.css b/static/css/themes/oss.css index afaccf4..dc4e286 100644 --- a/static/css/themes/oss.css +++ b/static/css/themes/oss.css @@ -24,9 +24,15 @@ .main .header .subtitle {font-style:italic;font-size:14px; color:gray; text-transform: capitalize;} -.main .menu {border:0; background-color: #f3f3f3; height:64px; padding:0px; - display:grid; grid-template:64px repeat(6,1fr); gap:4px; background-color: #ffffff; +.main .menu {border:0; background-color: #f3f3f3; height:48px; padding:0px; + display:grid; grid-template:64px repeat(6,1fr); gap:4px; background-color: #f3f3f3; + align-items: center; +} +.main .menu .icon .button { + border:1px solid #CAD5E0; border-radius:8px; padding:2px; + ; } + /* .main .content img{ width:99%; border:1px solid #CAD5E0; @@ -40,7 +46,17 @@ } */ blockquote { border-left:8px solid #D3D3D3; padding:4px; + background-color: #000000; color:#f3f3f3; + } +blockquote code { margin-top:8px; + background:black; color:#f3f3f3;padding:10px; text-wrap: nowrap; + line-height: 2; width:99%; + font-family: 'Courier New', Courier, monospace; font-weight:lighter; font-size:14px;} +.code { + padding:8px; font-family:'Courier New', Courier, monospace; font-weight: lighter; + background-color: #000000; color:#f3f3f3; font-size:14px; +} .main .content table {border-spacing: 2;} .main .content table .active {font-size:14px} .main .content .banner { @@ -48,9 +64,6 @@ padding:0px; } -.code { margin-top:8px; - background:black; color:#d3d3d3;padding:10px; text-wrap: nowrap; - font-family: 'Courier New', Courier, monospace; font-weight:lighter; font-size:13px;} .main .pane { height:auto;} .main .pane iframe{ width:100%; border:0px; height:80%;} diff --git a/static/js/search.js b/static/js/search.js index 2baac41..e69de29 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -1,85 +0,0 @@ -var search = {} -search.find = function(id,_domid,_attr){ - var nodes = jx.dom.get.children(id) - jx.dom.set.focus(_domid) - var term = jx.dom.get.value(_domid).trim() - term = term == ''?'*':term - if (term.length < 2){ - $(nodes).show() - jx.dom.set.value('found',nodes.length) - return ;} - $(nodes).hide() - term = RegExp(term.replace(/ /,'|'),'ig') - _count = 0 - jx.utils.patterns.visitor (nodes,function(_node){ - - var _data = _node.getAttribute('data') ; - if (_data[0] == '{' || _data[0] == '['){ - _data = JSON.parse(_data) - _found = 0 - _attr.forEach(function(_name){ - _found += _data[_name].match(term) !=null?1:0 - }) - }else{ - _found = _data.match(term)!=null?1:0 - } - _count += _found - if (_found > 0){ - $(_node).show() - } - }) - jx.dom.set.value('found',_count) -} -search._find = function(id,_domid){ - var nodes = jx.dom.get.children(id) - $(nodes).hide() - jx.dom.set.focus(_domid) - var term = jx.dom.get.value(_domid).trim() - if (term.trim().match(/^(author|paper)\:$|''/)){ - $('.search .input-frame .found').text(0) - return ; - } - qfocus = (term.match(/author|paper/)) - - - term.replace(/^((author|paper)\:*)/ig,'').trim() - - term = RegExp(term.replace(/ /,'|'),'ig') - count = 0; - - jx.utils.patterns.visitor(nodes,function(node){ - try{ - var _data = node.getAttribute('data') ; - if (_data != null){ - var _data = JSON.parse( _data) ; - _hasauthors = _data.authors.match(term) != null - _hastitle = _data.title.match(term) != null - _haspub = _data.publication.match(term) != null - _hasname = _data.name.match(term) != null - - if(qfocus != null){ - if (qfocus[0].trim() == 'author'){ - _hasauthors = _hastitle = _haspub = false - }else if (qfocus[0] == 'paper'){ - _hasauthors = _haspub = _hasname =false - } - - } - if (_hasauthors || _hastitle || _haspub || _hasname){ - $(node).show() - ++ count; - - } - } - }catch(e){ - // console.log(e); - ; - } - $('.'+id).slideDown() - $('.search .input-frame .found').text(count) - - - - }) -} - diff --git a/templates/menu.html b/templates/menu.html index ff5e5ac..d19e181 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -1,6 +1,6 @@ {%if system.portal %}
-
+