|
|
|
@ -117,7 +117,7 @@ menu.events._dialog = function (_item,_context){
|
|
|
|
|
http.get(_context+'/dialog',function(x){
|
|
|
|
|
|
|
|
|
|
jx.modal.show({html:x.responseText,id:'dialog'})
|
|
|
|
|
// menu.events.finalize ('.jxmodal')
|
|
|
|
|
menu.events.finalize ('.jxmodal')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -125,31 +125,39 @@ menu.events._open = function (id,uri,_context){
|
|
|
|
|
id = id.replace(/ /g,'-')
|
|
|
|
|
|
|
|
|
|
var pid = '#content'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.content').children().slideUp()
|
|
|
|
|
// if ( $('#'+id).parent() == null){
|
|
|
|
|
// $('.content').children().slideUp()
|
|
|
|
|
// }else{
|
|
|
|
|
// var parent = $('#'+id).parent()
|
|
|
|
|
// parent.slideUp()
|
|
|
|
|
// if (parent[0].id == null){
|
|
|
|
|
// pid = ('.' + parent[0].className)
|
|
|
|
|
// }else{
|
|
|
|
|
// pid = ('#'+parent[0].id)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
$('#'+id).remove()
|
|
|
|
|
|
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
|
_context = (_context == null)?'':_context;
|
|
|
|
|
httpclient.setHeader('uri',uri)
|
|
|
|
|
httpclient.setHeader('dom',id)
|
|
|
|
|
httpclient.post(_context+'/page',function(x){
|
|
|
|
|
if(x.readyState == 4 && x.status == 200){
|
|
|
|
|
var _html = x.responseText
|
|
|
|
|
var _dom = $(_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(jx.dom.exists(pid) && jx.dom.exists(id)){
|
|
|
|
|
jx.dom.remove(id)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$(pid).append(_dom)
|
|
|
|
|
|
|
|
|
|
// jx.dom.append(pid,_dom)
|
|
|
|
|
// $('#'+id).show('fast',function(){
|
|
|
|
|
// $('#'+pid).slideUp()
|
|
|
|
|
// })
|
|
|
|
|
var ref = pid + ' #'+id
|
|
|
|
|
// menu.events.finalize (ref)
|
|
|
|
|
$(pid).children().slideUp('fast', function(){
|
|
|
|
|
|
|
|
|
|
$(ref ).slideDown('fast',function(){
|
|
|
|
|
|
|
|
|
|
$(pid).slideDown('fast',function(){
|
|
|
|
@ -163,7 +171,8 @@ menu.events._open = function (id,uri,_context){
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
menu.events.finalize (ref)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $('.content').append(_dom)
|
|
|
|
@ -175,8 +184,23 @@ menu.utils = {}
|
|
|
|
|
menu.utils.format = function(text){
|
|
|
|
|
return text.replace(/(-|_)/g,' ').trim()
|
|
|
|
|
}
|
|
|
|
|
menu.utils._delegate = function (_id,_itemIndex,_index) {
|
|
|
|
|
if ($(_id).children().length >= _itemIndex ){
|
|
|
|
|
var _node = $(_id).children()[_itemIndex ]
|
|
|
|
|
if ($(_node).children().length >= _index ){
|
|
|
|
|
var _node = $(_node).children()[_index]
|
|
|
|
|
_node = $(_node).find('.active')
|
|
|
|
|
if ($(_node).length > 0 ){
|
|
|
|
|
$(_node)[0].click()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
menu.events.finalize = function (ref) {
|
|
|
|
|
var scripts = $(ref+' script')
|
|
|
|
|
|
|
|
|
|
jx.utils.patterns.visitor(scripts,function(_item){
|
|
|
|
|
if(_item.text.trim().length > 0){
|
|
|
|
|
|
|
|
|
@ -202,6 +226,7 @@ var QCMSBasic= function(_layout,_context,_clickEvent) {
|
|
|
|
|
this._make = function (_items){
|
|
|
|
|
var _panes = []
|
|
|
|
|
var _context = this._context ;
|
|
|
|
|
|
|
|
|
|
_items.forEach(_item=>{
|
|
|
|
|
var _div = jx.dom.get .instance('DIV')
|
|
|
|
|
|
|
|
|
@ -215,17 +240,20 @@ var QCMSBasic= function(_layout,_context,_clickEvent) {
|
|
|
|
|
$(_div).on('click', function (){
|
|
|
|
|
//
|
|
|
|
|
// how do we process this ...
|
|
|
|
|
|
|
|
|
|
if(this.data.uri) {
|
|
|
|
|
if(this.data.uri && this.data.type != 'open') {
|
|
|
|
|
|
|
|
|
|
if (this.data.type == 'dialog') {
|
|
|
|
|
menu.events._dialog(this.data,_context)
|
|
|
|
|
}else{
|
|
|
|
|
menu.events._open(menu.utils.format(this.data.text),this.data.uri,_context)
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (this.data.uri != null){
|
|
|
|
|
window.open(this.data.uri,'_self')
|
|
|
|
|
}else{
|
|
|
|
|
window.open(this.data.url,menu.utils.format(this.data.text))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -242,6 +270,7 @@ var QCMSBasic= function(_layout,_context,_clickEvent) {
|
|
|
|
|
|
|
|
|
|
// Object.keys(this._layout.menu)
|
|
|
|
|
_names.forEach(function(_name){
|
|
|
|
|
|
|
|
|
|
var _div = _me._make(_layout.menu[_name]) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -267,6 +296,7 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
|
|
|
|
|
this.tabs = jx.dom.get.instance('DIV')
|
|
|
|
|
this.tabs.className = 'tabs'
|
|
|
|
|
this._context = _context
|
|
|
|
|
this._layout = _layout
|
|
|
|
|
this._make = function (text,_item,_event){
|
|
|
|
|
var text = text.trim().replace(/(_|-)/ig,' ').trim()
|
|
|
|
|
var _context = this._context;
|
|
|
|
@ -278,19 +308,33 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
|
|
|
|
|
_button.type= 'radio'
|
|
|
|
|
_button.id = text+'tab'
|
|
|
|
|
_button.name = 'menu-tabs'
|
|
|
|
|
_label.innerHTML = text.toLowerCase()
|
|
|
|
|
_label._uri = _item[0].uri
|
|
|
|
|
|
|
|
|
|
_label.data = {id:text.toLowerCase(),uri:_item[0].uri}
|
|
|
|
|
// _button._uri = _label._uri
|
|
|
|
|
|
|
|
|
|
// if(this._layout.icons[text] != null) {
|
|
|
|
|
var _icon = jx.dom.get.instance('I')
|
|
|
|
|
_icon.className = this._layout.icons[text]
|
|
|
|
|
$(_label).append(_icon)
|
|
|
|
|
text = ' ' + text
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
$(_label).append(text)
|
|
|
|
|
// _button.value= text.toLowerCase()
|
|
|
|
|
$(_button).val(text.toLowerCase())
|
|
|
|
|
_label.htmlFor = _button.id
|
|
|
|
|
$(_label).on('click',function (){
|
|
|
|
|
|
|
|
|
|
menu.events._open(this.innerHTML,this._uri,_context)
|
|
|
|
|
menu.events._open(this.data.id,this.data.uri,_context)
|
|
|
|
|
})
|
|
|
|
|
// $(this.tabs).append( [_button,_label])
|
|
|
|
|
// $(_button).on('click',function (){
|
|
|
|
|
// menu.events._open(this.value,this._uri,_context) ;})
|
|
|
|
|
|
|
|
|
|
return [_button,_label]
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._layout = _layout
|
|
|
|
|
|
|
|
|
|
this.init = function (){
|
|
|
|
|
var _me = this;
|
|
|
|
|
var _make = this._make
|
|
|
|
@ -307,6 +351,7 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
|
|
|
|
|
this.tabs.className = 'tabs'
|
|
|
|
|
$('.main .menu').append(this.tabs)
|
|
|
|
|
$('.main .menu').css({'border':'1px solid transparent'})
|
|
|
|
|
$('.main .menu').css({'grid-template-columns':'64px auto'})
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// We need to load the pages here ...
|
|
|
|
@ -316,7 +361,8 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu.tabs = { }
|
|
|
|
|
menu.delegate = { }
|
|
|
|
|
|
|
|
|
|
// menu.tabs.make = function(text,_clickEvent){
|
|
|
|
|
// var _id = text.trim()
|
|
|
|
|
// if (text.match(/\//)){
|
|
|
|
@ -331,7 +377,7 @@ menu.tabs = { }
|
|
|
|
|
// $(_label).on('click',_clickEvent)
|
|
|
|
|
// return [_button,_label]
|
|
|
|
|
// }
|
|
|
|
|
menu.tabs.init =function (_layout,_context){
|
|
|
|
|
menu.init =function (_layout,_context){
|
|
|
|
|
//
|
|
|
|
|
// Let us determine what kind of menu is suited for this
|
|
|
|
|
// @TODO: Make menus configurable i.e on other areas of the site
|
|
|
|
@ -347,6 +393,8 @@ menu.tabs.init =function (_layout,_context){
|
|
|
|
|
}else{
|
|
|
|
|
_layout.order = {menu:[]}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _count = 0
|
|
|
|
|
var _items = 0
|
|
|
|
|
Object.keys(_layout.menu).forEach(_name=>{
|
|
|
|
@ -359,10 +407,9 @@ menu.tabs.init =function (_layout,_context){
|
|
|
|
|
}else{
|
|
|
|
|
var _menuObject = new QCMSBasic (_layout,_context)
|
|
|
|
|
}
|
|
|
|
|
// console.log(_layout)
|
|
|
|
|
// var _tabs = new QCMSTabs (_layout)
|
|
|
|
|
console.log(_menuObject)
|
|
|
|
|
|
|
|
|
|
_menuObject.init()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|