new features

master
Steve Nyemba 10 months ago
parent e3c49a7702
commit 29ffddffa3

@ -13,3 +13,21 @@ padding-left:2%; padding-right:2%;
align-self:center;
}
.main .pane {border-left:1px solid #CAD5E0; height:100%; padding:8px;}
.busy-loading {
background: linear-gradient(90deg, #d3d3d3,#f3f3f3, #000000, #d3d3d3);
animation: gradient 15s ease infinite;
height:28; width:100%;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}

@ -0,0 +1,75 @@
/**
* This file has functions that allow pages to be fetched and rendered on bootup
*/
var bootup = {}
//
// We implement this function using an observer design pattern
bootup.CMSObserver = function(_sysId,_domId,_fileURI){
this._domId = _domId
this._fileURI = _fileURI
this.apply = function (_caller){
var http = HttpClient.instance()
http.setHeader('uri',_fileURI)
var uri = sessionStorage[_sysId]+'/page'
try{
var _domElement = jx.dom.get.instance('div')
_domElement.className = 'busy-loading'
jx.dom.append(_domId, _domElement)
http.post(uri,function(x){
// console.log(jx.dom.exists(_domId))
// var _domElement = jx.dom.get.instance('div')
// _domElement.className = 'busy-and-loading'
// jx.dom.append(_domId, _domElement)
if (x.status == 200){
// jx.dom.set.value(_domId,x.responseText)
// var _domElement = jx.dom.get.instance('div')
// _domElement.innerHTML = x.responseText
setTimeout(function(){
_domElement.innerHTML = x.responseText
_domElement.className = null
},1500)
}
_caller.notify()
})
}catch(error){
_caller.notify()
}
}
}
//
// Finalize the process of rendering the content on the fly
bootup.finalize = function(_id){
this.apply = function(_caller){
menu.runScript('#'+_id)
}
}
bootup.init = function(sys_id,_layout){
if (_layout){
jx.utils.keys(_layout.on.load).forEach(function(_domId){
var observers =
jx.utils.patterns.visitor(_layout.on.load[_domId], function(_uri){
return new bootup.CMSObserver(sys_id,_domId,_uri)
})
observers.push(new bootup.finalize(_domId))
//
// At this point we can execute the observer design pattern
//
// console.log(observers)
jx.utils.patterns.observer(observers,'apply')
})
}
}

@ -38,6 +38,7 @@ Vanderbilt University Medical Center
<script src="{{system.context}}/static/js/jquery/jquery.js"></script>
<script src="{{system.context}}/static/js/menu.js"></script>
<script src="{{system.context}}/static/js/search.js"></script>
<script src="{{system.context}}/static/js/bootup.js"></script>
<script src="{{system.context}}/static/js/fontawesome/js/all.js"></script>
</head>
<script>
@ -50,61 +51,69 @@ Vanderbilt University Medical Center
* @id _domURI of the pane where the output is to be written
* @uri _fileURI of the file
*/
var CMSObserver = function(_domId,_fileURI){
this._domId = _domId
this._fileURI = _fileURI
this.apply = function (_caller){
var http = HttpClient.instance()
http.setHeader('uri',_fileURI)
var uri = '{{context}}/page'
try{
http.post(uri,function(x){
console.log(jx.dom.exists(_domId))
if (x.status == 200){
// jx.dom.set.value(_domId,x.responseText)
var _domElement = jx.dom.get.instance('div')
_domElement.innerHTML = x.responseText
jx.dom.append(_domId, _domElement)
// var CMSObserver = function(_domId,_fileURI){
// this._domId = _domId
// this._fileURI = _fileURI
// this.apply = function (_caller){
// var http = HttpClient.instance()
// http.setHeader('uri',_fileURI)
// var uri = '{{context}}/page'
// try{
// http.post(uri,function(x){
// console.log(jx.dom.exists(_domId))
// if (x.status == 200){
// // jx.dom.set.value(_domId,x.responseText)
// var _domElement = jx.dom.get.instance('div')
// _domElement.innerHTML = x.responseText
// jx.dom.append(_domId, _domElement)
}
// }
_caller.notify()
})
// _caller.notify()
// })
}catch(error){
_caller.notify()
}
}
// }catch(error){
// _caller.notify()
// }
// }
}
var finalize = function(_id){
this.apply = function(_caller){
menu.runScript('#'+_id)
}
}
if (_layout.on != null ){
//
// load and error are required
$(document).ready(function(){
jx.utils.keys(_layout.on.load).forEach(function(_id){
// }
// var finalize = function(_id){
// this.apply = function(_caller){
// menu.runScript('#'+_id)
// }
// }
// if (_layout.on != null ){
// //
// // load and error are required
// // $(document).ready(function(){
// // jx.utils.keys(_layout.on.load).forEach(function(_id){
var observers =
jx.utils.patterns.visitor(_layout.on.load[_id], function(_uri){
return new CMSObserver(_id,_uri)
})
observers.push(new finalize(_id))
//
// At this point we can execute the observer design pattern
//
console.log(observers)
jx.utils.patterns.observer(observers,'apply')
// // var observers =
// // jx.utils.patterns.visitor(_layout.on.load[_id], function(_uri){
// // return new CMSObserver(_id,_uri)
// // })
// // observers.push(new finalize(_id))
// // //
// // // At this point we can execute the observer design pattern
// // //
// // console.log(observers)
// // jx.utils.patterns.observer(observers,'apply')
})
})
}
// // })
// // })
// // $(document).ready(bootup.init)
// }
sessionStorage.setItem('{{system.id}}','{{system.context|safe}}')
var _layout = {{layout|tojson}}
$(document).ready( function(){
bootup.init('{{system.id}}',_layout)
})
</script>
<body>

Loading…
Cancel
Save